• 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Spell] Help with trigger.

Status
Not open for further replies.
Level 14
Joined
Oct 18, 2013
Messages
710
I have this trigger to increase a units agi/intelligence but when it is used it does not.
HinaAct
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Immolation
Actions
Set AbilityIsAct[1] = 1
Set Hero[12] = (Triggering unit)
Set BonusLevel = (Level of Immolation for Hero[12])
Set Formula[4] = ((Agility of Hero[12] (Include bonuses)) / 10)
Set Formula[5] = ((Intelligence of Hero[12] (Include bonuses)) / 5)
Hero - Modify Agility of Hero[12]: Add Formula[4]
Hero - Modify Intelligence of Hero[12]: Add Formula[5]

Can anyone tell me why this would register a value of 0?
Formula is an integer array..

Thanks to any that help ^^ :goblin_boom:
 
Level 7
Joined
Sep 9, 2007
Messages
253
It would be easier to critique your trigger if you used trigger tags.

it looks like you have copied the trigger text, now all you need to do is write [ trigger ] at the start and [/ trigger ] at the end but without the spaces.

  • HinaAct
  • Events
  • Unit - A unit Starts the effect of an ability
  • Conditions
  • (Ability being cast) Equal to Immolation
  • Actions
  • Set AbilityIsAct[1] = 1
  • Set Hero[12] = (Triggering unit)
  • Set BonusLevel = (Level of Immolation for Hero[12])
  • Set Formula[4] = ((Agility of Hero[12] (Include bonuses)) / 10)
  • Set Formula[5] = ((Intelligence of Hero[12] (Include bonuses)) / 5)
  • Hero - Modify Agility of Hero[12]: Add Formula[4]
  • Hero - Modify Intelligence of Hero[12]: Add Formula[5]
if you paste it straight from your trigger it will have the correct indenting. Mine doesn't because I have copied it from your post.
 
Level 5
Joined
Jan 27, 2014
Messages
164
Firstly, you cannot add fractions to your hero stats (except the per level increment in Object Editor).

Secondly, integer values always return a non-fraction value. It doesn't take in consideration of decimals. And it doesn't round up the value for you. For example,

0.99 is considered as 0
1.75 is considered as 1
3.12 is considered as 3

For future reference, you should use real variables if you are expecting decimals in your formula.
 
Level 14
Joined
Oct 18, 2013
Messages
710
Alright. Originally it was a real array but I changed it to an integer when the trigger didn't work to see if that fixed it. Relating to the spell I am trying to make, the trigger didn't work when it was a a real either.
 
Level 5
Joined
Jan 27, 2014
Messages
164
> Relating to the spell I am trying to make, the trigger didn't work when it was a a real either.
Well, I suppose that was due to the first reason I gave, wasn't it? Hero stats are based off integers. So even if you're using real variables, they will be converted to integers after all.

It could be other reasons that I'm not aware of. Because I don't know what is the actual value of the variables. So the best reasons could well be what I've mentioned earlier.
 
Level 14
Joined
Oct 18, 2013
Messages
710
It is pretty odd. As an integer, it is a whole number that can be added to the hero's stat. Even if it rounds down, (which is what I want anyways) it still doesn't work. When I had it as a real, i used the Conversion to Integer command, so it could be added. The hero's agility and intelligence is 20, which should yield 2 and 4 respectively.
 
Level 5
Joined
Jan 27, 2014
Messages
164
> Even if it rounds down
That's exactly the reason.
As I've mentioned, I don't know the true value of your variables. I see that you divide the levels with 5 and 10. So theoretically, if the ability level is lesser than 5/10, you'll get 0 integer value.
 
Level 14
Joined
Oct 18, 2013
Messages
710
The ability level isn't used to determine the stat gain, though I see what you are saying. No, the Intelligence and Agility stats are used to determine the bonus. Both are 20. Also, is there anything wrong with my trigger?
 
Level 5
Joined
Jan 27, 2014
Messages
164
Oh my. I completely mis-read that part.
I tried myself. It's working perfectly. Ability used was Immolation.
Code:
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
    Actions
        Set int[1] = ((Strength of (Triggering unit) (Include bonuses)) / 2)
        Hero - Modify Strength of (Triggering unit): Add int[1]
        Game - Display to (All players) the text: (String(int[1]))
I suggest you to add some game text to see if the values are added correctly or not. Or if the trigger is even fired.

Edit: Btw, the trigger looks fine to me.
 
Last edited:
Level 14
Joined
Oct 18, 2013
Messages
710
I am glad I decided to clarify xD I could see how you misread that, considering the BonusLevel variable IS equal to the level of the ability. I added the Game-Text command and it says 4.000 when the ability is used (I only had it display what is added to int). That means the values arn't being added right, correct? I set hero[12] to triggering unit and add the stat bonus to hero[12]. The Hero array has a size of 20. I can't see what's going wrong from my end.
 
Level 5
Joined
Jan 27, 2014
Messages
164
Well, create a new set of variables (don't use high array size this time around, in fact, for integer, real and unit variables, you can leave the array size as zero). And re trigger the whole damn thing and see if it works.

If it still doesn't, then it could be a trigger clash. Check your other triggers... To do this, turn off most of all your other triggers and try the ability again and see if it works. Alternatively, you can also export the ability trigger to another new map and try.
 
Level 14
Joined
Oct 18, 2013
Messages
710
Good advice. I just facepalmed after I read what you said..My trigger for deactivating immolation was the problem. It "clashed" with the one I was troubleshooting xD
For the deactivation, I used the event "finishes casting an ability" I remember thinking that was it earlier, but forgot to change it. What can I change it to that detect when the player deactivates immolation? Thanks a lot for your help. man. ^^
 
Level 5
Joined
Jan 27, 2014
Messages
164
> that detect when the player deactivates immolation?
Use issued order event.
Code:
Event
 A unit is issued an order with no target
Condition
 Level of Immolation for (Triggering unit) Greater than 0
Actions
 If
   Issued order Equal to immolation
 Then
   Something
 Else

 If
   Issued order Equal to unimmolation
 Then
   Something
 Else
 
Status
Not open for further replies.
Top