Hi All, hope someone can help. I'm pretty new to Map Editing and coding in general so my understanding is pretty much limited to "If this > Then That"
I have created most of a custom mission map but as others have done in the past, when it comes to Boss fights I want to setup a trigger that goes something like "If Boss Health is =< 75% of max health, then Stop Trigger X and activate trigger Y. I have looked in the Trigger action menu's for this type of trigger command, looked at the SC2 Mapster WIKI and well as a few forum posts here, but can't seem to find the correct execution of code. I'm sure I've just missed a guide or forum post for this so if anyone knows out right or can point me in the direction of a guide to follow that'll be brill.
Heres what I attempted so far with my limited knowledge of Variables. (which unfortunately the trigger seems to skip, so the trigger complete as soon as the units health changes rather than at 75%. )
I think the easiest way would be to use a "While" loop. These take conditions similar to "if then". A while loop continues to loop as long as the conditions are true. If they aren't true the first time they'll never get executed (same as if then). If a while loop reaches the end of itself, it'll check the conditions again, and if they are still true, it will play through again (different than if then).
So you can use if boss health is > 75%. You'll probably also want to add boss is alive to each phase as well to be on the safe side. And you'll want some kind of wait action in your while loop (probably at the end) otherwise you can end up with an infinite loop that could crash the game.
Also if you want these phases in separate triggers, the following actions could be of use: "turn trigger on/off", "stop trigger", "run trigger".
That worked a treat MaskedImposter, following your advise and watching an extra vid from OneTwoSC now I know with your advisse that while loops would be the key, I have got my code working. (couldn't find the "If units alive" command as of yet but still it works. )
Cheers both, i'm sure its not the cleanest way of getting the job done but i've managed to get it working with your advise pointing me in the right direction. Cheers for your suggestion too BaneBurst.
I now have a fully fuctional boss battle for my map with 4 phases per 25% health lost. 👌
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi All, hope someone can help. I'm pretty new to Map Editing and coding in general so my understanding is pretty much limited to "If this > Then That"
I have created most of a custom mission map but as others have done in the past, when it comes to Boss fights I want to setup a trigger that goes something like "If Boss Health is =< 75% of max health, then Stop Trigger X and activate trigger Y. I have looked in the Trigger action menu's for this type of trigger command, looked at the SC2 Mapster WIKI and well as a few forum posts here, but can't seem to find the correct execution of code. I'm sure I've just missed a guide or forum post for this so if anyone knows out right or can point me in the direction of a guide to follow that'll be brill.
Heres what I attempted so far with my limited knowledge of Variables. (which unfortunately the trigger seems to skip, so the trigger complete as soon as the units health changes rather than at 75%. )
Cheers for any Help - Luke.
I think the easiest way would be to use a "While" loop. These take conditions similar to "if then". A while loop continues to loop as long as the conditions are true. If they aren't true the first time they'll never get executed (same as if then). If a while loop reaches the end of itself, it'll check the conditions again, and if they are still true, it will play through again (different than if then).
So you can use if boss health is > 75%. You'll probably also want to add boss is alive to each phase as well to be on the safe side. And you'll want some kind of wait action in your while loop (probably at the end) otherwise you can end up with an infinite loop that could crash the game.
Also if you want these phases in separate triggers, the following actions could be of use: "turn trigger on/off", "stop trigger", "run trigger".
Cheers MaskedImposter. Ill give that a go and let you know the result. 👍
That worked a treat MaskedImposter, following your advise and watching an extra vid from OneTwoSC now I know with your advisse that while loops would be the key, I have got my code working. (couldn't find the "If units alive" command as of yet but still it works. )
Cheers for your help.
Luke.
From your screenshot, it looks like you have the condition in an if then. The condition should be in the while loop.
You could also use a unit takes dmg event, and condition if heatlh of triggering unit is < 75 percent,
then inside the trigger: use the 'Stop Trigger' action to end trigger X and 'run trigger' to run trigger Y.
Cheers both, i'm sure its not the cleanest way of getting the job done but i've managed to get it working with your advise pointing me in the right direction. Cheers for your suggestion too BaneBurst.
I now have a fully fuctional boss battle for my map with 4 phases per 25% health lost. 👌