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

Turn ally into enemy {while keeping that enemy an ally of your allies}

Status
Not open for further replies.
Level 4
Joined
Jul 18, 2008
Messages
66
In a one of my missions, you there is an ally town. I want to make the ally NPCs to become hostile to you if you attack them, but the only thing I know so far is that you can only turn the entire team to become hostile towards you. How do I make just the NPC you attacked, hostile, without making him hostile to the the team he was previously on?

Let's say you attack a footman, belonging to team purple, which is your ally. When you attack him, he turns to orange, which is your enemy, but also an enemy to team purple. So how do I make team purple and orange allies, while keeping team read (my team) still allied with team purple but hostile towards orange?

Or is it another, easier solution to my problem?
 
Level 10
Joined
Jul 31, 2008
Messages
477
Something like this i think

Events
Unit - A unit is attacked

Conditions
Owner of attacked unit equal to an ally of owner of attacking unit

Actions
Make Player 6 (orange) treat owner of attacked unit as an ally with shared vision
Unit - Change owner of attacked unit to Player 6 (orange) and change colour

I guess it would work though im not sure i got what you meant
 
Level 4
Joined
Jul 18, 2008
Messages
66
Yeah, I think I kind of rushed the explanation. I will try to explain it a bit more detailed this time.
Let's say that player red is you, player purple is your ally, and orange is your enemy, but an ally of purple. This is what happens:

Player red is in a town, owned by player purple. Player red attacks one of player purple's units. This unit, which was attacked by player red, will, since it was attacked, turn into player orange. Player orange is allied with purple (it is logical that they will only attack the people that attack them, and not suddenly attack their own town, which is purple)

When I say orange, I mean that they will change to player orange, though they will still retain the purple colour. So, basically, I just want player purple to attack player red if red attacks any of player purple's units, but player orange will only attack player red, they will not attack player purple. Getting it?

I probably won't have to change the team of player purple's units who where attacked, into orange though, if there are any easier solutions. I am going to try out what you said a little later. Thanks, I'll be back if it doesn't work. :thumbs_up:

Red attacks purple -> purple unit changes to orange -> orange attacks red -> orange does not attack purple
 
Level 4
Joined
Jul 18, 2008
Messages
66
Oh, so you mean that the single unit should be orange, but not attack purple, has orange normally do?

No, orange isn't supposed to attack purple at all.

While I am at it, I have forgotten about making variables.
I need a variable to store a quest for me, so that when the hero enters a region, the quest will be completed.
But, for some reason, I can't choose the quest I want to store. I have chosen variable type = quest, and named the variable L. When I make an action, it says something like:
  • Set L = (Last created quest)
Do I have to name the variable the same as the quest name? Why can't I choose my quest? Can anyone tell me? :con:
 
Level 4
Joined
Jul 18, 2008
Messages
66
We'll see. Could anyone tell me EXACTLY what to do when creating a variable and store a quest? I've most likely just done something wrong, it's been a long time since I made maps.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
  • Set L = (Last created quest)
Do I have to name the variable the same as the quest name? Why can't I choose my quest? Can anyone tell me?

Nothing's wrong with that, that's how you normally set a variable to a quest. To set the variable, make sure you put that after your quest creating function, such as
  • Quest - Create a Something quest titled YourQuest with the description YourQuestDescription, using icon path YourQuestIcon
  • Set L = (Last created quest)
And there, your variable, L, is now set to your quest.

For the Player Purple to become hostile (turn into Player Orange) to Player Red, you could initially put Player Orange on the same team(force) as Player Purple in Scenario/Forces with Player Red, but make Player Red treat Player Orange as hostile and vice versa through triggers. Here's what I did:

At map initialization, I used these functions:
  • Player - Make Player 1 (Red) treat Player 6 (Orange) as an Enemy
  • Player - Make Player 6 (Orange) treat Player 1 (Red) as an Enemy
This is the trigger to change a Purple unit to become hostile after getting attacked by Player 1 (Red)
  • Turn Hostile
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
      • (Owner of (Attacking unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Change ownership of (Triggering unit) to Player 6 (Orange) and Retain color
Note that Attacked unit is the same as Triggering unit
 
Status
Not open for further replies.
Top