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

[Solved] unit attacks event

Status
Not open for further replies.
Level 14
Joined
Jul 1, 2008
Messages
1,314
Hey guys,

I got a trigger, that should detect a unit attacking another unit, but It does not fire, when the unit was ordered by
JASS:
call IssueTargetOrder( u, "attack", target)

it does fire normally, when ordered manually though. I do not get it at the moment, why it does not recognize the triggered order as an attack event (neither debug message 1 nor 2 fire)...

Can someone point me towards it? I do not want to use a DDS in this case ...



JASS:
function Trig_FinishHimChainSawEffects_Conditions takes nothing returns boolean
  call BJDebugMsg("1")
  return GetUnitTypeId( GetAttacker()) == GM_ID_UNIT_BOX_FINISH_CHAINSAW
endfunction

function Trig_FinishHimChainSawEffects_Actions takes nothing returns nothing
  // enhance chainsaw effects by sfx
  local unit u = GetTriggerUnit()// attacked unit
  local real x = GetUnitX( u)
  local real y = GetUnitY( u)
  call BJDebugMsg("2")
  call TriggerSleepAction( 0.7)
  set GM_BOX_DATA_INT[(0*50)+11] = 1
  call DELAYED_SFX_DESTRUCTION( AddSpecialEffect( "Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl", x, y), 2.4)
  call DELAYED_SFX_DESTRUCTION( AddSpecialEffect( "Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl", x, y), 0.9)
  set GM_BOX_I = GetUnitTypeId( u)
  if (GM_BOX_I == GM_ID_UNIT_BOX_CROWD_MAN or GM_BOX_I == GM_ID_UNIT_BOX_CROWD_WOMAN or GM_BOX_I == GM_ID_UNIT_BOX_CROWD_CHILD) then
  call KillUnit( u)
  call DELAYED_UNIT_DESTRUCTION( u, 5.)
  endif
 
  set u = null
endfunction

//===========================================================================
function InitTrig_FinishHimChainSawAttack takes nothing returns nothing
  set gg_trg_FinishHimChainSawAttack = CreateTrigger()
  call TriggerRegisterPlayerUnitEvent( gg_trg_FinishHimChainSawAttack, Player(4), EVENT_PLAYER_UNIT_ATTACKED, null)
  call TriggerAddCondition( gg_trg_FinishHimChainSawAttack, Condition( function Trig_FinishHimChainSawEffects_Conditions ) )
  call TriggerAddAction( gg_trg_FinishHimChainSawAttack, function Trig_FinishHimChainSawEffects_Actions )
endfunction


Edit: I tested it in another case, and the game recognized the attacking event. So I am clearly doing something wrong, but what is it?


lol sry I just found out ...
the thing works, and the error was somewhere veeery far away.
sry this is solved ..
 
Last edited:
Status
Not open for further replies.
Top