- Joined
- Oct 18, 2007
- Messages
- 930
Ok im making a spell that is like you summon +2 balls that starts at a height and spins down and towards the target like a whirlpool(Spiral) but just the balls. ( The time that the balls take to move down and to the target is depending on 4 globals, 3 setups and one the declares the over time that this is happening, like if you want it fast or slow )
Ok i need some math fixes in my spell like: To calculate some things over time etc.
The system i use made by Hanky.
Ok now for my unfinished Spell
Edit: Picture!
Ok i need some math fixes in my spell like: To calculate some things over time etc.
The system i use made by Hanky.
JASS:
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//X ° Mapmaking since 2006... X
//X ° X
//X ° X
//X ° X
//X °°°ÛÜ X
//X °°X°ÛÛÛ ÛÛÛÛÛÛÛÛ ÿÜÛÛÛÛÛÛÛÛÜ X
//X °°XX° ÛÛÛ ßÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛ X
//X °XX ° ÛÛÛÛ ÛÛÛÛÜ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ X
//X °XX ° ÛÛÛÛÛ ÛÛÛÛ ÛÛÛÛÛß ßÛÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ X
//X °°XXX°° ÛÛÛÛÛÛÜ ÛÛÛÜ ÛÛÛÛÛ ßÛÛÛÛÛ ßÛÛÛÛ ÛÛÛÛÛÛ X
//X °°°°°°°° ÛÛÛÛÛÛÛ ÛÛÛÛ ÛÛÛÛ ÛÛÛÛ ÛÛÛÛÜ X
//X ÛÛÛÛÛÛÛÛ ÛÛÛÛ ÛÛÛÛ ÛÛÛÛÛÛÛ ÛÛÛÛÛÜ ÛÛÛÛ X
//X °°°°°°°° ÛÛÛÛÛÛÛÛÛ ÛÛÛÛÜ ÛÛÛÛÜ ÛÛÛÛÛÛÛÛ ÛÛÛÛÛÜ ÜÛÛÛÛÛÛ X
//X °°XXXXX° ÛÛÛÛ ÛÛÛÜ ÛÛÛÛÛ ÛÛÛÛÛÛÜ ßÛÛÛÛÛ ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ X
//X °°XXXXX °° ÛÛÛÛ ÛÛÛÛÜ ÛÛÛÛ °°°ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ°°° ÛÛÛÛÛÛÛÛÛÛÛÛÛß X
//X ° XXXXX °°ÛÛÛÛÛ°°°°ÛÛÛÛÛÛÛÛ°°XX ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ XXX°°ÛÛÛÛÛÛÛÛÛÛÛ ÛÛÛ X
//X °° XXXXX ÜÛÛÛÛÛÛ X ÛÛÛÛÛÛÛÛÛ XXX ÛÛÛÛÛÛÛÛÛÛÛ XXXXXX ÛÛÛÛÛÛÛ° ÛÛÛ X
//X °° XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX °°°°°° °°°° X
//X °° XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX °°°°°X°° X
//X °°° XXXXXXXXXX °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° XXXXXXXXXXXXXXXXX°° X
//X °°°°°°°°°°°°°°°° °°°°°°°° XXXXXXX °°° X
//X °°°°°° XX °° X
//X ...2008 and still moving on. °°°°°°° X
//X °° X
//X Screen Solution: 1280x1024 Visit [url=http://www.ngo.clan.su]Clan NgO - Main page[/url]! X
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//! textmacro CostumInterface takes Loop,End,path,periodic
library CostumInterface$path$ initializer init
interface $path$Loop
boolean active=false
boolean paused=false
method $Loop$ takes nothing returns nothing
method $End$ takes nothing returns nothing
endinterface
globals
private $path$Loop array $path$_loopObject
private integer $path$_size=0
private trigger $path$_loop
constant real $path$_periodic=$periodic$
endglobals
function AddObjectTo$path$ takes $path$Loop loopObject returns integer
set $path$_loopObject[$path$_size]=loopObject
set $path$_loopObject[$path$_size].active=true
set $path$_size=$path$_size+1
if not IsTriggerEnabled($path$_loop) then
call EnableTrigger($path$_loop)
endif
return $path$_size
endfunction
private function Loop$path$ takes nothing returns nothing
local integer index=0
loop
exitwhen index==$path$_size
if $path$_loopObject[index].active and not $path$_loopObject[index].paused then
call $path$_loopObject[index].$Loop$.execute()
set index=index+1
elseif $path$_loopObject[index].paused then
set index=index+1
else
call $path$_loopObject[index].$End$()
set $path$_size=$path$_size-1
set $path$_loopObject[index]=$path$_loopObject[$path$_size]
endif
endloop
if $path$_size<=0 then
call DisableTrigger($path$_loop)
endif
endfunction
private function init takes nothing returns nothing
set $path$_loop=CreateTrigger()
call TriggerRegisterTimerEvent($path$_loop,$path$_periodic,true)
call TriggerAddAction($path$_loop,function Loop$path$)
call DisableTrigger($path$_loop)
endfunction
endlibrary
//! endtextmacro
//! runtextmacro CostumInterface("motion","endmotion","Motion","0.03")
Ok now for my unfinished Spell
JASS:
scope LightningStrike initializer Init_Strike
globals
private constant integer AID = 'A000' // The Ability beign cast
private constant integer DumTyp = 'n000' // The dummy unit of the Ball
private constant string Look = "" // This is how the missile looks like
private constant string Ex = "" // The Effect that the Ball create
private constant string Attachment = "origin" // The Attachment for the Look-alike for the Ball
private constant real SHeight = 1000. // The Starting Height of the Ball
private constant real MHeight = 5. // The lowest vale of the Ball beafore it "explodes"
private constant real Weight = 4. // The Weight of the Ball ( Higher numbers equals Faster Drop )
private constant real Speed = 8. // The Far-Off speed the Ball travel inn ( If this is a large number the circle is going to be large )
private constant real Rotation = 4. // The speed of the Ball traveling around the target
private constant real AOE = 200. // This is the Area Of Effect the damage does to enemies
private constant real Dam = 75. // This damage is divided by 2 and timed with the level value (see line 24- 26)
private constant real Offset = 400. // The Offset the Balls Start Inn
private constant real MOffset = 20
private constant real T2E = 1. // The Speed To End ( in other words, the time it will take to the spell to end. 1 Will make it take 1 seccond "The timer is at 0.03 secconds")
//************* End of Constants, DO NOT CHANGE THEESE VALUES BELOW THIS LINE -CRITICAL!- ****************
private group G
endglobals
private constant function Damage takes integer lvl returns real
return Dam/2*lvl
endfunction
private struct BallMotion extends MotionLoop
unit Ball
unit Target
unit Caster
real BX
real BY
real TX
real TY
//- - - - - - - - - - - - All of theese values has something to do with the global real S2E - - - - - - - - - -
real HL //The Height Loss ( THIS HAS SOMETHING TO DO WITH THE GLOBAL WEIGHT )
real S //The Speed ( THIS HAS SOMETHING TO DO WITH THE GLOBAL SPEED )
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
real BHeight
real Distance
real Angle
integer lvl
effect E
method motion takes nothing returns nothing
local real x
local real y
if .BHeight<=MHeight or .Distance<=MOffset then
set .active=false
else
set .BX=GetUnitX(.Ball)
set .BY=GetUnitY(.Ball)
set .TX=GetUnitX(.Target)
set .TY=GetUnitY(.Target)
set .Angle=.Angle+Rotation
set .Distance = SquareRoot((.TX-.BX)*(.TX-.BX)+(.TY-.BY)*(.TY-.BY))
set x =.BX+.Distance-.S*Cos(.Angle*bj_DEGTORAD)
set y =.BY+.S*Sin(.Angle*bj_DEGTORAD)
call SetUnitFlyHeight(.Ball,.BHeight-.HL,0.)
call SetUnitPosition(.Ball,x,y)
endif
endmethod
method endmotion takes nothing returns nothing
set .TX=GetUnitX(.Target)
set .TY=GetUnitY(.Target)
call RemoveUnit(.Ball)
call DestroyEffect(AddSpecialEffect(Ex,.TX,.TY))
call DestroyEffect(.E)
call UnitDamagePoint(.Caster,0.,AOE,.TX,.TY,Damage(.lvl),false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
set .Ball=null
set .Target=null
set .Caster=null
set .E=null
call .destroy()
endmethod
endstruct
private function Strike_Conditions takes nothing returns boolean
return GetSpellAbilityId() == AID
endfunction
private function Strike_Actions takes nothing returns nothing
local unit A=GetTriggerUnit()
local unit B=GetSpellTargetUnit()
local player P=GetOwningPlayer(A)
local integer index=0
local real Angle
local integer lvl=GetUnitAbilityLevel(A,AID)
local real x=GetUnitX(B)
local real y=GetUnitY(B)
local real xx
local real yy
local real N=360/R2I(lvl+1)
local BallMotion bm
loop
exitwhen index > lvl
set bm = BallMotion.create()
set bm.Caster = A
set bm.Target = B
set bm.lvl = lvl
//- - - - - - - - - - - THINGS THAT NEEDS A FIX - - - - - - - - - - - - - - - -
set bm.HL = 0 // DONT HAVE THE MATH THINGY FOR THIS!
set bm.S = 0 // DONT HAVE THE MATH THINGY FOR THIS!
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
set xx =x+Offset*Cos((I2R(index)*N)*bj_DEGTORAD)
set yy =y+Offset*Sin((I2R(index)*N)*bj_DEGTORAD)
set bm.Ball=CreateUnit(P,DumTyp,xx,yy,0)
set bm.BHeight=SHeight
call SetUnitFlyHeight(bm.Ball,bm.BHeight,0.)
set bm.E=AddSpecialEffectTarget(Look,bm.Ball,Attachment)
set index=index+1
endloop
set A=null
set B=null
set P=null
endfunction
//===========================================================================
private function Init_Strike takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Strike_Conditions ) )
call TriggerAddAction( t, function Strike_Actions )
set t = null
endfunction
endscope
Edit: Picture!
Last edited: