Stop Team attack Trigger

caniboy

New Member
Reaction score
2
Hi @ all,
i need help in my trigger for my new map "[Hu]mans vs. [Zo]mbies"

Trigger:
  • If A unit attacks a Unit of Team 1
    • Then stop attack


Something like that.
Could maybe help me somebody please?

Greetings,
caniboy
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_No_Allied_Attack_Conditions takes nothing returns boolean
    if IsUnitAlly(GetTriggerUnit(), GetOwningPlayer(GetAttacker())) == true then
        return GetUnitStatePercent(GetTriggerUnit(), UNIT_STATE_LIFE, UNIT_STATE_MAX_LIFE) > 0.00
    endif
    return false
endfunction

function Trig_No_Allied_Attack_Actions takes nothing returns nothing
    call PauseUnit(GetAttacker(),true)
    call IssueImmediateOrder(GetAttacker(), "stop")     
    call PauseUnit(GetAttacker(),false)
endfunction

//===========================================================================
function InitTrig_No_Allied_Attack takes nothing returns nothing
    set gg_trg_No_Allied_Attack = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_No_Allied_Attack, EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(gg_trg_No_Allied_Attack, Condition( function Trig_No_Allied_Attack_Conditions))
    call TriggerAddAction(gg_trg_No_Allied_Attack, function Trig_No_Allied_Attack_Actions)
endfunction


I do not take credit for this. This is Emjlr3's work.
return GetUnitStatePercent(GetTriggerUnit(), UNIT_STATE_LIFE, UNIT_STATE_MAX_LIFE) > 0.00
Edit the bolded area. It enables you to attack allied unit ONLY if its under __ % HP.
 

caniboy

New Member
Reaction score
2
Thanks for your answer.
Sorry i forgot to tell you that i need it in "GUI"?.
I don't know the program language "Jass".

Greetings,
caniboy
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Don't worry, just copy and paste the whole thing into your trigger.

Create a trigger, any name, Press edit, convert to custom text, copy everything in the code and paste that in. Done.
 

caniboy

New Member
Reaction score
2
i try it with "jassnewgenpack5d" and the normal World editor.

Line 404: Undeclared variable gg_trg_No_Allied_Attack

set gg_trg_No_Allied_Attack = CreateTrigger()

Greetings,
caniboy
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Oh my bad, your trigger has to be called No Allied Attack. My bad :eek:
 

Wesulmoon

New Member
Reaction score
6
U can do it in gui also... i made a dummy unit which spawns at the time the unit of the same team is attacked. I give that dummy a sleep ability. dummy unit casts sleep on attacking unit for 0.1 sec so it prevents the order of attack... u can also use hex for making it more funny :D
 

keeper77

New Member
Reaction score
3
Trigger:
  • Team fire off
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Triggering unit) belongs to an ally of (Owner of (Attacking unit))) Equal to True
    • Actions
      • Unit - Order (Attacking unit) to Stop


This is a simple one that gets the job done, but doesn't do any special effects. I hope this is what you're looking for :D.
 

caniboy

New Member
Reaction score
2
Thank you very much <3

€: Where i can find ((Triggering unit) belongs to an ally of (Owner of (Attacking unit))) Equal to True
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Well, for that trigger, its just renaming the name of your trigger to No Allied Attack. As to where you can find that, it is a Boolean condition checking Unit - unit belongs to an ally of a player.
 

caniboy

New Member
Reaction score
2
Trigger:
  • Team fire off
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Owner of (Attacking unit)) is in (All allies of (Owner of (Attacked unit)))) equal to True
    • Actions
      • Unit - Order (Attacking unit) to Stop


That should be work to right?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top