Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Is there a way to make an event global?
What I'm trying to figure out is:
If Event1 has happened, then call Event2.
I know how to do conditionals, but they only work for globals. So I need to know how to define a global as an event. (I think.)
Thanks!
------------------ -- Debra Danillitphil Productions
Quote
Originally posted by Debra: **Is there a way to make an event global?
I know how to do conditionals, but they only work for globals. So I need to know how to define a global as an event. (I think.)**
Debra,
Sure! Create a global, let's call it something like "&&gb;_event1_done" and then within event1 we will set its value to 1.
What this means is that before event1 is executed the global "&&gb;_event1_done" will have a value of null(effectively 0). After event1 is executed then this global will have a value of 1.
Then in event2 you can have as its first line a conditional check to see if "&&gb;_event1_done" is equal to 1. If not then link to an End Event so that event2 is not executed.
Is this what you are looking for? I amsassuming you have 2 seperate events that will execute at seperate times, but you don't want that 2nd event to be executed unless the first one has been previously...
If you simply want event1 to trigger event2, then use the "Call Event" event object and set it to call event2, and place it at the end of event1.
Make sense?
------------------ (url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url) (url="http://"http://stark.evula.net")Stark.evula.net(/url) | (url="http://"http://www.evula.net")EVula.net(/url) | (url="http://"http://mail.ambrosiasw.com/mailman/listinfo/coldstone_dev")Coldstone-dev mailing list(/url)
Thinking about this, there is another situation/solution available as well. If you are looking for a "global event" that will fire off without an action triggering it, if event1 has occured, there is a way to do this as well. Again if you want event2 to fire immediately after event1 then a "call event" would be the easiest and most appropriate way to do things. However if say the player just typed in the self-destruct sequence in the mission computer and in 20 minutes the whole place goes "boom" then you need another way to do things. "Event1" has been called when the player types in the code, but "event2," which will call the explosion, shouldn't happen for 20 minutes and should only occur if event1 has happened.
Ok.
Create yourself a (url="http://"http://stark.evula.net/plugin_faq.htm#tiptimer")timer(/url) which you can adapt from the provided explanation link(feel free to question it if you don't understand it or how it was explained). Have the timer call a 3rd event which does exactly 3 things: Check if event1 has occured(using the global variable method I suggested in my earlier post), and if so check if enough time has passed(again using an incrementing global variable set to tick up as the timer counts), and if the alloted time has passed then call event 2. Kaboom!
Yes, Stark, the explanation (not the timer, but the one above) makes sense.
I take it that when an event happens, the event automatically has a value number added? So if the event happens twice, it has a value of 2? (This is a different question than my first one.) I'm just trying to figure out how the engine actually works.
Thanks much! You're terrific!!
Originally posted by Debra: I take it that when an event happens, the event automatically has a value number added? So if the event happens twice, it has a value of 2? (This is a different question than my first one.) I'm just trying to figure out how the engine actually works.
It depends on how you set up the change global event object.
If, in the change globals event object, you set the object to "Set" the value of your global to 1, each iteration of the overall event will "set" the global's value to 1. Thus every time the event is run the global's value becomes 1.
But, if you set the change globals event object to "Add" 1 to the global, then each iteration of the overall event will "add" 1 to the globals current value. So after the first execution of the event the global's value will be 1, the next time through it will be 2, etc(assuming that nothing else in your game will change the value of this global).
Oh, cool! So I can global Event1 as set to 1. Event1 is a dialogue with NPC1 that must take place before Event2, which is Dialogue 2 with NPC2. So if the Player talks more than once to NPC1, he sees the same dialogue and Event1 is still set to 1.
If the Player talks to NPC2 before he talks to NPC1, then if Event1 = 0, the dialogue can instruct the Player to find NPC1.
So let's say that the Player has talked to NPC1. When the Player has an Event2 dialogue with NPC2 (under the condition that Event1 = 1), then I can change globals in Event2 to have Event1 be set to ADD 1. So if the Player returns to NPC1, the Event1 dialogue will be different, because the event will be 2, not one. And if he returns a third time to NPC1, he can have a different dialogue or no dialogue at all. Or if it's the third time, I can specify a dialogue and change global Event1 to SET to 3, and the Player will see the same dialogue every time he tries to talk to NPC1.
Right?
Originally posted by Debra: Oh, cool! So I can global Event1 as set to 1. Event1 is a dialogue with NPC1 that must take place before Event2, which is Dialogue 2 with NPC2. So if the Player talks more than once to NPC1, he sees the same dialogue and Event1 is still set to 1.
Correct.
So let's say that the Player has talked to NPC1. When the Player has an Event2 dialogue with NPC2 (under the condition that Event1 = 1), then I can change globals in Event2 to have Event1 be set to ADD 1.
No, this you can not do. You can't alter the way an event works from another event. Ie, you can't change the handling of the "Change Globals" from "set" to "add" from an outside event. At least, directly.
If you really wanted to do this, you could create 2 change global events and put them in your linked lists, with one of them able to "set" the global, and the other to "add" to the global. Then you can have a conditional in your main list that checks if "event2" has been run. If it hasn't been run then call the "set" option, and if it has been run then call the "add" option.
So if the Player returns to NPC1, the Event1 dialogue will be different, because the event will be 2, not one. And if he returns a third time to NPC1, he can have a different dialogue or no dialogue at all. Or if it's the third time, I can specify a dialogue and change global Event1 to SET to 3, and the Player will see the same dialogue every time he tries to talk to NPC1.
This is correct, assuming you do someting like the above. Another method you can do is the following:
0: Player hasn't talked to NPC1 1: Player has talked to NPC1 2: Player has talked to NPC2 after talking with NPC1 3: Player has talked to NPC1 after talking with NPC2
NPC1 - First check if the global equals or is greater than 3. If so call your dialog scheme for this condition(where the player has spoken with this NPC already, then talked with NPC2, spoke with this NPC again, so everything is probably all done) - After the above check, place the same check and if true call an End Event from the linked list. - Check if the global equals 2. If so call your dialog for this condition(which is whatever you want to have happen after talking with this NPC after talking with the 2nd NPC. You will then increment the global to 3 so that you know this has happened) - Check the global again for 3, and end the event if it is(since you just incremented to 3 above) - Check the global for the value of 1. If so call your dialog for this condition(which is probably something like, "I told you to go talk with NPC2!"). - Check the global for the value of 1, and end event if true(so we don't continue the event) - Call dialogs for first time encounter(since at this point only a value of 0 will be possible). Be sure to set the global to 1 at the end so we know this NPC has been spoken to.
NPC2 - Check if global is less than 1. If so shoot your dialog about needing to talk with NPC1 first. - Check if global is greater than 1 and if so do the dialog(player has already spoken with this NPC). - Repeat the above check and end the event if true to stop the event from continuing. - Call dialogs for the encounter with conditions met(since at this point the global can only be 1). Be sure to set the global to 2 at the end of this event.
You use a reverse-order scheme for the global checks so that you can do everything in the same event. Since we increment the globals based on what is happening, if we started out with smaller numbers first we would run into a problem with checking the globals. (ie, if you start out with 0 and change it to 1 and then end the event if it is equal to 1, you won't get to the next check where you look for 1).
Does this make sense?
Yes, it does. I think I'm ready to begin working on dialogues now.
Okay, I'm not quite finished asking questions: :frown:
I create a global. Within Event1, I simply "set" the global to the value of "1". And the engine automatically connects the global to Event1?
Not-quite-with-it-yours,
-- Deb
Originally posted by Debra: Okay, I'm not quite finished asking questions
That's ok. As I said before, ask until you run out of questions.
Anything you place within Event1 is a part of Event1, assuming you "call" it. Ie, if you place something in the linked list(right side of the event) and it isn't called, then that object is not executed. Or, if you link something from the main list(left side) to an "End Event" object and this link is executed, then the event stops and anything after this call is not executed.
But if you just place the change globals object which sets your global into your main list, or make sure it is called from the linked list, then it will be a part of the event(because it resides within the event).
Heres an easy way to put it all in one event: Conditional: If the global = 3 then display final dialog/end event (If you displayed a dialog: repeat that step and link it to end event) Conditional: If the global = 2 display dialog Conditional: If the global = 2 Set global to 3 Conditional: If the global = 3 end event Conditional: If the global = 1 display dialog Conditional: If the global = 1 Set global to 2 Conditional: If the global = 2 end event ...
You can keep going for as many times you need to talk to an NPC as needed. I know you could just link a few call events, but this way you can keep your event list shorter. I spend a good bit of time looking for things (and my plugin is only half done). I hope that is useful.
------------------ CI-I@()s
Thank you Stark and Chaos! (As I wipe the mud out of my eyes.)
I created quite an elaborate first contact dialogue session (at least for me.) I'm trying to make things different for the Player according to his class, at least with some of the stuff. So far, so good. I'm very happy to know that the Player only goes through it once, and then Coldstone lets a different dialogue happen from the same NPC.
Thanks again!