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

Change "Targeted As" Via Triggers?

Status
Not open for further replies.
Level 6
Joined
Dec 9, 2014
Messages
176
So I have several units with their "Targeted As" setting to nothing. This had the desirable effect of them being not attackable, but still selectable and without them having the "Invulnerable" stat that just plain makes it ugly. The only problem is that later in game, after making a specific set of choices, they become hostile, I'd like them to become attackable at that point. I was hoping this could be done with triggers but I can't seem to find it anywhere. Here's the trigger I have so far, just in case you're curious:

  • Fight Tybalt
    • Events
      • Dialog - A dialog button is clicked for TybaltResponseWindow2
    • Conditions
      • (Clicked dialog button) Equal to TybaltResponseButton2[1]
    • Actions
      • Game - Display to Player Group - Player 1 (Red) the text: |cffff0000"Wrong an...
      • Unit - Change ownership of Captain Tybalt 0005 <gen> to Player 10 (Light Blue) and Retain color
      • Sound - Play FootmanYesAttack3 <gen> at 100.00% volume, attached to Captain Tybalt 0005 <gen>
 
Level 21
Joined
Aug 13, 2011
Messages
739
Nice idea turning NPCs hostile based on a bad choice :psmile:

Anyway, you can replace the unit with a copied version of it (pre-made in the object editor) with only its targeted type changed. Using the old unit's relative life and mana preserves whatever the previous unit had. After replacing the unit, refer to that unit as "Last Replaced Unit".

  • Unit - Replace OldUnit with a (Unit-type of NewUnit) using The old unit's relative life and mana
 
Level 6
Joined
Dec 9, 2014
Messages
176
I see, Thanks! Yeah, I have a whole dialog system I'm working on. This is one of the choices that can make them turn on you (for obvious reasons, the message basically threatens Tybalt's life lol).
 
Level 6
Joined
Dec 9, 2014
Messages
176
Yay! It looks like a mess but it works! This makes the whole camp turn on you when you make these dialog choices.

  • Fight Tybalts Camp
    • Events
      • Dialog - A dialog button is clicked for TybaltResponseWindow2
    • Conditions
      • (Clicked dialog button) Equal to TybaltResponseButton2[1]
    • Actions
      • Game - Display to Player Group - Player 1 (Red) the text: |cffff0000"Wrong an...
      • Unit - Replace Captain Tybalt 0005 <gen> with a Captain Tybalt (Targetable) using The old unit's relative life and mana
      • Set TybaltHostile = (Last replaced unit)
      • Unit - Change ownership of TybaltHostile to Player 10 (Light Blue) and Retain color
      • Sound - Play FootmanYesAttack3 <gen> at 100.00% volume, attached to TybaltHostile
      • Unit - Replace Brom 0006 <gen> with a Brom (Targetable) using The old unit's relative life and mana
      • Set BromHostile = (Last replaced unit)
      • Unit - Change ownership of BromHostile to Player 10 (Light Blue) and Retain color
      • Set ApprenticesHostile = Apprentice Mage
      • Unit Group - Pick every unit in (Units owned by Neutral Passive of type ApprenticesHostile) and do (Actions)
        • Loop - Actions
          • Unit - Replace (Picked unit) with a Apprentice Mage (Targetable) using The old unit's relative life and mana
          • Set ApprenticesHostile = (Unit-type of (Last replaced unit))
 
Level 25
Joined
May 11, 2007
Messages
4,651
Nice.

If you want a different way:
Just change the alliances of the players when you hit the wrong dialogue button :p

Player - Set alliance (Triggering Player hate Player2)
Player - Set alliance ( Player2 hate Triggering Player)

And you could have a trigger that checks if a unit is attacked like
"A unit is attacked"
"condition: owner of attacking unit is an ally of attacked unit == true"
"event - unit - order attacking unit to stop"
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
You could also use a transform ability with reversed stats...
I cant find the original thread atm but tickles or lorddz would know of it.

The unit will be the same unit instead of a new unit via replace.
All references to that unit will be kept.
 
Status
Not open for further replies.
Top