• 🏆 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!

Weapon change system

Status
Not open for further replies.
Level 7
Joined
Feb 18, 2007
Messages
216
So, I have a weapon change system on my map. When you use an item (the weapon), the hero who used it will be replaced with different unit, who's armed with the new weapon. This is part of the system I'm currently using:

  • Events
    • Unit - A unit Uses an item
  • Actions
    • If ((Unit-type of (Triggering unit)) Equal to Vault Dweller (Assault Rifle)) then do (Set ammoAssaultRifle = (Mana of (Triggering unit))) else do (Do nothing) (THIS IS OFC COPIED FOR EVERY POSSIBLE WEAPON)
    • Set exp = (Hero experience of marine)
    • Set levelMedic = (Level of Medic for marine)
    • Set levelExpMaster = (Level of Explosion Mastery for marine)
    • Set hitpoints = (Life of marine)
    • For each (Integer A) from 1 to 6, do (Actions)
      • Loop - Actions
        • Set items[(Integer A)] = (Item carried by (Hero manipulating item) in slot (Integer A))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions) (AND SO IS THIS)
      • If - Conditions
        • (Item-type of (Item being manipulated)) Equal to Laser Rifle
      • Then - Actions
        • For each (Integer A) from 1 to 6, do (Actions)
          • Loop - Actions
            • Hero - Drop the item from slot (Integer A) of (Hero manipulating item)
        • Unit - Replace (Hero manipulating item) with a Vault Dweller (Laser Rifle) using The old unit's life and mana
        • For each (Integer A) from 1 to 6, do (Actions)
          • Loop - Actions
            • Hero - Give items[(Integer A)] to (Last replaced unit)
        • Selection - Select (Last replaced unit) for Player 1 (Red)
        • Unit - Set mana of (Last replaced unit) to ammoLaser
        • Set marine = (Last replaced unit)
      • Else - Actions
      • Hero - Set marine experience to exp, Hide level-up graphics
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • levelMedic Greater than or equal to 1
        • Then - Actions
          • Hero - Learn skill for marine: Medic
          • Unit - Set level of Medic for marine to levelMedic
          • Hero - Modify unspent skill points of marine: Subtract ((Level of Medic for marine) - 1) points
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • levelExpMaster Greater than or equal to 1
        • Then - Actions
          • Hero - Learn skill for marine: Explosion Mastery
          • Unit - Set level of Medic for marine to levelExpMaster
          • Hero - Modify unspent skill points of marine: Subtract ((Level of Explosion Mastery for marine) - 1) points
        • Else - Actions
      • Unit - Set life of marine to hitpoints
So the end result is fucking long trigger mostly made with copy&paste. Problems are that the hero skill levels aren't moved as they should and buffs (ofc) wont remain. Is there any way to replace the unit so that every data of it would be moved properly and buffs would remain? Like metamorphosis spell but it would remain until another weapon is selected. I've heard that ability "chaos" can be used for purposes like this, but I just have no idea how to use it.

So could anyone help me with this problem?
 
Level 7
Joined
Jun 8, 2010
Messages
283
Level 7
Joined
Feb 18, 2007
Messages
216
Just make a unit with no weapon and then add certain weapon model to his hands. When he changes weapon, just remove first model and add new.
The thing is that the unit with new weapon has different data than the original unit. (eg movement speed, maximum mana, abilities)

Thanks Atmosferic, I'll check if I can adapt that to my map. And yes, the weapon items have "penguin squeek" ability:D
 
Status
Not open for further replies.
Top