This may have already been done, tried looking for someone else who has did it this way but i haven't really seen it. Also this may not be the most efficient way either... Just something im doing in my map unless it starts giving me problems.
ANYWAY
Instead of having to deal with set experience gains or loses through premade effects of 10 or so i done it this way.
Unit Group - Pick each unit in (Any units in (Entire map) owned by player (Triggering player) matching Required: Heroic; Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Variable - Set Picked Hero = (Picked unit)
Bank - Store unit (Picked unit) as "Player Hero" of section "Hero" in bank Player Banks[(Triggering player)]
Bank - Store real (Total experience of (Picked unit)) as "HeroExp" of section "Hero" in bank (Last opened bank)
Bank - Save bank Player Banks[(Triggering player)]
This will convert its total exp. to a real number and store that number in the bank.
Variable - Set Hero Exp[(Triggering player)] = (Load "HeroExp" of section "Hero" from bank (Last opened bank) as real value)
General - For each real Hero Exp[(Triggering player)] from 1.0 to Hero Exp[(Triggering player)] with increment 1.0, do (Actions)
Actions
Environment - Execute Heroexp on (Last restored unit) from player (Triggering player)
The bottom code is the load feature. The way i have this is to do the loop for each 1 exp point that is loaded from the bank.
Ex: The save code converts and saves 37 exp to the bank. The load then retrieves it and does the loop 37 times because the increment is set to 1... I made the effect Heroexp to where it adds only 1 exp. so it will trigger it 37 times therefore giving the exact amount of exp back to the unit.
Im somewhat new to coding on starcraft... I have exp with warcraft but sc2 is just...retarded.. if this is a thing everyone does and doesnt need explaining my bad.. just thought of it and figured it might would help a few people...
This may have already been done, tried looking for someone else who has did it this way but i haven't really seen it. Also this may not be the most efficient way either... Just something im doing in my map unless it starts giving me problems.
ANYWAY Instead of having to deal with set experience gains or loses through premade effects of 10 or so i done it this way.
Unit Group - Pick each unit in (Any units in (Entire map) owned by player (Triggering player) matching Required: Heroic; Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Variable - Set Picked Hero = (Picked unit)
Bank - Store unit (Picked unit) as "Player Hero" of section "Hero" in bank Player Banks[(Triggering player)]
Bank - Store real (Total experience of (Picked unit)) as "HeroExp" of section "Hero" in bank (Last opened bank)
Bank - Save bank Player Banks[(Triggering player)]
This will convert its total exp. to a real number and store that number in the bank.
Variable - Set Hero Exp[(Triggering player)] = (Load "HeroExp" of section "Hero" from bank (Last opened bank) as real value)
General - For each real Hero Exp[(Triggering player)] from 1.0 to Hero Exp[(Triggering player)] with increment 1.0, do (Actions)
Actions
Environment - Execute Heroexp on (Last restored unit) from player (Triggering player)
The bottom code is the load feature. The way i have this is to do the loop for each 1 exp point that is loaded from the bank. Ex: The save code converts and saves 37 exp to the bank. The load then retrieves it and does the loop 37 times because the increment is set to 1... I made the effect Heroexp to where it adds only 1 exp. so it will trigger it 37 times therefore giving the exact amount of exp back to the unit.
Im somewhat new to coding on starcraft... I have exp with warcraft but sc2 is just...retarded.. if this is a thing everyone does and doesnt need explaining my bad.. just thought of it and figured it might would help a few people...
Just give the unit an ability that gives it 100 experience but hide the button from its command card. Then use the ability via triggers.
@zeldarules28: Go
Yea but then you can only add exp in increments of 100 cant you?
@Silentforce09: Go
use a Set Catalog Field Value action, to set the Behaviors, "Heroexp", "Experience" to the value you want. then you only need to call the effect once.