Chaosy
Tutorial Reviewer
- Joined
- Jun 9, 2011
- Messages
- 13,219
A while ago I tried to create my own unit indexer and it -worked- more or less. However it had a really bad de-index system which prevented me from uploading it at all. So this is a new attempt, it's really nice because I don't have to do the dirty job. vJASS is kind enough to do it for me. I am -abusing- structs.
opinions? it's possible that this is extremely stupid but I am unaware of it somehow.
JASS:
globals
x array ids
endglobals
struct x
public static method create takes unit u returns x
local x this = x.allocate()
call BJDebugMsg(I2S(this))
call SetUnitUserData( u, this )
set ids[this] = this
return this
endmethod
public method destroy takes nothing returns nothing
call this.deallocate()
endmethod
endstruct
-
Untitled Trigger 002
-
Events
- Unit - A unit enters (Playable map area)
- Conditions
-
Actions
- Custom script: local x b = x.create(GetTriggerUnit())
-
Events
-
Untitled Trigger 004
-
Events
- Unit - A unit Dies
- Unit - A unit leaves (Playable map area)
- Conditions
-
Actions
- Set i = (Custom value of (Triggering unit))
- Custom script: call ids[udg_i].destroy()
-
Events
opinions? it's possible that this is extremely stupid but I am unaware of it somehow.