I'm working on a pretty nice trigger for one of my map and got stuck somewhere.
A loaded nydus worm spawn and spit lings when you enter a circular region. But before that, a bigger circular region give you a warning that there's a nydus near you. The warning is a sound and a camera
shake. The warning sound and shake loop forever as long as you dont quit the warning region or die in it. It all works...
What doesn't work is : The warning doesn't stop if you get to close and make the nydus spawn. I want the warning to stop definitively when the nydus worm spawned.
It's almost the same trigger like yours, just with the Repeat and If-Then actions switched, another condition in the If-part and a Break action added, which will stop the repeating once the If-conditions fail.
But what do you mean by getting too close? Do you have a second region inside the first one which indicates when a unit is too close? Or how should it work?
Thank you very much for you answer, I'll try it out as soon as I can and give you feed back.
Actually, there is 2 circular regions on top of each other (A wide one and a smaller one). The small one is responsible for the nydus spawning. If you enter the zone, the nydus will spawn in the center. The bigger one is the warning region. If you enter it, it warn you that there is a nydus close to you with cam shake and sound in loop as long as you stay in it. You can't see where the nydus will spawn, the warnign region is like a hint that you are in danger and need to move carefully around the danger zone.
If by mistake you trigger the nydus, I want the warning to turn off for the rest of the game. Thats what I could not acheive. I will try your solution and give some feed-back. I might have other questions in time about the way sound reaches each player, but on thing at a time. I will try to give a video of the result, which is pretty nice :D
First, the warning sound and shake. I would like if the warning sound and shake could only be perceptible by the player who is in it. if not, it will mess up gameplay later, I can predict that.
I set the shake for triggering player and it works, but there is no such option for the sound...
Second, if there is 2 units in the same warning zone, the trigger loop 2 time independently and make two shakes and 2 sounds. I would like a maximum of only unit at a time behing able to trigger a specific warning zone (there is 6 around the map).
I will try to find the solutions, but if you have any hints I will be happy to hear them :D
the warning trigger dosen't turn off, why is thta so?
You might need to add "Stop all instances of trigger" right after the "Turn trigger off". It's because if you simply turn off a trigger, it doesn't mean the actions it executes are stopped in the process. You actually need to stop both the trigger executing the actions and the actions that were launched while the trigger was still active.
Either that or you might need to do "turn (current) trigger off" as the first action. It will prevent the trigger from being executed more than once, so you will need to reactivate it somehow with another action in another trigger, whenever you need to use the "nydus warning" again.
Edit 1: (Before I fix the Spawn Nydus 1 trigger) None worked ZealNaga... Unfortunately... Might be my manipulation though.
Edit 2 : There was a mistake in the first trigger (the one responsible for the nydus spawning when a unit enter a region). Now I made the trigger turn off immediately so a nydus will never spawn again at the same trigger.
Also There is still a problem with the warning trigger... I'm getting pissed off by now XD
If I kill the nydus while it's still playing it's birth animation, it does not take in consideration the third condition and the warning sound and shake still play in loop until I leave the warning trigger circular zone. I'm starting to get lost in logical problems...
The warning sound and shake should stop the moment the nydus spawn... But I suspect the problem to come from my event, since it only trigger all of it when a unit ENTER the zone. But, that does not explain that the warning stop when I LEAVE the zone (nydus spawned or not, it doesn't matter).
Tell me guys if i'm the only one understanding myself XD
I also added a third trigger to stop the warning, since I don't know another way. It does'nt seem clean though... I'm effraid that even if my trigger works fine, it might bug out more eventually since everything is not working smothly.
Total Stop:
Add a "Stop all instances of Nydus Warning" right after the "Turn Nydus Warning off".
Nydus Warning:
I'd suggest regrouping all your If conditions in the "Repeat forever" into an AND operator. I'm never really sure when it does an OR and when it does an AND, so just to be sure I'd suggest you regroup the 3 conditions in one AND.
Spawn Nydus:
Right after the "Turn current trigger off", add a "Turn Nydus Warning off" and a "Stop all instances of Nydus Warning".
To prevent the worm from being killed before starting to unload units:
Right after the "Set General Nydus = last created unit", add a "Make General Nydus invulnerable".
Right before the "Order General Nydus to unload" add a "Make General Nydus vulnerable".
There is also a mistake in your Spawn Nydus script... You set "Nydus Zergling" to be "last created unit". There are 40 of them, so if you leave "last created unit" it will only set the LAST ONE created in the variable. To get the whole group of zerglings in the variable, change the variable type to a Unit Group, instead of Unit. You should have something like "Set Nydus Zerglings = last created cargo units" and it will take all the zerglings inside the Nydus Worm, as a group, and store them in the variable. You'll be able to give orders to the 40 zerglings just by giving an order to the group variable.
Anyway, if it still doesn't work, I'd suggest doing a whole new set of scripts from scratch. Sometimes, it helps. You can disable your triggers by right-clicking on their names (or select them and do CTRL+I), so that they won't interfere with your new ones... If nothing works, you still can re-enable your old triggers and we'll find where is the problem. Eventually.
Ty very much man, almost everything fixed up and I event simplified lots of stuff with your help.
The only thing is that the event General Nydus 1 Unloads cargo is triggered everytime a unit is unloaded and a new order is give to all lings in unit group each time. That make all the zergling attack the same point instead having eache of the atacking a random point in the map playable area. (I want the lings to scatter all over the map).
Haven't had the time to search a lot, I have an exam... I'll give more time to it tonight, it should be fairly simple with variable.
Remove unit from unit groupe (variable Last unloaded unit) 0.5 sec after unit is unloaded... Something like that I guess...
Edit : I just tough about it... Lastly, I'm gonne try to make the warning region only trigerred by ONE unit at a time. If 10 units enter, it just repeat itself 10 time at the same time and loop. I don't want that either.
If 10 units enter, it just repeat itself 10 time at the same time and loop. I don't want that either.
It won't happen, because you added "turn current trigger off" at the beginning of the trigger. So don't worry, unless you manually turn it on again the triggers shouldn't launch multiple times. ;)
Actually, thats the case, because both of these region are stacked on top of each other. The warning region is bigger than the one spawning the nydus, you can get two unit in the warning region without entering the other region that trigger the nydus and turn the warning off.
I was thinking about a condition that would be like this : If any units in region = 2 or more than 2, Clear all instance and turn of trigger.
Unfortunately, I know it will require math integer, and I'm not quite there yet with the trigger editor...
This second trigger is supposed to remove each zergling from the group as soon as it receive it's first
scan move order. it should prevent the unit from receiving multiple orders. Strangely, all the glings scatter randomly untill they reach a target, they will all attack the same target and loop that order each 6-7 second... (if the nydus it still spitting gling of course) I'm clueless XD
<<code>>
Spawn Nydus 1-6 Attack Order 2
Events
Unit - Any Unit is issued an order to Scan Move
Local Variables
Conditions
((Triggering unit) is in Nydus Zergling) == true
Actions
Unit Group - Remove (Triggering unit) from Nydus Zergling
If you don't want 2 warnings at the same time (let's say 2 units enter a warning region each, and you don't want the warning to happen twice):
Just add a condition to the "Warning ON" that will check if a boolean "WarningAlreadyActive" is not true.
Set the WarningAlreadyActive to true in the "Warning ON" trigger, and set it to false in the "Warning OFF" trigger.
Actually it was much more complicated to do it with more than one worm at a time... But I managed to do it, I've done it with 4 worms (you can add more if you want, I added comments to let you know where you need to add things). It seems to work fine after a few tests, but it still is a bit rough (I just managed to make it work, improving the code is another matter!).
What it does:
-a unit in the warning region will launch the warning trigger.
-if it gets in the spawning region, a worm is spawned.
-if another unit is in a warning region (at any moment), it will do a warning only if there's no other warning in effect.
-when you leave a warning region, warnings stop unless another unit is in danger somewhere else.
You can have 4 units in 4 warning regions, there will only be 1 warning at the same time. If a worm is spawned, it stops any further warning in the region and will check that no other region is dangerous (ie. if you have another unit in another warning region). If you leave a warning region, it will stop the warning in that region but you'll still be warned if another unit is close to a spawn region.
It will be more obvious when you'll play it, check the attachment.
It might be a bit hard for you to understand how I did it, and why I did it this way, even with the added comments. In that case, I'm sorry. It's quite hard to explain and I'm not sure how I could explain it better. Anyway, I hope it will help you.
Ty very much, It tried it and it's pretty neat.
It's a little hard for me to understand, but I will eventually get through it. I don't want to copy it from your or I wont be able to fix it or modifie it properlly...
I have other questions related to it, but I might come back for them in acouple of days... thats a lot of new stuff for me :D
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm working on a pretty nice trigger for one of my map and got stuck somewhere.
A loaded nydus worm spawn and spit lings when you enter a circular region. But before that, a bigger circular region give you a warning that there's a nydus near you. The warning is a sound and a camera
shake. The warning sound and shake loop forever as long as you dont quit the warning region or die in it. It all works...
What doesn't work is : The warning doesn't stop if you get to close and make the nydus spawn. I want the warning to stop definitively when the nydus worm spawned.
Here are all the triggers:
The mecanism contain to many trigger, it's not very clean right now and if you have any suggestion, I will be happy to hear them.
You can put the triggers into code tags:
Just leave away all the white spaces in the tags.
So, let's see.. first of all you should know that you can do everything without the two Warning Off triggers:
It's almost the same trigger like yours, just with the Repeat and If-Then actions switched, another condition in the If-part and a Break action added, which will stop the repeating once the If-conditions fail.
But what do you mean by getting too close? Do you have a second region inside the first one which indicates when a unit is too close? Or how should it work?
Thank you very much for you answer, I'll try it out as soon as I can and give you feed back.
Actually, there is 2 circular regions on top of each other (A wide one and a smaller one). The small one is responsible for the nydus spawning. If you enter the zone, the nydus will spawn in the center. The bigger one is the warning region. If you enter it, it warn you that there is a nydus close to you with cam shake and sound in loop as long as you stay in it. You can't see where the nydus will spawn, the warnign region is like a hint that you are in danger and need to move carefully around the danger zone.
If by mistake you trigger the nydus, I want the warning to turn off for the rest of the game. Thats what I could not acheive. I will try your solution and give some feed-back. I might have other questions in time about the way sound reaches each player, but on thing at a time. I will try to give a video of the result, which is pretty nice :D
I tested it and it works, ty very much.
But... there is still 2 things that bug me out :
First, the warning sound and shake. I would like if the warning sound and shake could only be perceptible by the player who is in it. if not, it will mess up gameplay later, I can predict that.
I set the shake for triggering player and it works, but there is no such option for the sound...
Second, if there is 2 units in the same warning zone, the trigger loop 2 time independently and make two shakes and 2 sounds. I would like a maximum of only unit at a time behing able to trigger a specific warning zone (there is 6 around the map).
I will try to find the solutions, but if you have any hints I will be happy to hear them :D
Bumb
And edit...
I found with further testing that even if the nydus worm die, the warning trigger dosen't turn off, why is that so?
When I kill it, it stop, but if I enter the zone again it trigger the warning again... It should be turned off...
You might need to add "Stop all instances of trigger" right after the "Turn trigger off". It's because if you simply turn off a trigger, it doesn't mean the actions it executes are stopped in the process. You actually need to stop both the trigger executing the actions and the actions that were launched while the trigger was still active.
Either that or you might need to do "turn (current) trigger off" as the first action. It will prevent the trigger from being executed more than once, so you will need to reactivate it somehow with another action in another trigger, whenever you need to use the "nydus warning" again.
@ZealNaga: Go
Edit 1: (Before I fix the Spawn Nydus 1 trigger) None worked ZealNaga... Unfortunately... Might be my manipulation though.
Edit 2 : There was a mistake in the first trigger (the one responsible for the nydus spawning when a unit enter a region). Now I made the trigger turn off immediately so a nydus will never spawn again at the same trigger.
Also There is still a problem with the warning trigger... I'm getting pissed off by now XD
If I kill the nydus while it's still playing it's birth animation, it does not take in consideration the third condition and the warning sound and shake still play in loop until I leave the warning trigger circular zone. I'm starting to get lost in logical problems...
The warning sound and shake should stop the moment the nydus spawn... But I suspect the problem to come from my event, since it only trigger all of it when a unit ENTER the zone. But, that does not explain that the warning stop when I LEAVE the zone (nydus spawned or not, it doesn't matter).
Tell me guys if i'm the only one understanding myself XD
I also added a third trigger to stop the warning, since I don't know another way. It does'nt seem clean though... I'm effraid that even if my trigger works fine, it might bug out more eventually since everything is not working smothly.
Total Stop:
Add a "Stop all instances of Nydus Warning" right after the "Turn Nydus Warning off".
Nydus Warning:
I'd suggest regrouping all your If conditions in the "Repeat forever" into an AND operator. I'm never really sure when it does an OR and when it does an AND, so just to be sure I'd suggest you regroup the 3 conditions in one AND.
Spawn Nydus:
Right after the "Turn current trigger off", add a "Turn Nydus Warning off" and a "Stop all instances of Nydus Warning".
To prevent the worm from being killed before starting to unload units:
Right after the "Set General Nydus = last created unit", add a "Make General Nydus invulnerable".
Right before the "Order General Nydus to unload" add a "Make General Nydus vulnerable".
There is also a mistake in your Spawn Nydus script... You set "Nydus Zergling" to be "last created unit". There are 40 of them, so if you leave "last created unit" it will only set the LAST ONE created in the variable. To get the whole group of zerglings in the variable, change the variable type to a Unit Group, instead of Unit. You should have something like "Set Nydus Zerglings = last created cargo units" and it will take all the zerglings inside the Nydus Worm, as a group, and store them in the variable. You'll be able to give orders to the 40 zerglings just by giving an order to the group variable.
Anyway, if it still doesn't work, I'd suggest doing a whole new set of scripts from scratch. Sometimes, it helps. You can disable your triggers by right-clicking on their names (or select them and do CTRL+I), so that they won't interfere with your new ones... If nothing works, you still can re-enable your old triggers and we'll find where is the problem. Eventually.
@ZealNaga: Go
Ty very much man, almost everything fixed up and I event simplified lots of stuff with your help.
The only thing is that the event General Nydus 1 Unloads cargo is triggered everytime a unit is unloaded and a new order is give to all lings in unit group each time. That make all the zergling attack the same point instead having eache of the atacking a random point in the map playable area. (I want the lings to scatter all over the map).
Haven't had the time to search a lot, I have an exam... I'll give more time to it tonight, it should be fairly simple with variable.
Remove unit from unit groupe (variable Last unloaded unit) 0.5 sec after unit is unloaded... Something like that I guess...
Edit : I just tough about it... Lastly, I'm gonne try to make the warning region only trigerred by ONE unit at a time. If 10 units enter, it just repeat itself 10 time at the same time and loop. I don't want that either.
It won't happen, because you added "turn current trigger off" at the beginning of the trigger. So don't worry, unless you manually turn it on again the triggers shouldn't launch multiple times. ;)
@ZealNaga: Go
Actually, thats the case, because both of these region are stacked on top of each other. The warning region is bigger than the one spawning the nydus, you can get two unit in the warning region without entering the other region that trigger the nydus and turn the warning off.
I was thinking about a condition that would be like this : If any units in region = 2 or more than 2, Clear all instance and turn of trigger.
Unfortunately, I know it will require math integer, and I'm not quite there yet with the trigger editor...
Also, here is the new attack order trigger
This second trigger is supposed to remove each zergling from the group as soon as it receive it's first
scan move order. it should prevent the unit from receiving multiple orders. Strangely, all the glings scatter randomly untill they reach a target, they will all attack the same target and loop that order each 6-7 second... (if the nydus it still spitting gling of course) I'm clueless XD
<<code>>
Spawn Nydus 1-6 Attack Order 2
Events
Unit - Any Unit is issued an order to Scan Move
Local Variables
Conditions
((Triggering unit) is in Nydus Zergling) == true
Actions
Unit Group - Remove (Triggering unit) from Nydus Zergling
<</code>>
Here's what you need, see attachment.
If you don't want 2 warnings at the same time (let's say 2 units enter a warning region each, and you don't want the warning to happen twice): Just add a condition to the "Warning ON" that will check if a boolean "WarningAlreadyActive" is not true. Set the WarningAlreadyActive to true in the "Warning ON" trigger, and set it to false in the "Warning OFF" trigger.
Actually it was much more complicated to do it with more than one worm at a time... But I managed to do it, I've done it with 4 worms (you can add more if you want, I added comments to let you know where you need to add things). It seems to work fine after a few tests, but it still is a bit rough (I just managed to make it work, improving the code is another matter!).
What it does:
-a unit in the warning region will launch the warning trigger.
-if it gets in the spawning region, a worm is spawned.
-if another unit is in a warning region (at any moment), it will do a warning only if there's no other warning in effect.
-when you leave a warning region, warnings stop unless another unit is in danger somewhere else.
You can have 4 units in 4 warning regions, there will only be 1 warning at the same time. If a worm is spawned, it stops any further warning in the region and will check that no other region is dangerous (ie. if you have another unit in another warning region). If you leave a warning region, it will stop the warning in that region but you'll still be warned if another unit is close to a spawn region.
It will be more obvious when you'll play it, check the attachment.
It might be a bit hard for you to understand how I did it, and why I did it this way, even with the added comments. In that case, I'm sorry. It's quite hard to explain and I'm not sure how I could explain it better. Anyway, I hope it will help you.
@ZealNaga: Go
Ty very much, It tried it and it's pretty neat. It's a little hard for me to understand, but I will eventually get through it. I don't want to copy it from your or I wont be able to fix it or modifie it properlly...
I have other questions related to it, but I might come back for them in acouple of days... thats a lot of new stuff for me :D