- Joined
- Jul 26, 2008
- Messages
- 1,009
Alright I'm using Vexorian's Caster System 16.0 and wanted to make a Fireball spell. Basically the fireball explodes upon contact and then knocks back enemies while damaging them. Simple 'nuff and nice since I don't know crap for math.
However, since the code can't take anything I don't know how to get the caster on collision without losing MUI/MPI (Not an option). I was thinking of doing some structs and methods but am clueless on how to call the data on them back up once created.
Any help or ideas? +rep :3
However, since the code can't take anything I don't know how to get the caster on collision without losing MUI/MPI (Not an option). I was thinking of doing some structs and methods but am clueless on how to call the data on them back up once created.
Any help or ideas? +rep :3
JASS:
// function CollisionMissile_Create takes string MissileModelPath, real x, real y, real dirangle, real speed, real AngleSpeed, real MaxDist, real height, boolean UseNewCaster, real Collision, code OnImpact returns unit
scope Fireball initializer Init
globals
private constant integer SPELLID = 'FiBa'
private constant string MisModel = "Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl"
private constant attacktype atk = ATTACK_TYPE_MAGIC
private constant damagetype dmg = DAMAGE_TYPE_NORMAL
private unit TempUnit
endglobals
private function GroupCheck takes nothing returns boolean
local real dam1 = GetUnitAbilityLevel(TempUnit, SPELLID)*50 + 20
local real dam
local real a
local integer INT = GetHeroInt(TempUnit, true)
local integer lvl = GetUnitLevel(TempUnit)
if IsUnitType(TempUnit, UNIT_TYPE_HERO) then
set dam = dam1 + INT*2
else
set dam = dam1 + lvl*10
endif
if IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TempUnit)) and GetWidgetLife(GetFilterUnit()) > 0.405 and not(IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)) then
set a = 57.29582 * Atan2(GetUnitY(GetFilterUnit()) - GetUnitY(TempUnit), GetUnitX(GetFilterUnit()) - GetUnitX(TempUnit))
call UnitDamageTarget(TempUnit, GetFilterUnit(), dam, true, false, atk, dmg, null)
call KnockbackTarget(TempUnit, GetFilterUnit(), a, 250., 700., true, false, false, "Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl")
endif
return true
endfunction
private function OnImpact takes nothing returns nothing
local group g = NewGroup()
local unit c = GetTriggerUnit()
call GroupEnumUnitsInRange(g, GetUnitX(c), GetUnitY(c), 175, function GroupCheck)
set c = null
call ReleaseGroup(g)
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELLID
endfunction
private function Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
call CollisionMissile_Create(MisModel, GetSpellTargetX(), GetSpellTargetY(), AngleBetweenPoints(GetUnitLoc(c), GetSpellTargetLoc()), 900, 0, 1100, 25, true, 125, OnImpact)
set c = null
endfunction
//===========================================================================
public function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, function Conditions )
call TriggerAddAction(t, function Actions )
endfunction
endscope