[JASS] help me with JASS

Status
Not open for further replies.
Event - Unit uses Item
Condition - Itemtype of Item being manipulated equal to SUPER_HAXS_ITEM_OK
JASS:
function droppable takes nothing returns nothing
local timer t = GetExpiredTimer()
local item used = GetHandleItem(t,"Item")
call SetItemDroppable(used,true)
call FlushHandleLocals(t)
call DestroyTimer(t)
set = null
set used = null
endfunction


function ACTIONS takes nothing returns nothing
...
local timer t = CreateTimer()
call SetItemDroppable(GetManipulatedItem(),false)
call TimerStart(t,10.00,false, function droppable) //10.00 would be a cooldown of 10 seconds
call SetHandleHandle(t,"Item",GetManipulatedItem())
...
Oh and, I really don't feel to explain Handle Vars again...if you don't know what they are, use TriggerSleepAction(COOLDOWN) >>[/code][/code]
 
"handle" is the mother class of "event", "player", "widget", "force", "group", "trigger", "triggercondition", "triggeraction", "timer", "location", "region", "rect", "boolexpr", "sound", "unitpool", "itempool", "race", "alliancetype", "racepreference", "gamestate", "playerstate", "playergameresult", "unitstate", "aidifficulty", "eventid", "unittype", "gamespeed", "gamedifficulty", "gametype", "mapflag", "mapvisibility", "mapsetting", "mapdensity", "mapcontrol", "playerslotstate", "volumegroup", "camerafield", "camerasetup", "playercolor", "placement", "startlocprio", "raritycontrol", "blendmode", "texmapflags", "effect", "effecttype", "weathereffect", "terraindeformation", "fogstate", "fogmodifier", "dialog", "button", "quest", "questitem", "defeatcondition", "timerdialog", "leaderboard", "multiboard", "multiboarditem", "trackable", "gamecache", "version", "itemtype" and "texttag".

So, I suppose that you know exactly now, what a "handle" is. ^^
 
PurplePoot said:
UnMi - umm... if you like if/thens

(kinda like this)

if A then
A
elseif B then
B

and soooo on............
...
You prefer one Trigger for each Item?
There are most likely not more than 20 items, so.. like
JASS:
local real duration
...
if A then
set duration = 5
elseif B then
set duration = 3
...
endif
call TimerStart(t,duration,false,function OK)
...
Well, if it's more than 20 comparisions, then I would use GameCache.
(Because people keep talking about how slow GameCache is, I myself never noticed any difference, and I use GameCache a lot.)
 
Status
Not open for further replies.
Back
Top