View Full Version : Spawn if and triggers
BlackDeath
09-15-2006, 07:50 AM
I recently modified the "tanks" mission to allow the player to choose his starting tank (a playable one of course). To do so, i created 7 triggers, one for each tanks (including M2s) and conditionned the tank spawn by the activation of a specific trigger. This is where the problems appear : i dont want the player to have to possibility to get multiple tanks. To prevent that to happend, i added an other condition which doesnt allow the tank to spawn if there is another tank already created. (number of allied force <1)
the second problem is that if the player choose the tank in the game (i let him 10s to do so) that may act as a defeat since there is no unit in game (so i added a M113FO in the game).
Now that works if the player chooses its tank ingame.
But i found an other problem :
i saw we could activate the triggers from the briefing menu. If we activate several triggers at this time, when the game starts, corresponding tanks spawn since they are created at the same moment and the fact that number of units fielded >1 cannot be verified.
I tried to conditionned those triggers, i.e if trigger M1 is set to true AND if trigger Leo1A5 is not set to true ... AND trigger M3A2 is not set to true then the M1 spawns. But there is not enough "AND" at my disposal.
Can we change that command line by ourself and if yes, how?
But if that would work, an other problem would appear : how would the game react if 2 triggers are activated? What tank would finally spawn?
Any other idea to resolve that?
GaryOwen
09-15-2006, 08:12 AM
Try this:
Set a condition 'One' such that it is true only when trigger 1, trigger 2, or trigger 3 is not set.
Set a condition 'Two' such that it is true only when trigger 2, trigger 3, or trigger 4 is not set.
Set a condition 'Three' such that it is true only when trigger 3, trigger 4, or trigger 5 is not set.
Set a condition 'Four' such that it is true only when trigger 4, trigger 5, or trigger 6 is not set.
Set a condition 'Five' such that it is true only when trigger 5, trigger 6, or trigger 7 is not set.
Set a condition 'Six' such that it is true only when trigger 1, trigger 3, or trigger 4 is not set.
Set a condition 'Seven' such that it is true only when trigger 1, trigger 2, or trigger 4 is not set.
Set a condition 'Eight' such that it is true only when trigger 4, trigger 6, or trigger 7 is not set.
Set a condition 'Nine' such that it is true only when trigger 4, trigger 5, or trigger 7 is not set.
Then combine the relevant two of those conditions with the set trigger in your spawn if command.
For example to spawn the trigger One vehicle:
Spawn if:
Trigger One is set, and;
Condition Two is true, and;
Condition Five is true.
It's not that elegant, and you might have to fiddle a bit with the necessary permutations of the numbered conditions, but something along those lines might work.
If there is a further problem with setting and unsetting triggers then set up seven events to correspond to the seven triggers, e.g., event 'One' is true when trigger 'One' is set and mission time is greater than zero. Then substitute Event One for Trigger One in the above spawn if command and substitute the corresponding events for the triggers in the numbered conditions.
BlackDeath
09-15-2006, 08:23 AM
yep, thats true. Just hope ive not too much conditions. Sure there is no way to modify the code itself? No way to oonly let one trigger be activated (which would delete or uncheck the others)?
but what tank would spawn in the case of the activation of 2 triggers (in the briefing phase), either both of'em, or the first trigger would be activated the first or none of'em?
GaryOwen
09-15-2006, 08:36 AM
Of course it would be much easier to just go in and change the vehicle in the mission editor and resave as Tanks (Leo 1), or whatever, seven times and then the player can choose by loading the appropriate scenario file rather than playing with triggers.
BlackDeath
09-15-2006, 08:40 AM
naaahhh, thats too easy.
and if i can find a good solution there, i might use it in other scenarii!
GaryOwen
09-15-2006, 09:01 AM
but what tank would spawn in the case of the activation of 2 triggers (in the briefing phase), either both of'em, or the first trigger would be activated the first or none of'em?
Use the events that tie the setting of the trigger to the mission time. That way the player would have to start the clock in order to get the trigger to work properly.
BlackDeath
09-15-2006, 11:51 AM
Use the events that tie the setting of the trigger to the mission time. That way the player would have to start the clock in order to get the trigger to work properly.
good idea.... will do. didnt know we can do that
Now, just have to find a better way to condition the spawning with triggers & events
Homer
09-15-2006, 03:06 PM
Try this and see if this is something along the lines of what you are looking for. I didnt setup anything to prevent multiple units spawned at the same time so only enable triggers one at a time.
Please bear in mind that this scenario is probably the 3rd scenario that I ever made, so everything might not work like it did in theory :)
GaryOwen
09-15-2006, 03:57 PM
Okay, in my suggestion the conditions should be using the AND connector rather than the OR connector. D'oh.
GaryOwen
09-16-2006, 07:15 AM
I've tested this and it seems to work as you wanted.
BlackDeath
09-18-2006, 02:26 PM
ok i tried it and it seems to work fine... thank you!
anyway, is there a way to deactivate triggers in the briefing or, only deactivate some of them with a condition? (i dont like when its too easy)
vBulletin® v3.7.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.