R2-X2 Posted July 29, 2009 Share Posted July 29, 2009 How can I make a trigger to fire just once, twice (...) ? Link to comment Share on other sites More sharing options...
newbiemodder Posted July 29, 2009 Share Posted July 29, 2009 I've used these script conditionals before: // ST: Check if it's the player entering the trigger, and that it hasn't already fired if (!GetLocalBoolean(OBJECT_SELF, 40) && (GetEnteringObject() == GetFirstPC())) { and: // ST: Make sure the trigger only fires once. SetLocalBoolean(OBJECT_SELF, 40, TRUE); Don't know if that helps at all. Link to comment Share on other sites More sharing options...
R2-X2 Posted July 29, 2009 Author Share Posted July 29, 2009 I think there's a mistake in your script. You've got a {, but no }, so there will be Syntax errors. Link to comment Share on other sites More sharing options...
newbiemodder Posted July 29, 2009 Share Posted July 29, 2009 I'm sorry, it was part of a larger script. Here is the full script I use to fire a dialog only once when a trigger is entered: void main() { // ST: Check if it's the player entering the trigger, and that it hasn't already fired if (!GetLocalBoolean(OBJECT_SELF, 40) && (GetEnteringObject() == GetFirstPC())) { // ST: Get the two NPCs who should converse, set their tags below. object oNPC1 = GetObjectByTag("xyz"); object oNPC2 = GetObjectByTag("abc"); // ST: Check if both NPCs who should converse are present in the area if (GetIsObjectValid(oNPC1) && GetIsObjectValid(oNPC2)) { // ST: Make sure the trigger only fires once. SetLocalBoolean(OBJECT_SELF, 40, TRUE); // ST: Start the dialog. AssignCommand(oNPC1, ActionStartConversation(GetFirstPC(), "dialog name", FALSE, CONVERSATION_TYPE_CINEMATIC, TRUE)); } } } Link to comment Share on other sites More sharing options...
R2-X2 Posted July 30, 2009 Author Share Posted July 30, 2009 Sorry, but can you do a script that only checks, and doesn't do anything else? I need it for other things, which I'm going to insert in the script. Link to comment Share on other sites More sharing options...
Star Admiral Posted July 31, 2009 Share Posted July 31, 2009 Try this. void main() { if( !GetLocalBoolean( OBJECT_SELF, 40 ) && GetEnteringObject() == GetFirstPC() ) { // Stuff SetLocalBoolean( OBJECT_SELF, 40, TRUE ); } else { // Stuff } } - Star Admiral Link to comment Share on other sites More sharing options...
R2-X2 Posted July 31, 2009 Author Share Posted July 31, 2009 That's what I was looking for. Thanks for your help you two. Edit: Is there a way to modify the script so it can be triggered by friendly2 and hostile2 (only f. and h. 2, not hostile1/friendly1) NPCs? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.