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
 
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.
 
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
 
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.
 
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
 
Oh my bad, your trigger has to be called No Allied Attack. My bad :eek:
 
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
 
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.
 
Thank you very much <3

€: Where i can find ((Triggering unit) belongs to an ally of (Owner of (Attacking unit))) Equal to True
 
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.
 
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 The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      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