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

Changing a player to enemy if attacked

Status
Not open for further replies.
Level 4
Joined
Apr 15, 2008
Messages
82
I want to make it so when you attack another player, it unallies them and displays a text mesage. Is there any way to check for an alliance, or does it require me to do something else.
 
Level 3
Joined
Jul 9, 2006
Messages
23
You would have to use several variables but its easily doable.
Like have at the beginning everyone allied.
Unit is attacked, display text player (attacker) is unallied from player (attacked)
and then make them hostile towards eachother.
 
Level 4
Joined
Apr 15, 2008
Messages
82
Thank you, I am decent with variables, just wondering if there was an easier way. Reputation.
A value of 1 = Allied.
A value of 2 = Unallied.
Players 11 and 12 are computer controlled.
  • Actions
    • Set RedsAllies[2] = 1
    • Set RedsAllies[3] = 1
    • Set RedsAllies[4] = 1
    • Set RedsAllies[5] = 1
    • Set RedsAllies[6] = 1
    • Set RedsAllies[7] = 1
    • Set RedsAllies[8] = 1
    • Set RedsAllies[9] = 1
    • Set RedsAllies[10] = 1
    • Set RedsAllies[11] = 1
    • Set RedsAllies[12] = 2
    • Set BluesAllies[1] = 1
    • Set BluesAllies[3] = 1
    • Set BluesAllies[4] = 1
    • Set BluesAllies[5] = 1
    • Set BluesAllies[6] = 1
    • Set BluesAllies[7] = 1
    • Set BluesAllies[8] = 1
    • Set BluesAllies[9] = 1
    • Set BluesAllies[10] = 1
    • Set BluesAllies[11] = 1
    • Set BluesAllies[12] = 2
    • Set TealsAllies[1] = 1
    • Set TealsAllies[2] = 1
    • Set TealsAllies[4] = 1
    • Set TealsAllies[5] = 1
    • Set TealsAllies[6] = 1
    • Set TealsAllies[7] = 1
    • Set TealsAllies[8] = 1
    • Set TealsAllies[9] = 1
    • Set TealsAllies[10] = 1
    • Set TealsAllies[11] = 1
    • Set TealsAllies[12] = 2
    • Set PurplesAllies[1] = 1
    • Set PurplesAllies[2] = 1
    • Set PurplesAllies[3] = 1
    • Set PurplesAllies[5] = 1
    • Set PurplesAllies[6] = 1
    • Set PurplesAllies[7] = 1
    • Set PurplesAllies[8] = 1
    • Set PurplesAllies[9] = 1
    • Set PurplesAllies[10] = 1
    • Set PurplesAllies[11] = 1
    • Set PurplesAllies[12] = 2
    • Set YellowsAllies[1] = 1
    • Set YellowsAllies[2] = 1
    • Set YellowsAllies[3] = 1
    • Set YellowsAllies[4] = 1
    • Set YellowsAllies[6] = 1
    • Set YellowsAllies[7] = 1
    • Set YellowsAllies[8] = 1
    • Set YellowsAllies[9] = 1
    • Set YellowsAllies[10] = 1
    • Set YellowsAllies[11] = 1
    • Set YellowsAllies[12] = 2
    • Set OrangesAllies[1] = 1
    • Set OrangesAllies[2] = 1
    • Set OrangesAllies[3] = 1
    • Set OrangesAllies[4] = 1
    • Set OrangesAllies[5] = 1
    • Set OrangesAllies[7] = 1
    • Set OrangesAllies[8] = 1
    • Set OrangesAllies[9] = 1
    • Set OrangesAllies[10] = 1
    • Set OrangesAllies[11] = 1
    • Set OrangesAllies[12] = 2
    • Set GreenAllies[1] = 1
    • Set GreenAllies[2] = 1
    • Set GreenAllies[3] = 1
    • Set GreenAllies[4] = 1
    • Set GreenAllies[5] = 1
    • Set GreenAllies[6] = 1
    • Set GreenAllies[8] = 1
    • Set GreenAllies[9] = 1
    • Set GreenAllies[10] = 1
    • Set GreenAllies[11] = 1
    • Set GreenAllies[12] = 2
    • Set PinkAllies[1] = 1
    • Set PinkAllies[2] = 1
    • Set PinkAllies[3] = 1
    • Set PinkAllies[4] = 1
    • Set PinkAllies[5] = 1
    • Set PinkAllies[6] = 1
    • Set PinkAllies[7] = 1
    • Set PinkAllies[9] = 1
    • Set PinkAllies[10] = 1
    • Set PinkAllies[11] = 1
    • Set PinkAllies[12] = 2
    • Set GrayAllies[1] = 1
    • Set GrayAllies[2] = 1
    • Set GrayAllies[3] = 1
    • Set GrayAllies[4] = 1
    • Set GrayAllies[5] = 1
    • Set GrayAllies[6] = 1
    • Set GrayAllies[7] = 1
    • Set GrayAllies[8] = 1
    • Set GrayAllies[10] = 1
    • Set GrayAllies[11] = 1
    • Set GrayAllies[12] = 2
    • Set LightBlueAllies[1] = 1
    • Set LightBlueAllies[2] = 1
    • Set LightBlueAllies[3] = 1
    • Set LightBlueAllies[4] = 1
    • Set LightBlueAllies[5] = 1
    • Set LightBlueAllies[6] = 1
    • Set LightBlueAllies[7] = 1
    • Set LightBlueAllies[8] = 1
    • Set LightBlueAllies[9] = 1
    • Set LightBlueAllies[11] = 1
    • Set LightBlueAllies[12] = 2
I have a faint feeling this could have been done in JASS with in minutes...
 
Last edited:
  • Actions -
    • set Loop = 1
    • For each integer From 1 to 12
      • set Red Ally(Loop) = 1
      • if/then/else
        • if Conditions
          • Loop != 12
        • then Actions
          • set Red Ally(Loop) = 1
        • else
          • set Red Ally(Loop) = 2
    • set Loop = 1
    • For each integer From 1 to 12
      • set Blue Ally(Loop) = 1
      • if/then/else
        • if Conditions
          • Loop != 12
        • then Actions
          • set Blue Ally(Loop) = 1
        • else
          • set Blue Ally(Loop) = 2
  • ect...
 
Easy(er) Way!

  • Begin
  • Events
    • Map Initilization
  • Conditions
  • Actions
    • Player Group - pick every player in player group (all Players) and do actions
      • If\Then\Else
        • Conditions
          • [Player Number(Picked Player)] != 12
        • Actions
          • SetRedAlly[Player Number(Picked Player)] = 2
          • SetBlueAlly[Player Number(Picked Player)] = 2
          • SetTealAlly[Player Number(Picked Player)] = 2
          • ect...
        • Else Actions
          • SetRedAlly[Player Number(Picked Player)] = 1
          • SetBlueAlly[Player Number(Picked Player)] = 1
          • SetTealAlly[Player Number(Picked Player)] = 1
          • ect...
 
Why not do something like this?:

Events:
-------
Unit - A unit is attacked

Conditions:
----------

Actions:
--------
Player - Make (owner of (attacking unit)) treat (owner of (attacked unit)) as an Enemy
Player - Make (owner of (attacked unit)) treat (owner of (attacking unit)) as an Enemy
Game - Display to (All players matching ((Picked Player) equal to (owner of attacking unit)))the text: <Whatever you want it to say>
 
Status
Not open for further replies.
Top