Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
I want both of the building to be destroyed in order to make the 3rd building vulnerable. But in the game, you only need to destroy 1 of the 2 buildings to make it vulnerable. Please help! Thanks!
It's better to know the problem in your trigger and then know the solution.
Actually, putting two events together doesn't mean that both should happen in order to run actions. But, if only one of them happens, actions will run. So you should know that the editor just listens to one event that happens between the events.
The solution would be to detect if both are destroyed or not.
Method 1 : Using an increasing integer , when it becomes 2 , that means both are destroyed
Make vulnerable
Events
Unit - Farm 0000 <gen> Dies
Unit - Farm 0001 <gen> Dies
Conditions
Actions
Set Vulnerability_Integer = (Vulnerability_Integer + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Vulnerability_Integer Equal to 2
Then - Actions
Unit - Make Altar of Kings 0002 <gen> Vulnerable
Else - Actions
Method 2 : Using conditions to detect whether the other building is alive or not, via 2 triggers instead of one.
Is it alive
Events
Unit - Farm 0000 <gen> Dies
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Farm 0001 <gen> is dead) Equal to True
Then - Actions
Unit - Make Altar of Kings 0002 <gen> Vulnerable
Else - Actions
Is it alive 2
Events
Unit - Farm 0001 <gen> Dies
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Farm 0000 <gen> is dead) Equal to True
Then - Actions
Unit - Make Altar of Kings 0002 <gen> Vulnerable
Else - Actions
I guarantee that one of these, or both, MUST work. Good luck!
Thanks! The second trigger worked. In the first trigger, I dont know how to do the Set Vulnerability_Integer = (Vulnerability_Integer + 1). How do I do it?
Thanks! The second trigger worked. In the first trigger, I dont know how to do the Set Vulnerability_Integer = (Vulnerability_Integer + 1). How do I do it?
Haha glad to know it worked, it's just an easy thingy although I didn't try it
For the second trigger, you first create a variable in Variables Window, name it whatever you want, just assure the type is 'Integer'.
So it's by default '0', when a building of the two is destroyed, we increase its value by 1 using (Vulnerability_Integer = Vulnerability_Integer + 1), It's Arithmetic, If we replace variables with their values it would be (Vulnerability_Integer = 0 + 1 ). So when the second building is destroyed, the value becomes 2. That means the two buildings have been destroyed. I wish you got it.
The second approach will break under certain circumstances. If a unit dies and then is healed it will still be dead but have life so be counted alive by that trigger condition. Only the AI unit dead test works properly and that is not included in trigger JASS by default. As such I would recommend the counter approach (method 1). He did it by making an integer global and then setting it to arithmetic of itself + 1.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.