thevoden
New Member
- Reaction score
- 5
I am getting this message everytime I use this custom spell in my map
"Double free of type: jData"
Here is the Jass Script
I cannot seem to find where I would remove that message.
Here are the other 3 triggers that seem to compliment it:
And for some odd reason, if I disable this trigger below; it won't let me save my map correctly.
"Double free of type: jData"
Here is the Jass Script
JASS:
//=====================================================================//
// Poison Javelin //
//=====================================================================//
//by emootootoo //
// //
// Requires: vJass, CSData, CSSafety //
// //
// Things you need to copy: //
// Abilities: Poison Javelin, PjavPoisonCloud //
// Units: JavelinDummy, Poison Cloud //
// Buffs: Poisoned //
// //
// Description: Throws a poisonous javelin that leaves a trail of //
// poison, poisoning enemies in it. When the javelin hits an enemy, //
// it stops and deals damage to them. //
//=====================================================================//
scope PoisonJavelin
globals // Configuration
private integer spellID=039;A009039;
//'Poison Javelin' Ability ID
private integer PJcloudID=039;A00A039;
//'PJavPoisonCloud' Ability ID
private integer dummyjavID=039;h001039;
//The 'JavelinDummy' unit's ID
private integer dummycloudID=039;h002039;
//The 'Poison Cloud' unit's ID
private string HitArt="Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl"
//The art on the unit that gets hit by the javelin
private real hSpeed=0.03
//Speed javelin travels
private real jDistance=1000
//Distance the Javelin travels
private real jCloudTime=5.
//Amount of time poison clouds stay on the groudn before being removed
private real jDamage=25
//Damage per level of Impact Damage (not poison damage)
//Note: Poison Damage and duration are altered in the ability 'PJavPoisonCloud'
endglobals // End configuration
//Code =====================================================================
struct jData
public unit jUnit
public unit jCaster
public integer count
public integer slvl
endstruct
function Trig_PoisonJavelin_Conditions takes nothing returns boolean
return GetSpellAbilityId()==spellID
endfunction
function PoisonJavelinTimer takes nothing returns nothing
local jData jD = GetCSData(GetExpiredTimer())
local group g=CreateGroup()
local unit u
local unit tempu
local integer tempint=0
local location dummypos=GetUnitLoc(jD.jUnit)
local real x=GetLocationX(dummypos)+20*Cos(GetUnitFacing(jD.jUnit)*bj_DEGTORAD)
local real y=GetLocationY(dummypos)+20*Sin(GetUnitFacing(jD.jUnit)*bj_DEGTORAD)
if jD.count<=jDistance/20 then
call SetUnitPosition(jD.jUnit,x,y)
set jD.count=jD.count+1
if ModuloInteger(jD.count,2)==0 then
set tempu=CreateUnit(GetOwningPlayer(jD.jCaster),dummycloudID,x,y,0)
call UnitAddAbility(tempu,PJcloudID)
call SetUnitAbilityLevel(tempu,PJcloudID,jD.slvl)
call UnitApplyTimedLife(tempu,039;BTLF039;,jCloudTime)
endif
else
call jD.destroy()
call ReleaseTimer(GetExpiredTimer())
call RemoveUnit(jD.jUnit)
endif
call GroupEnumUnitsInRange(g,GetUnitX(jD.jUnit),GetUnitY(jD.jUnit),90,null)
loop
set u = FirstOfGroup(g)
exitwhen u==null
if IsUnitEnemy(u,GetOwningPlayer(jD.jCaster))==true and IsUnitType(u,UNIT_TYPE_STRUCTURE)==false and GetUnitState(u,UNIT_STATE_LIFE)>0 then
set tempint=tempint+1
call UnitDamageTarget(jD.jCaster,u,jDamage*jD.slvl,true,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_NORMAL,null)
call AddSpecialEffectTarget(HitArt,u,"chest")
endif
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set g = null
if tempint>0 then
set jD.count=R2I((jDistance/20))+1
endif
call RemoveLocation(dummypos)
set dummypos=null
set tempu=null
endfunction
function Trig_PoisonJavelin_Actions takes nothing returns nothing
local jData jD=hData.create()
local unit caster=GetTriggerUnit()
local location tpoint=GetSpellTargetLoc()
local location castpos=GetUnitLoc(caster)
local real angle=bj_RADTODEG * Atan2(GetLocationY(tpoint) - GetLocationY(castpos), GetLocationX(tpoint) - GetLocationX(castpos))
local timer t = NewTimer()
local real x=GetLocationX(castpos)+50*Cos(angle*bj_DEGTORAD)
local real y=GetLocationY(castpos)+50*Sin(angle*bj_DEGTORAD)
local unit u=CreateUnit(GetOwningPlayer(caster),dummyjavID,x,y,angle)
set jD.count=0
set jD.slvl=GetUnitAbilityLevel(caster,spellID)
set jD.jCaster=caster
set jD.jUnit=u
call SetUnitUserData(jD.jUnit, jD)
call SetCSData(t,jD)
call TimerStart(t,hSpeed,true,function PoisonJavelinTimer)
set caster=null
set u=null
call RemoveLocation(tpoint)
set tpoint=null
call RemoveLocation(castpos)
set castpos=null
set t=null
endfunction
endscope
//===========================================================================
function InitTrig_PoisonJavelin takes nothing returns nothing
set gg_trg_PoisonJavelin = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_PoisonJavelin, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_PoisonJavelin, Condition( function Trig_PoisonJavelin_Conditions ) )
call TriggerAddAction( gg_trg_PoisonJavelin, function Trig_PoisonJavelin_Actions )
endfunction
I cannot seem to find where I would remove that message.
Here are the other 3 triggers that seem to compliment it:
JASS:
//Just needs to be copied into your map if you don't already have it.
library CSData
globals
gamecache cs_cache = null
integer array cs_array
gamecache udg_cscache = null
endglobals
function CS_H2I takes handle h returns integer
return h
return 0
endfunction
function SetCSData takes handle h, integer v returns nothing
local integer i=CS_H2I(h)-0x100000
if (i>=8191) then
call StoreInteger(cs_cache,"csdata",I2S(i),v)
else
set cs_array<i>=v
endif
endfunction
function GetCSData takes handle h returns integer
local integer i=CS_H2I(h)-0x100000
if (i>=8191) then
return GetStoredInteger(cs_cache,"csdata",I2S(i))
endif
return cs_array<i>
endfunction
endlibrary</i></i>
JASS:
//Just needs to be copied into your map if you don't already have it.
library CSSafety
globals
private timer array T
private integer N = 0
endglobals
function NewTimer takes nothing returns timer
if (N==0) then
return CreateTimer()
endif
set N=N-1
return T[N]
endfunction
function ReleaseTimer takes timer t returns nothing
call PauseTimer(t)
if (N==8191) then
call DestroyTimer(t)
else
set T[N]=t
set N=N+1
endif
endfunction
endlibrary
function InitTrig_CSSafety_Copy takes nothing returns nothing
endfunction
And for some odd reason, if I disable this trigger below; it won't let me save my map correctly.
JASS:
//=====================================================================//
// Hurricane //
//=====================================================================//
//by emootootoo //
// //
// Requires: vJass, CSData, CSSafety //
// //
// Things you need to copy: //
// Abilities: Hurricane, HurricaneDummySpell //
// Units: HurricaneDummy, DummyCaster //
// Buffs: Chilled //
// //
// Description: Summons a hurricane around the caster that damages and //
// slows enemy units that come within. //
//=====================================================================//
scope Hurricane
globals // Configuration
private integer spellID=039;A433039;
//Hurricane Ability ID
private integer dummycasterID=039;A433039;
//The DummyCaster unit's ID
private integer dummyunitID=039;A433039;
//The HurricaneDummy unit's ID
private real hInterval=0.5
//Time between damaging units in the hurricane (eg. 1.0 damages every 1 second)
//Note: Only use intervals of multiples of 0.05 (0.05, 0.4, 1.65, etc)
private real hDuration=10.0
//Duration of the spell
private real hRadius=500
//Radius of the Hurricane spell
private real hDamage=25
//Damage per level. Deals damage per interval to anyone in the huricane (eg. 50*lvl)
private real hDistanceInterval=150
//How far gusts of wind are apart from each other (max of 6 circles of wind around caster)
//The circles are determined starting from the max radius inwards to keep it accurate
endglobals // End Configuration
//Code =====================================================================
struct hData
public unit array hUnit[12]
public real array hAngle[12]
public real array hDist[12]
public unit hCaster
public integer hNumber
public integer count
public integer slvl
endstruct
function Trig_Hurricane_Conditions takes nothing returns boolean
return GetSpellAbilityId()==spellID
endfunction
function HurricaneTimer takes nothing returns nothing
local hData hD = GetCSData(GetExpiredTimer())
local group g=CreateGroup()
local unit u
local unit tempu
local real x
local real y
local location loc=GetUnitLoc(hD.hCaster)
local integer intcount=R2I(hInterval/0.05)
local integer tempint=0
local integer int=0
if GetUnitState(hD.hCaster,UNIT_STATE_LIFE)>0 then
else
set hD.count=R2I(hDuration/0.05)+1
endif
if hD.count<=R2I(hDuration/0.05) then
set hD.count=hD.count+1
loop
exitwhen tempint>hD.hNumber
set tempint=tempint+1
set hD.hAngle[tempint]=hD.hAngle[tempint]+8
set x=GetLocationX(loc)+hD.hDist[tempint]*Cos(hD.hAngle[tempint]*bj_DEGTORAD)
set y=GetLocationY(loc)+hD.hDist[tempint]*Sin(hD.hAngle[tempint]*bj_DEGTORAD)
call SetUnitPosition(hD.hUnit[tempint],x,y)
endloop
if ModuloInteger(hD.count,intcount)==0 then
call GroupEnumUnitsInRange(g,GetUnitX(hD.hCaster),GetUnitY(hD.hCaster),hRadius,null)
loop
set u = FirstOfGroup(g)
exitwhen u==null
if IsUnitEnemy(u,GetOwningPlayer(hD.hCaster))==true and IsUnitType(u,UNIT_TYPE_STRUCTURE)==false and GetUnitState(u,UNIT_STATE_LIFE)>0 then
call UnitDamageTarget(hD.hCaster,u,hDamage*hD.slvl,true,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_NORMAL,null)
set tempu=CreateUnit(GetOwningPlayer(hD.hCaster),dummycasterID,GetUnitX(u),GetUnitY(u),0)
call IssueTargetOrder(tempu,"slow",u)
call UnitApplyTimedLife(tempu,039;BTLF039;,0.75)
endif
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set g = null
endif
else
call hD.destroy()
call ReleaseTimer(GetExpiredTimer())
loop
exitwhen int>hD.hNumber
set int=int+1
call RemoveUnit(hD.hUnit[int])
set hD.hUnit[int]=null
endloop
endif
call RemoveLocation(loc)
set loc=null
set u=null
set tempu=null
endfunction
function Trig_Hurricane_Actions takes nothing returns nothing
local hData hD=hData.create()
local unit caster=GetTriggerUnit()
local real angle=GetUnitFacing(caster)
local real tempangle
local location cloc=GetUnitLoc(caster)
local location tloc=null
local timer t = NewTimer()
local real x
local real y
local integer radnum=R2I((hRadius*2)/hDistanceInterval)
local integer tempint=2
local integer int=0
local integer bsint=0
if radnum<1 then
set radnum=1
endif
if radnum>12 then
set radnum=12
endif
loop
exitwhen int>radnum
loop
exitwhen tempint<1
if tempint==2 then
set tempangle=angle-90
else
set tempangle=angle+90
endif
set int=int+1
set tloc=GetUnitLoc(caster)
set x=GetLocationX(tloc)+(hRadius-(bsint*hDistanceInterval))*Cos(tempangle*bj_DEGTORAD)
set y=GetLocationY(tloc)+(hRadius-(bsint*hDistanceInterval))*Sin(tempangle*bj_DEGTORAD)
set hD.hUnit[int]=CreateUnit(GetOwningPlayer(caster),dummyunitID,x,y,0)
call RemoveLocation(tloc)
set tloc=Location(x,y)
call SetUnitVertexColor(hD.hUnit[int],255,255,255,0)
set hD.hAngle[int]=tempangle
set hD.hDist[int]=DistanceBetweenPoints(cloc,tloc)
set tempint=tempint-1
call RemoveLocation(tloc)
endloop
set bsint=bsint+1
set tempint=2
endloop
set hD.count=0
set hD.slvl=GetUnitAbilityLevel(caster,spellID)
set hD.hCaster=caster
set hD.hNumber=int
call SetUnitUserData(hD.hUnit[hD.hNumber], hD)
call SetCSData(t,hD)
call TimerStart(t,0.05,true,function HurricaneTimer)
set caster=null
call RemoveLocation(cloc)
set cloc=null
set tloc=null
set t=null
endfunction
endscope
//===========================================================================
function InitTrig_Hurricane takes nothing returns nothing
set gg_trg_Hurricane = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Hurricane, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Hurricane, Condition( function Trig_Hurricane_Conditions ) )
call TriggerAddAction( gg_trg_Hurricane, function Trig_Hurricane_Actions )
endfunction