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

Creep Aggression System

Status
Not open for further replies.
Level 2
Joined
Apr 30, 2009
Messages
8
I'm curious on how to make it so that when you attack a creep, it'll turn aggressive, then after some time, while not being attacked, turn back to a passive unit.

Example:
You attack Enemy A.
Enemy A goes from Neutral Passive to Neutral Hostile.
You run away.
After 5 seconds of not being attacked, Enemy A turns back to Neutral Passive.

Currently, I've got something that makes it so when a unit's attacked, it turns to its aggressive state, but not something so that after a set time, it reverts back.

Thanks if you can help me.
 
Level 2
Joined
Apr 30, 2009
Messages
8
Yeah, there's going to be lots of creeps. They're supposed to be wandering about, so they you could encounter more than one at once. My main issue is that I can't find anything so that I could use something like,"Unit is not attacked" or "Unit is still not attacked", or something along those lines.
 
Level 6
Joined
Oct 4, 2008
Messages
263
JASS:
function Trig_blahblahblah takes nothing returns nothing
    call SetUnitOwner( GetTriggerUnit(), Player(PLAYER_NEUTRAL_AGGRESSIVE), true )
    call TriggerSleepAction(5.00)
    call SetUnitOwner(GetTriggerUnit(), Player((PLAYER_NEUTRAL_PASSIVE), true)
endfunction

//===========================================================================
function InitTrig_blahblahblah takes nothing returns nothing
    set gg_trg_blahblahblah = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_blahblahblah, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddAction( gg_trg_blahblahblah, function Trig_blahblahblah )
endfunction
make a trigger, call it blahblahblah, convert to custom text, delete verything, and convert that into it.
 
Level 11
Joined
Feb 14, 2009
Messages
884
Change your units' acquisition range to 0. Then, it will not attack until provoked. Neutrals return to their camp automatically if they move 500 range from it, so if you need them to stop, you'll just have to run :)
 
Status
Not open for further replies.
Top