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

units attack automatically. what event?

Status
Not open for further replies.
Level 2
Joined
Oct 17, 2009
Messages
7
hey guys,

imagine: u have a unit and a building. the unit is owned by players red and the building is neutral aggressive.
so if the unit stands next to the building it attacks the building.

how can i ask for that event?
looks like "EVENT_PLAYER_UNIT_ATTACKED" doesnt work for that. or maybe my script just doesnt work....

i have to say that i want the script JUST to trigger when the attacking units id = npn2 , but you can see that in the script^^

here's the script:

JASS:
function Trig_AdminAttack_Conditions takes nothing returns boolean
	return(not(IsUnitAlly(GetTriggerUnit(),GetOwningPlayer(GetAttacker()))))
endfunction

function Trig_AdminAttack_Actions takes nothing returns nothing

	if (GetUnitTypeId(GetAttacker())=='npn2') then
		call DisplayTimedTextToForce(GetPlayersAll(),30,"blablabla")
	endif

endfunction

...


	call TriggerRegisterAnyUnitEventBJ(udg_trigger99,EVENT_PLAYER_UNIT_ATTACKED)
	call TriggerAddCondition(udg_trigger99,Condition(function Trig_AdminAttack_Conditions))
	call TriggerAddAction(udg_trigger99,function Trig_AdminAttack_Actions)

...

	set udg_trigger99=CreateTrigger()

i think this should work, but it doesnt...
everyone who helps me gets +rep =)
 
Status
Not open for further replies.
Top