Thursday, April 19, 2012

Trigger that makes a trigger spawned unit cast a spell upon a certain event. Help!

Ok so i want my boss unit to cast a spell when at the point it drops below 30k life. Now, this would seem simple if the boss were already on the map at init, but as he is spawned via a trigger during gameplay it got more complicated.

After being introduced to variables i thought i had my problem solved and quickly wrote up these.


Code:
test
Events
Player - Player 1 (Red) types a chat message containing rekhan as An exact match
Conditions
Actions
Unit - Create 1 Anub'Rekhan for Neutral Hostile at (Center of Region 011 <gen>) facing 360.00 degrees
Set Rekhan = (Last created unit)

Ok, here, i created a Unit variable and called it "Rekhan" for the sake of the bosses name. After red player types in the word rekhan, the boss unit is spawned. I then added the action to assign him to the aforementioned unit variable. My next step is as follows.


Code:
test locust swarm
Events
Unit - A unit Is attacked
Conditions
(Triggering unit) Equal to Rekhan
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Life of Rekhan) Less than 30000.00
Then - Actions
Unit - Order Rekhan to Undead Crypt Lord - Locust Swarm
Trigger - Turn off (This trigger)
Else - Actions
Do nothing

Here, when a unit is attacked, it checks whether the unit being attacked is the unit variable Rekhan (which has my boss unit assigned to it) then, checks of the variable's life (my boss unit's life) is below 30k, if so, it orders it to cast Locust Swarm. Then turns off the trigger so it wont repeat and spam spells.

Only problem is, the trigger doesn't work. Can anyone tell me why it doesn't work and what i can do to fix it?

Thanks for all your help so far guys, you rock! |||try
Code:
Attacked Unit = Rekhan

instead of
Code:
Triggering Unit

if that doesn't work, try adding a short wait before the rest of the actions. good luck :)|||Thanks for the input. I tried it on both Event Response - Triggering Unit and Event Response - Attacked Unit. I also tried giving the boss unit the ability it's being ordered to cast, also tried without him having said ability.

He had more than enough mana to use it, then i set the mana cost for the ability to 0 so it shouldn't be a factor anyway. Here is my trigger as of now:


Code:
test locust swarm
Events
Unit - A unit Is attacked
Conditions
(Attacked unit) Equal to Rekhan
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Life of Rekhan) Less than 30000.00
Then - Actions
Wait 0.01 seconds
Unit - Order Rekhan to Undead Crypt Lord - Locust Swarm
Trigger - Turn off (This trigger)
Else - Actions
Do nothing

It still doesn't work though. Got any more ideas guys? |||You're sure Rekhan has the locust swarm ability?

If it does, you could also try this: clear the "test locust swarm" trigger you have.

Then, to make sure that the "test locust swarm" trigger does not go off when you don't want it to, give it an impossible event and make sure it's the only event:
Code:
Player - Neutral Hostile types a chat message containing ThisDoesNotWork as An exact match

Then in the trigger where you create Rekhan do this:


Code:
Trigger - Add to test locust swarm <gen> the event (Unit - Rekhan's life becomes Less than 30000.00)

Then as action of "test locust swarm" use the actions you had before:
Code:
Trigger - Turn off (This trigger)
Unit - Order Rekhan to Undead Crypt Lord - Locust Swarm
|||Thanks for the advice Quertimus, i did what you told me, still no effect however. Trigger still refuses to work. I checked and double checked all the requirements, Anub'Rekhan definatley has the Locust Swarm ability (he just wont use it by himself for some odd reason). I really cannot think what could be stopping it from working. Here are my triggers as of now;


Code:
test
Events
Player - Player 1 (Red) types a chat message containing rekhan as An exact match
Conditions
Actions
Unit - Create 1 Anub'Rekhan for Neutral Hostile at (Center of Region 011 <gen>) facing 360.00 degrees
Set Rekhan = (Last created unit)
Trigger - Add to test locust swarm <gen> the event (Unit - Rekhan's life becomes Less than 30000.00)


Code:
test locust swarm
Events
Player - Neutral Hostile types a chat message containing ThisDoesNotWork as An exact match
Conditions
Actions
Unit - Order Rekhan to Undead Crypt Lord - Locust Swarm
Trigger - Turn off (This trigger)

|||Is the ability Locust Swarm a hero ability, or a unit ability? (In your map)|||Well, originally i had created a custom Locust Swarm as a unit ability, but then i saw that you cannot select a custom ability when ordering a unit to cast through a trigger, so i had to manipulated the original Locust Swarm to my desired statistics.

So the Locust Swarm he is being ordered to cast, is the original Hero Ability with my modifications.|||But did you make it a unit ability?

Is the boss a hero or a unit?

And by the way; although you can't choose custom abilities, this does not matter, since it's still related to the ability that you made a copy of. So when you're unable to choose the custom ability, the ability it deviated from is then what you need.|||Locust Swarm is still a Hero Ability.

My boss is a custom Hero Unit based on the Undead Crypt Lord.


Quote:






View Post

And by the way; although you can't choose custom abilities, this does not matter, since it's still related to the ability that you made a copy of. So when you're unable to choose the custom ability, the ability it deviated from is then what you need.




Would that not then attempt to cast multiple spells of the same base origin? Or am i being dumb and missing something?

If what i think is correct that may be my problem, i have a second instance of the Locust Swarm spell in my Object Editor as a Unit Ability.|||Quote:






View Post

Would that not then attempt to cast multiple spells of the same base origin? Or am i being dumb and missing something?




It will not happen, since you're ordering a specific unit to do it, others with the ability will not be affected.

If you were saying that if a unit had 2 abilities of the same origin, it would be bad even without the trigger, since the abilites will conflict when used. (If one goes in cooldown, so will the other.)

Make the locust swarm a Unit ability, it might be the ability has not been learned by the boss, so he can't use it.|||You're a godsend Quertimus.

I changed to giving him the custom Unit Ability i based on Locust Swarm and now all works perfectly!

I have two questions i was wondering if you could answer though;

1) Even though he has the ability, he wont use it on his own, why is that?

2) What does "Data - Damage Return Threshold" mean on the Locust Swarm data?


Quote:






View Post

It will not happen, since you're ordering a specific unit to do it, others with the ability will not be affected.




Aplogies, it was me being dumb. I was still under the impression you could order units to cast abilities they don't have. |||Quote:




1) Even though he has the ability, he wont use it on his own, why is that?




I don't know, what I do know is that they never do use it, it got probably something to do with the AI which does not recognize the ability.


Quote:




2) What does "Data - Damage Return Threshold" mean on the Locust Swarm data?




I'm not sure, I've not looked into the ability that much, but I think it has something to do with the maximum damage that will be converted to life, probably per insect.|||Ok, thanks for the help!

At least i know i'm not in danger of him randomly choosing to use it after all.

No comments:

Post a Comment