• 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.

[Trigger] Any1 know?

Status
Not open for further replies.
Level 6
Joined
Nov 28, 2007
Messages
203
  • Hero - Add ((Hero level of (Triggering unit)) x ((Hero level of (Triggering unit)) - ((Hero level of (Triggering unit)) + 250))) experience to (Triggering unit), Show level-up graphics
when this happens, the hero's xp goes up to like "41723840231/100" and it doesn't lvl up >.<
any1 know why? :p
 
Level 6
Joined
Nov 28, 2007
Messages
203
nah, that's the unit level. that's a different thing. i want it to be the hero lvl; so that when it lvls up, it will gain more xp.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Unit - Level Of Unit

Blizzard Comment: "This may be used for heros and regular units".

[Edit] Ok I tested it with heros level and it worked fine.
Because of this I can see only two possible problems.

1. There is no triggering unit.

2. The ((X exp) - (X exp)) is equal or less then 0.
 
Level 6
Joined
Nov 28, 2007
Messages
203
Yeh.. That's unit lvl. You can only change it in Object Editor.
It's only hero-lvl that changes when you lvl up.
But thanks anyway :wthumbsup:

[EDIT]: here's the whole trigger:
  • Xtra xp 1 Spell
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Not equal to Abilities_Casted[0]
      • (Ability being cast) Not equal to Abilities_Casted[1]
      • (Ability being cast) Not equal to Abilities_Casted[2]
      • (Ability being cast) Not equal to Abilities_Casted[3]
      • (Ability being cast) Not equal to Abilities_Casted[4]
      • (Ability being cast) Not equal to Abilities_Casted[5]
      • (Ability being cast) Not equal to Abilities_Casted[6]
      • (Ability being cast) Not equal to Abilities_Casted[7]
      • (Ability being cast) Not equal to Abilities_Casted[8]
      • (Ability being cast) Not equal to Abilities_Casted[9]
      • (Ability being cast) Not equal to Abilities_Casted[10]
      • ((Triggering unit) is A Hero) Equal to True
      • (Owner of (Triggering unit)) Not equal to Player 11 (Dark Green)
      • (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
      • (Owner of (Triggering unit)) Not equal to Neutral Hostile
      • (Owner of (Triggering unit)) Not equal to Neutral Passive
    • Actions
      • Hero - Add ((Hero level of (Triggering unit)) x ((Hero level of (Triggering unit)) - ((Hero level of (Triggering unit)) + 250))) experience to (Triggering unit), Show level-up graphics
      • Set Abilities_Casted[AbilitiesCasted] = (Ability being cast)
      • Set AbilitiesCasted = (AbilitiesCasted + 1)
      • Wait 0.05 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AbilitiesCasted Greater than or equal to 9
        • Then - Actions
          • Set AbilitiesCasted = 0
        • Else - Actions
i first had the give xp action like this:
  • Hero - Add ((Hero level of (Triggering unit)) x 250) experience to (Triggering unit), Show level-up graphics
but when i changed it, it didn't work :p
 
His is like this:
Hero Level * ( Hero Level - ( Hero Level + 250 ) )
example:
5 * ( 5 - ( 5 + 250 ) )
= 5 * ( 5 - 255 )
= 5 * (-250)
= -1250

Add a *(-1) before the 2nd Hero Level and it works.
  • Hero - Add ((Hero level of (Triggering unit)) x (-1 x ((Hero level of (Triggering unit)) - ((Hero level of (Triggering unit)) + 255)))) experience to (Triggering unit), Hide level-up graphics
This is how it's done:

Add Experience
Arithmetic ->

1. Hero Level
2. Arithmetic ->

2.1. -1
2.2. Arithmetic ->

2.2.1. Hero Level
2.2.2. Arithmetic ->

2.2.2.1. Hero Level
2.2.2.2. 255
 
Level 6
Joined
Nov 28, 2007
Messages
203
No... What you did was this:

Hero Level² - (Hero Level + 250)
In other words: you subtracted 250.

If your Hero is lower level than 17, this results in a negative number.

Yep, ty :p Didn't notice that >.<
btw, gz for ur 1000th post :wgrin:

And yes, Raft_PL, that's what i wanted ^^

DragoonZombie, i dunno what u were trying to xplain, but thx anyway :p
 
Last edited:
Level 6
Joined
Nov 28, 2007
Messages
203
this should work:
  • Hero - Add ((((Hero level of (Triggering unit)) x (Hero level of (Triggering unit))) + 250) - (Hero level of (Triggering unit))) experience to (Triggering unit), Show level-up graphics
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,259
The problem is that you used maths in the wrong way.

Remember that brackets are run before multiplaction and divison and that is what was your problem.
WC3 will always preform the brackets like in real math, and so will it do multiplication/ division before subtraction/ addition.

In jass this is really easy to see as unlike GUI you do not have to use those insane bracket lay outs.
 
Status
Not open for further replies.
Top