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

Hero with ability replace

Status
Not open for further replies.
Level 7
Joined
May 21, 2009
Messages
289
This is my trigger- Im trying to make it so when a hero lvl 1 enters the region, they are replaced with a unit and that unit get an ability based on the entering unit.

EDIT:
lol forgot to list the problem- It doesnt work^ what I listed above, instead it replaces the unit and doesnt add the ability?
someone help?

  • Charmer
    • Events
      • Unit - A unit enters Choose Imperial Warrior <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Hero level of (Triggering unit)) Equal to 1
    • Actions
      • Unit - Replace (Entering unit) with a Charmer using The new unit's max life and mana
      • Unit - Move (Last replaced unit) instantly to (Center of Palace Exit Outside <gen>)
      • Camera - Apply White Gold Outside <gen> for (Owner of (Last replaced unit)) over 0.00 seconds
      • Wait 0.01 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Argonian
        • Then - Actions
          • Unit - Add Argonian Evasion to (Last replaced unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to High Elf
            • Then - Actions
              • Unit - Add Focus to (Last replaced unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Triggering unit)) Equal to Imperial
                • Then - Actions
                  • Unit - Add Merchant of Skill to (Last replaced unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Triggering unit)) Equal to Khajiit
                    • Then - Actions
                      • Unit - Add Eyesight to (Last replaced unit)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Triggering unit)) Equal to Nord
                        • Then - Actions
                          • Unit - Add Nord Magic Resistance to (Last replaced unit)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of (Triggering unit)) Equal to Orc
                            • Then - Actions
                              • Unit - Add Orcish Strength to (Last replaced unit)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Unit-type of (Triggering unit)) Equal to Redguard
                                • Then - Actions
                                  • Unit - Add Fitness to (Last replaced unit)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Unit-type of (Triggering unit)) Equal to Wood Elf
                                    • Then - Actions
                                      • Unit - Add Call apon the Wolf to (Last replaced unit)
                                    • Else - Actions
 
Level 7
Joined
May 21, 2009
Messages
289
No, maybe I wasnt clear enough-
When a hero enters this region, it is replaced with the charmer, and then moved instantly. Then depending on which hero entered the region (example: Argonian, High Elf, Imperial, ect...) it should give it the ability under the "Then-" Action Loop.

And no CloudWolf it wouldnt because the triggering unit isnt the replaced one; well it is kinda but it is supposed to represent the unit that has replaced the last one (or what I'm trying to give)
 
Level 5
Joined
May 3, 2009
Messages
129
  • test
    • Events
      • Unit - A unit enters Choose Imperial Warrior <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Argonian
        • Then - Actions
          • Unit - Replace (Triggering unit) with a Charmer using The new unit's max life and mana
          • Unit - Add Argonian Evasion to (Last replaced unit)
          • Unit - Move (Last replaced unit) instantly to (Center of Palace Exit Outside <gen>)
        • Else - Actions
This works how you want it to

or this works too like i said
  • Melee Initialization
    • Events
      • Unit - A unit enters Choose Imperial Warrior <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Not equal to Chamer
      • ((Unit-type of (Triggering unit)) is A Hero) Equal to True
      • (Hero level of (Triggering unit)) Equal to 1
    • Actions
      • Unit - Replace (Triggering unit) with a Chamer using The new unit's max life and mana
      • Unit - Move (Last replaced unit) instantly to (Center of Palace Exit Outside <gen>)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Argonian
        • Then - Actions
          • Unit - Add Argonian Evasion to (Last replaced unit)
        • Else - Actions
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I tested with a trigger like this:

  • Untitled Trigger 108
    • Events
      • Unit - A unit enters Region 004 <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Hero level of (Triggering unit)) Equal to 1
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Replace (Entering unit) with a Mountain King using The old unit's relative life and mana
      • Unit - Move (Last replaced unit) instantly to (Center of Region 005 <gen>)
      • Camera - Apply Camera 001 <gen> for (Owner of (Last replaced unit)) over 0.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Paladin
        • Then - Actions
          • Unit - Add Banish to (Last replaced unit)
        • Else - Actions
And it worked...this basically the same you and PvSvN have.
 
