- Joined
- Nov 23, 2008
- Messages
- 512
would be perfect 
(10 ratings)
.zarc
of a created CustomMissile
and it breaks the missile, causing it to disappear shortly after being created. You really need to stress-test all of your missile's capabilities in order to determine there are no obvious bugs. Setting the z-arc to 0.03 should not break the missile, it shows you did very little actual testing.Itachi009 said:k tested it and xe and my pc handled about 300 missiles from your systems but only 240 from xe, and since your system also supports more possibilities i change my vote to 5/5
onCreate
method I added this line exactly: set .zarc = 0.05
. I checked to see what the method operator zarc=
does and it just refers to .zArc
so there should be no problems there. Anachron said:Then maybe disable a few features? And check the interval times.
scope ShortBow initializer init
private keyword spell
private struct spellMissile extends CustomMissile
private integer hittedUnits = 0
private real dmgPerUnit = 0.
private spell spellInst = 0
private unit source = null
public static method new takes spell ins, unit caster returns thistype
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local thistype this = thistype.create(x, y, GetLocZ(x, y) + 85., 0.)
set .source = caster
set .spellInst = ins
call .setTargetPos(GetSpellTargetX(), GetSpellTargetY())
return this
endmethod
method onCreate takes nothing returns nothing
set .sfx = "Abilities\\Weapons\\Arrow\\ArrowMissile.mdl"
set .scale = 1 //: 100% of the normal size
set .colorA = 255 //: fully visible
set .movespeed = 512. //: Moves with a rate of 512
set .hitrange = 65. //: Hits units and missles in range of 65.
set .decay = 5. //: Decays after 5 seconds.
set .height = 50. //: Has a height of 50.
set .hitunits = true //: Hits units
set .hitdests = true //: Hits destructables
set .hitwalls = true //: Hits walls
endmethod
method onUnitTouch takes unit theUnit returns nothing
if GetUnitState(theUnit, UNIT_STATE_LIFE) == 0. or GetOwningPlayer(.source) == GetOwningPlayer(theUnit) then
return
endif
if IsPlayerEnemy(GetOwningPlayer(.source), GetOwningPlayer(theUnit)) then
call UnitDamageTarget(.source, theUnit, GetHeroAgi(.source,true), false, false, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_METAL_LIGHT_SLICE)
endif
call .spellInst.destroy()
endmethod
endstruct
private struct spell
private spellMissile missile = 0
public static method create takes unit caster, unit target returns thistype
local thistype this = thistype.allocate()
set .missile = spellMissile.new(this, caster)
call BJDebugMsg("Direction Coordinates: X=" + R2S(GetSpellTargetX()) + " Y=" + R2S(GetSpellTargetY()))
return this
endmethod
endstruct
private function cast takes nothing returns boolean
if GetSpellAbilityId() != 'A006' then
return false
endif
call spell.create(GetTriggerUnit(), GetSpellTargetUnit())
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
call TriggerAddCondition(t, Condition(function cast))
loop
exitwhen i >= bj_MAX_PLAYERS
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, null)
set i = i +1
endloop
endfunction
endscope
The GetSpellTargetX() and GetSpellTargetY() here is 0, because it does not have any event anymore.call .setTargetPos(GetSpellTargetX(), GetSpellTargetY())
scope ShortBow initializer init
private keyword spell
private struct spellMissile extends CustomMissile
private integer hittedUnits = 0
private real dmgPerUnit = 0.
private spell spellInst = 0
private unit source = null
public static method new takes spell ins, unit caster, real spellx, real spelly returns thistype
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local thistype this = thistype.create(x, y, GetLocZ(x, y) + 85., 0.)
set .source = caster
set .spellInst = ins
call .setTargetPos(spellx, spelly)
return this
endmethod
method onCreate takes nothing returns nothing
set .sfx = "Abilities\\Weapons\\Arrow\\ArrowMissile.mdl"
set .scale = 1 //: 100% of the normal size
set .colorA = 255 //: fully visible
set .movespeed = 512. //: Moves with a rate of 512
set .hitrange = 65. //: Hits units and missles in range of 65.
set .decay = 5. //: Decays after 5 seconds.
set .height = 50. //: Has a height of 50.
set .hitunits = true //: Hits units
set .hitdests = true //: Hits destructables
set .hitwalls = true //: Hits walls
endmethod
method onUnitTouch takes unit theUnit returns nothing
if GetUnitState(theUnit, UNIT_STATE_LIFE) == 0. or GetOwningPlayer(.source) == GetOwningPlayer(theUnit) then
return
endif
if IsPlayerEnemy(GetOwningPlayer(.source), GetOwningPlayer(theUnit)) then
call UnitDamageTarget(.source, theUnit, GetHeroAgi(.source,true), false, false, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_METAL_LIGHT_SLICE)
endif
call .spellInst.destroy()
endmethod
endstruct
private struct spell
private spellMissile missile = 0
public static method create takes unit caster, unit target returns thistype
local thistype this = thistype.allocate()
set .missile = spellMissile.new(this, caster, GetSpellTargetX(), GetSpellTargetY())
return this
endmethod
endstruct
private function cast takes nothing returns boolean
if GetSpellAbilityId() != 'A006' then
return false
endif
call spell.create(GetTriggerUnit(), GetSpellTargetUnit())
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
call TriggerAddCondition(t, Condition(function cast))
loop
exitwhen i >= bj_MAX_PLAYERS
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, null)
set i = i +1
endloop
endfunction
endscope
scope ShortBow initializer init
private keyword spell
private struct spellMissile extends CustomMissile
private integer hittedUnits = 0
private real dmgPerUnit = 0.
private spell spellInst = 0
private unit source = null
public static method new takes spell ins, unit caster, real spellx, real spelly returns thistype
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local thistype this = thistype.create(x, y, GetLocZ(x, y) + 85., 0.)
set .source = caster
set .spellInst = ins
call .setTargetPos(spellx, spelly)
call BJDebugMsg(".new Direction Coordinates: X=" + R2S(spellx) + " Y=" + R2S(spelly))
return this
endmethod
method onCreate takes nothing returns nothing
set .sfx = "Abilities\\Weapons\\Arrow\\ArrowMissile.mdl"
set .scale = 1 //: 100% of the normal size
set .colorA = 255 //: fully visible
set .movespeed = 512. //: Moves with a rate of 512
set .hitrange = 65. //: Hits units and missles in range of 65.
set .decay = 5. //: Decays after 5 seconds.
set .height = 50. //: Has a height of 50.
set .hitunits = true //: Hits units
set .hitdests = true //: Hits destructables
set .hitwalls = true //: Hits walls
endmethod
method onUnitTouch takes unit theUnit returns nothing
if GetUnitState(theUnit, UNIT_STATE_LIFE) == 0. or GetOwningPlayer(.source) == GetOwningPlayer(theUnit) then
return
endif
if IsPlayerEnemy(GetOwningPlayer(.source), GetOwningPlayer(theUnit)) then
call UnitDamageTarget(.source, theUnit, GetHeroAgi(.source,true), false, false, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_METAL_LIGHT_SLICE)
endif
call .spellInst.destroy()
endmethod
endstruct
private struct spell
private spellMissile missile = 0
public static method create takes unit caster, real x, real y returns thistype
local thistype this = thistype.allocate()
set .missile = spellMissile.new(this, caster, x, y)
call BJDebugMsg(".create Direction Coordinates: X=" + R2S(x) + " Y=" + R2S(y))
return this
endmethod
endstruct
private function cast takes nothing returns boolean
if GetSpellAbilityId() != 'A006' then
return false
endif
call spell.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
call BJDebugMsg("function cast Direction Coordinates: X=" + R2S(GetSpellTargetX()) + " Y=" + R2S(GetSpellTargetY()))
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
call TriggerAddCondition(t, Condition(function cast))
loop
exitwhen i >= bj_MAX_PLAYERS
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, null)
set i = i +1
endloop
endfunction
endscope
public static method new takes spell ins, unit caster, real spellx, real spelly returns thistype
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local thistype this = thistype.create(x, y, GetLocZ(x, y) + 85., 0.)
call SetCameraField(CAMERA_FIELD_ZOFFSET, GetLocZ(x, y) + 85., 0.1)
set .source = caster
set .spellInst = ins
call .setTargetPos(spellx, spelly)
call BJDebugMsg(".new Direction Coordinates: X=" + R2S(spellx) + " Y=" + R2S(spelly))
return this
endmethod
Hugh, what? That shouldn't be. zArc and xyArc are two completely different things and are never linked to each other.(but those two things are not important right now... i suppose i can fix for my map, for the target, it's just a matter of changing the arrival z. for the other one, i have no idea. the zarcs seems to delete the xyarc.)
private method updateTarget takes nothing returns nothing
if .hasTarget then
if .target != null then
set .end.x = GetUnitX(.target)
set .end.y = GetUnitY(.target)
set .end.z = GetLocZ(.end.x, .end.y) + GetUnitFlyHeight(.target) + 100.
endif
else
call .end.applyLoc(.eff.loc)
endif
endmethod
Thanks, but that really depends on the models so I can't really make this for every unit. But I guess there is nothing against +50 heightjust add an +110 z height for it. now it hits the chest. of course this changes from model to model and from scale to scale. but overall i think + 100 looks always better.
What about creating methods that actually catch the events?bad news: hitdest n' hitunits don't work either.(tested using a projectile with defined target. in doesn't notice the trees and units in the way)
scope MagicMissile initializer init
private keyword spell
private struct spellMissile extends CustomMissile
private integer hittedUnits = 0
private real dmgPerUnit = 0.
private spell spellInst = 0
private unit source = null
private unit aim = null
public static method new takes spell ins, unit caster, unit theTarget returns thistype
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local thistype this = thistype.create(x, y, GetLocZ(x, y) + 85., 0.)
set .source = caster
set .aim = theTarget
set .spellInst = ins
call .setTargetUnit(theTarget, true)
return this
endmethod
method onCreate takes nothing returns nothing
set .sfx = "Abilities\\Spells\\Undead\\OrbOfDeath\\AnnihilationMissile.mdl"
set .scale = .55 //: 55% of the normal size
set .colorA = 128 //: Half transparent
set .movespeed = 2000. //: Moves with a rate of 512
set .turnspeed = 0.15 //: Turns with a rate of 0.15
set .hitrange = 65. //: Hits units and missles in range of 48.
set .xyarc = GetRandomReal(-0.15,0.15) //: Has a random real xyArc from -0.15 to 0.15
set .decay = 6. //: Decays after 6 seconds.
set .height = 50. //: Has a height of 50.
set .hitwalls = true
set .hitdests = true
set .hitunits = true
endmethod
method onWallHit takes nothing returns nothing
call .spellInst.destroy()
endmethod
method onUnitTouch takes unit theUnit returns nothing
call UnitDamageTarget(.source, theUnit, 100., false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\OrbOfDeath\\OrbOfDeathMissile.mdl", theUnit, "chest"))
call .spellInst.destroy()
endmethod
method onDestTouch takes destructable theDestructable returns nothing
call .spellInst.destroy()
endmethod
method onTargetReach takes nothing returns nothing
call UnitDamageTarget(.source, .aim, 100., false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\OrbOfDeath\\OrbOfDeathMissile.mdl", .aim, "chest"))
call .spellInst.destroy()
endmethod
endstruct
private struct spell
private spellMissile missile = 0
public static method create takes unit caster, unit target returns thistype
local thistype this = thistype.allocate()
set .missile = spellMissile.new(this, caster, target)
return this
endmethod
endstruct
private function cast takes nothing returns boolean
if GetSpellAbilityId() != 'A000' then
return false
endif
call spell.create(GetTriggerUnit(), GetSpellTargetUnit())
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
call TriggerAddCondition(t, Condition(function cast))
loop
exitwhen i >= bj_MAX_PLAYERS
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, null)
set i = i +1
endloop
endfunction
endscope