- Joined
- Apr 23, 2011
- Messages
- 460
This is probably not too useful to anyone, maybe to some beginners or someone who wants an easily configurable system for a map that has tons of destuctables that you want to make invulnerable. I'm new to JASS (sorta) so any corrects please post them and I'll make them. It seems to work fine for me, and I just wanted to put this up for anyone who might need it.
Simple copy and paste with some moderate configuration should do the trick. The coding is annotated with what to modify.
This code can really be used in many situations when you need say 4+ destructable TYPES all invulnerable and you have various instances of these multiple destructables. I just though "maybe someone could use this", so I posted it here.
Simple copy and paste with some moderate configuration should do the trick. The coding is annotated with what to modify.
This code can really be used in many situations when you need say 4+ destructable TYPES all invulnerable and you have various instances of these multiple destructables. I just though "maybe someone could use this", so I posted it here.
JASS:
globals
integer array destType
integer begin = 1 //Keep this unless you start the DestType at 0 or some other number.. Dunno why you would though.
integer end = 2 //Change to the max number of destructable types you are declaring.
rect area = bj_mapInitialPlayableArea //Change to the the Area you want your variables to be selected in.
endglobals
function DeclareDestTypes takes nothing returns nothing
set destType[1] = 'ZTtw' // Change to whatever your first destructable type you want to invul is. (Raw Data)
set destType[2] = 'B001' // Change to whatever your second destructable type you want to invul is.(Raw Data)
//Add more lines here if you have more types to invul.
endfunction
function IsInvul takes nothing returns nothing
loop
exitwhen begin > end
if GetDestructableTypeId(GetEnumDestructable()) == destType[begin] then
call SetDestructableInvulnerable(GetEnumDestructable(), true)
endif
set begin = begin + 1
endloop
endfunction
function GetDestructables takes nothing returns nothing
call EnumDestructablesInRect(area, null, function IsInvul)
endfunction
function InitTrig_InvulDestructables takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0.5, false)
call TriggerAddAction(t, function GetDestructables)
call TriggerAddAction(t, function DeclareDestTypes)
set t = null
endfunction
Last edited: