- Joined
- Aug 20, 2004
- Messages
- 65
I used to love tinkering with other people's JASS scripts (public ones only) without ever learning the basics. I stopped map making over a year ago and completely forget everything now.
But it always bothered me I have almost 100 custom heroes in an AoS map that was never completed and today I opened it up for the first time in years. The last time I tested it, it was working fine, but now when I try to save it I get over 4800 errors saying things like "expected a unit" or "expected an endif"
Here's the custom script I have in the map
Some questions:
1) What could have happened to cause a (basically) fully functioning map to go haywire like this? Was the editor patched in any way that would cause this?
2) What do these custom scripts do? The tree regrowth is self explanatory, but I can't remember why I put in the other two.
3) Can I fix it?
4) What other information do I need to provide in order to get a better answer?
But it always bothered me I have almost 100 custom heroes in an AoS map that was never completed and today I opened it up for the first time in years. The last time I tested it, it was working fine, but now when I try to save it I get over 4800 errors saying things like "expected a unit" or "expected an endif"
Here's the custom script I have in the map
Code:
// ===========================Damage Enemies System
function FilterIsEnemy takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), bj_groupEnumOwningPlayer)
endfunction
function DamageEnemiesArea takes unit whichUnit, real radius, real x, real y, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType returns nothing
local group g = CreateGroup()
local boolexpr b = Condition(function FilterIsEnemy)
local unit t
set bj_groupEnumOwningPlayer = GetOwningPlayer(whichUnit)
call GroupEnumUnitsInRange(g, x, y, radius, b)
call DestroyBoolExpr(b)
loop
set t = FirstOfGroup(g)
exitwhen t == null
call GroupRemoveUnit(g,t)
call UnitDamageTarget(whichUnit,t,amount,attack, ranged,attackType,damageType,weaponType)
endloop
call DestroyGroup(g)
set g = null
set b = null
endfunction
// ===========================
// ===========================Local Handle Vars By: Kattana
function H2I takes handle h returns integer
return h
return 0
endfunction
// ===========================
function LocalVars takes nothing returns gamecache
if udg_Cache == null then
call FlushGameCache(InitGameCache("somename"))
set udg_Cache = InitGameCache("somename")
endif
return udg_Cache
endfunction
function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
endif
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
if value==false then
call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
else
call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleReal takes handle subject, string name, real value returns nothing
if value==0 then
call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
else
call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleString takes handle subject, string name, string value returns nothing
if value==null then
call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
else
call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function GetHandleHandle takes handle subject, string name returns handle
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleLocation takes handle subject, string name returns location
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction
// ===========================
constant function TreeRegrowTime takes nothing returns real
return 10.00 //the amount of time you want before the tree respawns
endfunction
//To add more trees press CTRl+D while looking at the Object Editor
//then follow the same format and add your tree's RAWCODE inside single quotes (Example ' ' )
function IsDesTree takes destructable a returns boolean
local integer d=GetDestructableTypeId(a)
if d =='ATtr' then
return true
elseif d=='BTtw' then
return true
elseif d=='KTtw' then
return true
elseif d=='YTft' then
return true
elseif d=='JTct' then
return true
elseif d=='YTst' then
return true
elseif d=='YTct' then
return true
elseif d=='YTwt' then
return true
elseif d=='JTwt' then
return true
elseif d=='DTsh' then
return true
elseif d=='FTtw' then
return true
elseif d=='CTtr' then
return true
elseif d=='ITtw' then
return true
elseif d=='NTtw' then
return true
elseif d=='OTtw' then
return true
elseif d=='ZTtw' then
return true
elseif d=='WTst' then
return true
elseif d=='LTlt' then
return true
elseif d=='GTsh' then
return true
elseif d=='Xtlt' then
return true
elseif d=='WTtw' then
return true
elseif d=='Attc' then
return true
elseif d=='BTtc' then
return true
elseif d=='CTtc' then
return true
elseif d=='ITtc' then
return true
elseif d=='NTtc' then
return true
elseif d=='ZTtc' then
return true
else
return false
endif
endfunction
function RegrowTrees takes nothing returns nothing
local destructable tree=GetDyingDestructable()
call TriggerSleepAction(TreeRegrowTime())
call DestructableRestoreLife( tree, GetDestructableMaxLife(tree), true )
set tree=null
endfunction
function Trig_Int_Tree_Revival takes nothing returns nothing
local trigger t
if IsDesTree(GetEnumDestructable())==true then
set t=CreateTrigger()
call TriggerRegisterDeathEvent( t, GetEnumDestructable() )
call TriggerAddAction(t,function RegrowTrees)
endif
endfunction
function Int_Tree_Revive takes nothing returns nothing
call EnumDestructablesInRectAll( GetPlayableMapRect(), function Trig_Int_Tree_Revival )
endfunction
1) What could have happened to cause a (basically) fully functioning map to go haywire like this? Was the editor patched in any way that would cause this?
2) What do these custom scripts do? The tree regrowth is self explanatory, but I can't remember why I put in the other two.
3) Can I fix it?
4) What other information do I need to provide in order to get a better answer?