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

A problem i have (transfering ability levels to new units)

Status
Not open for further replies.
Level 5
Joined
Feb 19, 2008
Messages
110
Ok ill just explain the problem: In my map, every unit have an ability named "veterancy" it gives a chance to criticalstrike and evade. this ability becomes better when a unit kills an hostile unit. but the way to upgrade units in my map screws this up, when example: A murloc has killed 2 turtles, that gives him level 3 veterancy, he pics up an armour and becomes an armored murloc. the armored murloc goes back to level 1 veterancy. is there any way to prevent this?
 
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Murloc Tiderunner
  • Actions
    • Unit - Create 1 Murloc Huntsman for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees
    • Unit - Set level of Evasion for (Last Created Unit) to (Level of Evasion for (Triggering Unit))
Just replace evasion with your move.. the murloc tiderunner with the normal murloc and replace murloc huntsman with armored murloc
 
Urgh.. yeah.. or you can make it a variable like he said it's more reliable/works better

  • Events
    • A Unit Dies
  • Conditions
    • Unit type of (triggering unit) equal to Murloc
  • Actions
    • Set LevelInteger[1] = (Level of Evasion for (Triggering unit))
    • Unit - Create 1 Armored Murloc for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees
    • Unit - Set level of Evasion for (Last created unit) to LevelInteger[1]
 
Level 9
Joined
Apr 3, 2008
Messages
700
Chief-Oblivion, why array?? Make as Dr Super Good said. Use local integer.

  • Trigger
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to
    • Actions
      • Custom script: local integer i=GetUnitAbilityLevelSwapped(' ', GetTriggerUnit())
      • Unit - Replace (Triggering unit) with a using The old unit's relative life and mana
      • Custom script: call SetUnitAbilityLevelSwapped( ' ', GetLastReplacedUnitBJ(), i )
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
Or just make a global Temporary Integer variable to handle the transfer like this:
  • Trigger
  • Events
  • Unit - A unit Acquires an item
  • Conditions
  • (Unit-type of (Triggering unit)) Equal to (UnitType of (YourUnit))
  • Actions
  • Set TempInt = (Level of Evasion for (Triggering unit))
  • Unit - Replace (Triggering unit) with a NewUnit using The old unit's relative life and mana
  • Unit - Set level of Evasion for (Last Replaced unit) to TempInt
 
Status
Not open for further replies.
Top