Komaqtion
You can change this now in User CP.
- Reaction score
- 469
Hi!
Ok, I don't really know why but I'm having a really hard time learning both of there
I'm now, just because I saw the thread which needed this, trying to make the events which will detect when a unit comes within X range of an item, or when an item comes within X range of unit (I have these two because you might want to use a specific unit or item...)
Ok, so I haven't gotten very far, but I'm just wondering if I've done anything correct so far... :S
Ok, so right now I just have ( I hope :S) so that when you register the event you'll add the unit ( This example is for "TriggerRegisterItemInUnitRange" ) to a group which will keep track of which units are registered...
Then, the periodic timer will pick each unit in that group each PERIOD ( Isn't doing it now, but I hope to make it XD ) and check if they have an item near it ( I also need to store the range in their own struct, right... ? ) and if they have, fire their triggers
Is this (Basically) what I have now ? :S
Ok, I don't really know why but I'm having a really hard time learning both of there
I'm now, just because I saw the thread which needed this, trying to make the events which will detect when a unit comes within X range of an item, or when an item comes within X range of unit (I have these two because you might want to use a specific unit or item...)
Ok, so I haven't gotten very far, but I'm just wondering if I've done anything correct so far... :S
JASS:
library IIROU requires Event, AIDS
globals
private constant real PERIOD = 0.5
endglobals
globals
private constant integer ITEM_EVENT_ITEM_COMES_IN_RANGE = 1
private constant integer ITEM_EVENT_UNIT_COMES_IN_RANGE = 2
endglobals
globals
private group g = CreateGroup()
private group enum = CreateGroup()
private Event e
endglobals
struct ItemEvents
//! runtextmacro AIDS()
integer event
unit u
item i
private static method Enum_Actions takes nothing returns nothing
endmethod
private static method FireEvents takes nothing returns nothing
call ForGroup( g, function thistype.Enum_Actions )
endmethod
private static method AIDS_onInit takes nothing returns nothing
set e = Event.create()
call TimerStart( CreateTimer(), PERIOD, true, function thistype.FireEvents )
endmethod
static method TriggerRegisterUnitInItemRange takes trigger whichTrigger, integer whichEvent, item whichItem, boolexpr filter returns thistype
local thistype this = thistype.allocate()
call e.register( whichTrigger )
set this.event = whichEvent
return this
endmethod
static method TriggerRegisterItemInUnitRange takes trigger whichTrigger, integer whichEvent, unit whichUnit, boolexpr filter returns thistype
local thistype this = thistype.allocate()
call e.register( whichTrigger )
call GroupAddUnit( g, whichUnit )
set this.event = whichEvent
return this
endmethod
endstruct
/*function TriggerRegisterItemInUnitRange takes trigger whichTrigger, integer whichEvent, unit whichUnit, boolexpr filter returns nothing
call e.register( whichTrigger )
call GroupAddUnit( g, whichUnit )
set ItemEvents( GetUnitId( whichUnit ) ).event = whichEvent
endfunction*/
endlibrary
Ok, so right now I just have ( I hope :S) so that when you register the event you'll add the unit ( This example is for "TriggerRegisterItemInUnitRange" ) to a group which will keep track of which units are registered...
Then, the periodic timer will pick each unit in that group each PERIOD ( Isn't doing it now, but I hope to make it XD ) and check if they have an item near it ( I also need to store the range in their own struct, right... ? ) and if they have, fire their triggers
Is this (Basically) what I have now ? :S