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

Model change in-game

Status
Not open for further replies.
Level 3
Joined
Aug 12, 2008
Messages
34
Hey guys :grin:!

I was wondering, is it possible to change a unit's model file in-game? For instance, changing a Peasant's model file to a Footman while playing, or is replacement the way to go? :)

~Razorwind~
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
If you want to replace a unit,use:
  • Unit - Replace (Triggering unit) with a Footman using The old unit's relative life and mana
  • Selection - Select (Last Replaced unit) for (Owner of (Last Replaced unit))
If it's a hero,you'd need to set all the stats 'n experience:
  • Set IntegerVariable[0] = Hero experience of (Triggering unit)
  • Set IntegerVariable[1] = Strength of (Triggering unit) (Exclude bonuses)
  • Set IntegerVariable[2] = Agility of (Triggering unit) (Exclude bonuses)
  • Set IntegerVariable[3] = Intelligence of (Triggering unit) (Exclude bonuses)
  • Unit - Replace (Triggering unit) with a Paladin using The old unit's relative life and mana
  • Hero - Set (Last Replaced unit) experience to IntegerVariable[0], Hide level-up graphics
  • Hero - Modify Strength of (Last Replaced unit): Set to IntegerVariable[1]
  • Hero - Modify Agility of (Last Replaced unit): Set to IntegerVariable[2]
  • Hero - Modify Intelligence of (Last Replaced unit): Set to IntegerVariable[3]
  • Selection - Select (Last Replaced unit) for (Owner of (Last Replaced unit))
 
Level 3
Joined
Aug 12, 2008
Messages
34
Ah, thanks - helped alot :)

Now, if you could help me with one more thing, I would be most grateful :D
I am asking this because I want to make a spell with a "consume" ability. So a unit casts a spell and a add / mob will spawn on a random target in range. After X seconds, the target will get replaced (hence the thread :)) with the spawn.

I am not quite sure how to begin the trigger, with the actions (and condition if necessary) after an ability is cast. Help? :D
 
Level 3
Joined
Aug 12, 2008
Messages
34
It's a instance based map, as it's a boss that casts this ability, it's supposed to be cast (instant) on a enemy unit (in this case, a player [user]). Sorry, I forgot details :)
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
It's a instance based map, as it's a boss that casts this ability, it's supposed to be cast (instant) on a enemy unit (in this case, a player [user]). Sorry, I forgot details :)

Umm...you confused me again. By instant i mean,you don't need to choose target,it automatically applies the effect. However since you say
on an enemy unit
i wouldn't say it's instant...
Oh and should the ability be able to affect heroes too?
 
Level 3
Joined
Aug 12, 2008
Messages
34
Sorry, I am not that good in using right words :)

What I meant was that the boss is summoning a unit (like Feral Spirit, Animate Dead, etc...) and move it instantly to a enemy unit (via triggers). And then, after it's moved and set - I'd like the "consume" effect to take action. :)
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
Umm...
Try using this:
  • Consume
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Consume
    • Actions
      • Set Loc = (Position of (Triggering unit))
      • Set TempGroup = (Units within 600.00 of Loc matching ((Owner of (Matching unit)) Not equal to (Owner of (Triggering unit))))
      • Unit - Replace (Random unit from TempGroup) with a Footman using The old unit's relative life and mana
      • Custom script: call ClearGroup(udg_TempGroup)
      • Custom script: call RemoveLocation(udg_Loc)
And make the Consume ability with several seconds casting time.
 
Level 3
Joined
Aug 12, 2008
Messages
34
  • Custom script: call ClearGroup(udg_TempGroup)
I keep getting an error with this one - says "Expected a function name" (I am very sorry, I am no good with custom scripts / JASS) :)
 
shouldn't it be

  • Custom script: call DestroyGroup(udg_TempGroup)
since the way you do it, you only clear the group assigned to the variable TempGroup but it still stays in the memory as a blank group, so it leaks... you only use clear if you add units to a global group, but your method creates a new group everytime and assigns it to the variable TempGroup, so you need to destroy them after use...
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
shouldn't it be

  • Custom script: call DestroyGroup(udg_TempGroup)
since the way you do it, you only clear the group assigned to the variable TempGroup but it still stays in the memory as a blank group, so it leaks... you only use clear if you add units to a global group, but your method creates a new group everytime and assigns it to the variable TempGroup, so you need to destroy them after use...

Oh..thanks for clearing it up. I mostly use GroupClear because i've experienced that DestroyGroup can cause the trigger to malfunction sometimes since the group gets destroyed. I wasn't really using it appropriately though.
 
Status
Not open for further replies.
Top