• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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