• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Experience ???

Status
Not open for further replies.
Level 15
Joined
Sep 27, 2009
Messages
669
Hi everyone i need to make this:
-When player finishes quest his hero will gain 35 EXP...
-When i do this:
  • Actions
    • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
      • Loop - Actions
        • Hero - Add 35 experience to (Picked unit), Show level-up graphics
It adds me more than 35... How can i fix that, it should give exactly what i wrote... ?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Are you sure you used "(Picked Unit)"?
Because if you used a variable (like Hero, which I HIGHLY suggest you use), it would add 35 x number of units owned by Red.

The most simple solution is creating a unit-variable (with array if it's multi-player) and setting the player's hero to that variable.
So Hero[1] = Red's Hero.
Hero[2] = Blue's Hero.
etc...

Then adding experience becomes easy, you stop leaking unit groups and the trigger actually goes faster.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You're picking up ALL units owned by Player 1, maybe you have more than 1 unit in the map that is NOT a Hero ?
Possible, 1 Hero unit and 3 Normal Unit ???
So, it picks a total of 4 units
Perhaps, 4 * 35 = 140 EXP for your Hero unit
Because, Normal Unit doesn't have EXP Bar, therefore I think that the EXP has been transfered to your Picked Unit, Hero-type Unit
 
Status
Not open for further replies.
Top