- Joined
- Sep 8, 2004
- Messages
- 633
Howdy partners!
I'm using a JASS spell in my little brother's map, but there's a small problem!
I got the spell to work, set the variables to the desired values, no problem. Thing is, when the spell is used, the kills don't give bounty to the using player. I can modify simple JASS, but since I can only code GUI myself, I can't fix this problem. It uses a dummy caster, which needs to be owned by the casting unit's owner. Can anyone fix/create this for me? It concerns the following spell:
http://www.hiveworkshop.com/resources_new/spells/971/
The preloads are all set in the map script. JassNewGen and TESH are used. Thanks in advance!
~ Angelusz
I'm using a JASS spell in my little brother's map, but there's a small problem!
I got the spell to work, set the variables to the desired values, no problem. Thing is, when the spell is used, the kills don't give bounty to the using player. I can modify simple JASS, but since I can only code GUI myself, I can't fix this problem. It uses a dummy caster, which needs to be owned by the casting unit's owner. Can anyone fix/create this for me? It concerns the following spell:
http://www.hiveworkshop.com/resources_new/spells/971/
JASS:
//===================================
//Spell: Cluster Bombs
//Author: paskovich
//
//If you want to import this spell,
//make sure you copy the dummy units
//from the object editor,
//and set the raw codes below!
//
//For damage values, copy and edit
//the 'Cluster Damage' ability.
//
//It uses the Handle Vars and
// REQUIRES vJASS!!
//
//Thanks to Shadow1500 for the
//parabola function!
//
//
//Don't forget to give a credit!
//===================================
//=============RAW CODES=============
//Make sure you set the proper raw codes!
constant function ClusterBombs_SpellId takes nothing returns integer
return 'A00E' //The main ability's raw code
endfunction
constant function ClusterBombs_DummyId takes nothing returns integer
return 'e001' //The generic dummy's raw code
endfunction
constant function ClusterBombs_AoEDamageAbility takes nothing returns integer
return 'A01Y' //The AoE damage ability's raw code (it's called "Cluster Damage" in the object editor)
endfunction
//===========SPELL OPTIONS===========
constant function ClusterBombs_NumberOfBombs takes integer level returns integer
return 2 * level //This defines the number of bombs falling from the sky.
endfunction
constant function ClusterBombs_NumberOfClusters takes nothing returns integer
return 3 //The number of clusters that a bomb falls apart to.
endfunction
constant function ClusterBombs_AoE takes nothing returns real
return 500.0 //The radius of the AoE. (Set this the same that you set in the object editor for the hero ability.)
endfunction
constant function ClusterBombs_Delay takes nothing returns real
return 0.9 //The delay time between falling bombs.
endfunction
//=======================================
//============CLUSTER BOMBS==============
//=======================================
struct ClusterBombData
unit c
unit p
real tx
real ty
real ang
real dist
real mdist
endstruct
function Trig_ClusterBomb_Conditions takes nothing returns boolean
return GetSpellAbilityId() == ClusterBombs_SpellId()
endfunction
function Timer_ClusterBombSplinter takes nothing returns nothing
local timer t = GetExpiredTimer()
local ClusterBombData dat3 = ClusterBombData(GetHandleInt(t,"data3"))
local unit s = dat3.p
local real a = dat3.ang
local real h = GetParabolaHeight(dat3.dist, dat3.mdist, 1)
local real offset = ClusterBombs_AoE() / 28
call SetUnitX(s, GetUnitX(s)+offset*Cos(a*bj_DEGTORAD))
call SetUnitY(s, GetUnitY(s)+offset*Sin(a*bj_DEGTORAD))
call SetUnitFlyHeight(s,h,0)
set dat3.dist = dat3.dist + offset
if dat3.dist >= dat3.mdist then
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl",GetUnitX(s),GetUnitY(s)))
call KillUnit(s)
call PauseTimer(t)
call FlushHandleLocals(t)
call DestroyTimer(t)
call ClusterBombData.destroy(dat3)
endif
set t = null
set s = null
endfunction
function Timer_ClusterBombFall takes nothing returns nothing
local timer t = GetExpiredTimer()
local ClusterBombData dat2 = ClusterBombData(GetHandleInt(t,"data2"))
local ClusterBombData dat3
local unit b = null
local real a = 0
local timer tt = null
local unit s = null
local real offset = ClusterBombs_AoE() / 25
if dat2.dist >= dat2.mdist then
set b = dat2.p
set a = dat2.ang
call ShowUnit(b,true)
call SetUnitX(b, GetUnitX(b) + offset * Cos(a*bj_DEGTORAD))
call SetUnitY(b, GetUnitY(b) + offset * Sin(a*bj_DEGTORAD))
call SetUnitFlyHeight(b, GetUnitFlyHeight(b) - 60, 0)
if GetUnitFlyHeight(b) <= 40 then
call PauseTimer(t)
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\LordofFlameMissile\\LordofFlameMissile.mdl",GetUnitX(b),GetUnitY(b)))
set a = 0
loop
set a = a + 1
exitwhen a > ClusterBombs_NumberOfClusters()
set s = CreateUnit(GetOwningPlayer(b),ClusterBombs_DummyId(),GetUnitX(b),GetUnitY(b),0)
call AddSpecialEffectTarget("abilities\\weapons\\DemolisherMissile\\DemolisherMissile.mdl",s,"origin")
call UnitAddAbility(s, ClusterBombs_AoEDamageAbility())
call SetUnitScale(s, 0.5, 0.5, 0.5)
set tt = CreateTimer()
set dat3 = ClusterBombData.create()
set dat3.p = s
set dat3.ang = GetRandomReal(1,360)
set dat3.dist = 0
set dat3.mdist = GetRandomReal(ClusterBombs_AoE()/8,ClusterBombs_AoE()/1.8)
call SetHandleInt(tt,"data3",dat3)
call TimerStart(tt, 0.04, true, function Timer_ClusterBombSplinter)
set tt = null
endloop
call RemoveUnit(b)
call FlushHandleLocals(t)
call DestroyTimer(t)
call ClusterBombData.destroy(dat2)
endif
else
set dat2.dist = dat2.dist + 0.04
endif
set t = null
set b = null
endfunction
function Timer_ClusterBombFlash takes nothing returns nothing
local timer t = GetExpiredTimer()
local ClusterBombData dat = ClusterBombData(GetHandleInt(t,"data"))
local ClusterBombData dat2
local unit u = dat.c
local unit p = dat.p
local real a = dat.ang
local real h = GetParabolaHeight(dat.dist, dat.mdist, 2)
local timer tt = null
local integer c = 0
local real tx = 0
local real ty = 0
local real offset = 4 * ClusterBombs_AoE() / 57
call SetUnitX(p, GetUnitX(p)+offset*Cos(a*bj_DEGTORAD))
call SetUnitY(p, GetUnitY(p)+offset*Sin(a*bj_DEGTORAD))
call SetUnitFlyHeight(p, h, 0)
set dat.dist = dat.dist + offset
if dat.dist >= dat.mdist then
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl",GetUnitX(p),GetUnitY(p)))
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Flare\\FlareTarget.mdl",GetUnitX(p),GetUnitY(p)))
call KillUnit(p)
loop
set c = c + 1
exitwhen c > ClusterBombs_NumberOfBombs(GetUnitAbilityLevel(u,ClusterBombs_SpellId()))
set a = GetRandomReal(1,360)
set h = GetRandomReal(ClusterBombs_AoE()/1.3,ClusterBombs_AoE()/0.66)
set tx = dat.tx + h * Cos(a*bj_DEGTORAD)
set ty = dat.ty + h * Sin(a*bj_DEGTORAD)
set p = CreateUnit(GetOwningPlayer(u),ClusterBombs_DummyId(),tx,ty,a)
call AddSpecialEffectTarget("Abilities\\Weapons\\Mortar\\MortarMissile.mdl", p, "origin")
call SetUnitFlyHeight(p,1700,0)
call ShowUnit(p,false)
set tt = CreateTimer()
set dat2 = ClusterBombData.create()
set dat2.p = p
set dat2.ang = a+180
set dat2.dist = 0
set dat2.mdist = c * ClusterBombs_Delay()
call SetHandleInt(tt,"data2",dat2)
call TimerStart(tt, 0.04, true, function Timer_ClusterBombFall)
set tt = null
endloop
call PauseTimer(t)
call FlushHandleLocals(t)
call DestroyTimer(t)
call ClusterBombData.destroy(dat)
endif
set t = null
set u = null
set p = null
endfunction
function Trig_ClusterBomb_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location l = GetSpellTargetLoc()
local real tx = GetLocationX(l)
local real ty = GetLocationY(l)
local timer t = CreateTimer()
local unit p = CreateUnit(GetOwningPlayer(u),ClusterBombs_DummyId(),GetUnitX(u),GetUnitY(u),0)
local ClusterBombData dat = ClusterBombData.create()
call RemoveLocation(l)
set l = null
call SetUnitFlyHeight(u,20,0)
call AddSpecialEffectTarget("Abilities\\Weapons\\BloodElfMissile\\BloodElfMissile.mdl",p,"origin")
set dat.c = u
set dat.p = p
set dat.tx = tx
set dat.ty = ty
set dat.ang = AngleBetweenPointsXY(GetUnitX(u),GetUnitY(u),tx,ty)
set dat.dist = 0
set dat.mdist = DistanceBetweenPointsXY(GetUnitX(u),GetUnitY(u),tx,ty)
call SetHandleInt(t,"data",dat)
call TimerStart(t, 0.04, true, function Timer_ClusterBombFlash)
set u = null
set t = null
set p = null
endfunction
//===========================================================================
function InitTrig_ClusterBomb takes nothing returns nothing
set gg_trg_ClusterBomb = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_ClusterBomb, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_ClusterBomb, Condition( function Trig_ClusterBomb_Conditions))
call TriggerAddAction(gg_trg_ClusterBomb, function Trig_ClusterBomb_Actions)
call RemoveUnit(CreateUnit(Player(15),ClusterBombs_DummyId(),0,0,0))
call Preload("Abilities\\Weapons\\BloodElfMissile\\BloodElfMissile.mdl")
call Preload("Abilities\\Weapons\\Mortar\\MortarMissile.mdl")
call Preload("Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl")
call Preload("Abilities\\Spells\\Human\\Flare\\FlareTarget.mdl")
call Preload("abilities\\weapons\\DemolisherMissile\\DemolisherMissile.mdl")
call Preload("Abilities\\Weapons\\LordofFlameMissile\\LordofFlameMissile.mdl")
call Preload("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl")
endfunction
The preloads are all set in the map script. JassNewGen and TESH are used. Thanks in advance!
~ Angelusz
Last edited by a moderator: