HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Detecting when an non-casting ability damages a unit

01-25-2006, 11:36 AM#1
PerfectlyInsane
How to do I detect when a Permanent ability(one on an item that is equpped) damages another unit?


Like a weapon in the game battleships(phoneix fire), or possibly Cloak of flames.

First of all it has no target-unit, no casting (its aways on)

I've tried various detecting when a unit cast an ability.
various detecting when a unit is attacked

<I dont think its an actual order, no is their any casting, or a current order nor is it a buff>


I tried some jass string getting the triggering(Item type) = crash.
01-25-2006, 12:21 PM#2
Jazradel
Pheonix Fire and Cloak of Flames do give a buff.

So you could do a trigger that check if a unit has the buff every 0.1 seconds.
Every 0.1 seconds of game time
Pick Every Unit in Units in Playable Map Area
If Picked Unit has Buff = True
Do Actions..
01-25-2006, 01:52 PM#3
Azazel_
Collapse JASS:
call TriggerRegisterUnitEvent( gg_trg_Your_Trigger, YourUnit, EVENT_UNIT_DAMAGED )

It will detect damage from any source, even life reducing buffs. If you need this for many units,

Collapse JASS:
function CreateUnit2 takes player p, integer UnitId, location l returns nothing
     local unit u = CreateUnit(Player(p),UnitId,GetLocationX(l),GetLocationY(l),0.0)
     call TriggerRegisterUnitEvent( gg_trg_Your_Trigger, u, EVENT_UNIT_DAMAGED )
     set u = null
endfunction

Alternately, if you are dealing with large amounts of units (beyond 500), then you'll need to use dynamic triggers for efficiency.
01-25-2006, 09:30 PM#4
PerfectlyInsane
Quote:
Originally Posted by Jazradel
Pheonix Fire and Cloak of Flames do give a buff.


Yeah I see phoneix fire... But my custom spells dont appear on the list. and its a buff comparions that compares two buffs?

------------------------------


Ok I take alook at the jass code however i never dont jass and have no idea how to use custom jass?. I guess I want to explain more about what I want

Bascially I want a Gun/ammo system without replacing the original unit and without using Gold/lumber. Each item has abilities like phoneix fire will shoot when a unit enters a range provided it is visible to the player. Then 1 charge will be taken from the time. The item will have a second ability. Which when clicked will reload the gun.

When the charges run out another item replaces the original item which only has the reload ability



----------------
Currenly I already got an upgraded gun/ammo system based on the original Jurassic Park Survival.