Level 7
Joined
May 21, 2009
Messages
289
I don't know then people, it doesnt, I repeat, This doesnt work for me-
I don't know why it doesnt work for me, and yes its basicly the same thing.

  • Charmer
    • Events
      • Unit - A unit enters Choose Imperial Warrior <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Hero level of (Triggering unit)) Equal to 1
    • Actions
      • Unit - Replace (Entering unit) with a Charmer using The new unit's max life and mana
      • Unit - Move (Last replaced unit) instantly to (Center of Palace Exit Outside <gen>)
      • Camera - Apply White Gold Outside <gen> for (Owner of (Last replaced unit)) over 0.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Argonian
        • Then - Actions
          • Unit - Add Argonian Evasion to (Last replaced unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to High Elf
        • Then - Actions
          • Unit - Add Focus to (Last replaced unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Imperial
        • Then - Actions
          • Unit - Add Merchant of Skill to (Last replaced unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Khajiit
        • Then - Actions
          • Unit - Add Eyesight to (Last replaced unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Nord
        • Then - Actions
          • Unit - Add Nord Magic Resistance to (Last replaced unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Orc
        • Then - Actions
          • Unit - Add Orcish Strength to (Last replaced unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Redguard
        • Then - Actions
          • Unit - Add Fitness to (Last replaced unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Wood Elf
        • Then - Actions
          • Unit - Add Call apon the Wolf to (Last replaced unit)
        • Else - Actions
EDIT:
How would I create a variable for the new replaced unit?
 
Level 14
Joined
Aug 31, 2009
Messages
775
*sigh*

I'm amazed how some people haven't noticed the problem here.

When you replace the unit, the unit is now "lost" and the game -CANNOT- tell what that unit was / is - because it's GONE.

No method of "entering unit" or "triggering unit" or anything like that will work.

Instead, use a Variable method as described by idodik.
  • Set UnitType = (Unit Type of (Triggering Unit))
Then use all your If/Then/Elses using that variable, and not a temporary unit reference such as triggering unit.

EDIT: doom_sheep and Maker seem to know how to solve this also. Listen to their solutions.
 
Level 12
Joined
Aug 22, 2008
Messages
911
EDIT:
How would I create a variable for the new replaced unit?
Variable for the old replaced unit-type:
Step #1:Go to the variable menu (the big green X at the top of the trigger editor).
Step #2: Create a variable of type Unit-type, call it as you wish (we'll use for example the name CharmerType).
Step #3: Before you replace the unit insert the following action:
  • Set CharmerType = (Unit-type of (Triggering Unit))
Step #4:
Instead of the following condition
  • ((Unit-type of (Triggering Unit)) equal to WTF)
Use this:
  • (CharmerType equal to WTF)
Variable for the new replaced unit:
Make the action after the replacement of the unit and change it to:
  • Set CharmerType = (Unit-type of (Last Replaced Unit))
 
Level 5
Joined
May 3, 2009
Messages
129
i've uploaded my test map cos you keep doing the same thing over and over like i said before all you need to do it add the condtion in the right place
  • (Unit-type of (Triggering unit)) Not equal to Chamer
just open and test it then move the hero to the right and it all works how you want it to

damage you are wrong about it not knowing what hero type after its been replaced just test my map then you will see its wrong
 

Attachments

  • test.w3x
    16.7 KB · Views: 40
Level 37
Joined
Mar 6, 2006
Messages
9,240
*sigh*

I'm amazed how some people haven't noticed the problem here.

When you replace the unit, the unit is now "lost" and the game -CANNOT- tell what that unit was / is - because it's GONE.

No method of "entering unit" or "triggering unit" or anything like that will work.

That's not completely true. I first though of that, but decided to test it.

  • Untitled Trigger 109
    • Events
      • Unit - A unit enters Region 004 <gen>
    • Conditions
    • Actions
      • Unit - Remove (Triggering unit) from the game
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Player 1 (Red) at (Center of Region 005 <gen>) facing Default building facing degrees
^That actually works, even though the triggering unit is removed. However if you add wait between remove and create, it won't work anymore.
 
Level 7
Joined
May 21, 2009
Messages
289
Variable for the old replaced unit-type:
Step #1:Go to the variable menu (the big green X at the top of the trigger editor).
Step #2: Create a variable of type Unit-type, call it as you wish (we'll use for example the name CharmerType).
Step #3: Before you replace the unit insert the following action:

Set CharmerType = (Unit-type of (Triggering Unit))

Step #4:
Instead of the following condition

((Unit-type of (Triggering Unit)) equal to WTF)

Use this:

(CharmerType equal to WTF)


Variable for the new replaced unit:
Make the action after the replacement of the unit and change it to:

Set CharmerType = (Unit-type of (Last Replaced Unit))


I know how to create a variable, I'm just un-sure as to what to set it as. I need the variable to be the "NEW" unit that replaces the old one, but I dont know if "Last Replaced Unit" will work because it sounds as if it is refering to the "OLD" unit, So your saying that the "Variable for new replaced unit" will do this? I'm not at home today for Thanksgiving, but I will be tomorrow.
 
Level 12
Joined
Aug 22, 2008
Messages
911
I know how to create a variable, I'm just un-sure as to what to set it as. I need the variable to be the "NEW" unit that replaces the old one, but I dont know if "Last Replaced Unit" will work because it sounds as if it is refering to the "OLD" unit, So your saying that the "Variable for new replaced unit" will do this? I'm not at home today for Thanksgiving, but I will be tomorrow.

"Last Replaced Unit" is what you're looking for.
You can read its description if you don't trust me.
 
Status
Not open for further replies.
Top