- Joined
- Dec 29, 2006
- Messages
- 359
I am still fairly new at JASSing, and I am reasonably sure that my mistakes will be easily recognized by more advanced JASSers, but I cannot find out what I did wrong in this script.
function Trig_Dash_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'ACfb'
endfunction
function Dash_Dam_Cond takes nothing returns boolean
local string s = GetAttachmentTable(GetTriggeringTrigger() )
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTableUnit(s,"u")))==true and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
function Dash_Dam takes nothing returns nothing
local string s = GetAttachmentTable)GetTriggeringTrigger()
local unit u = GetTableUnits(s,"u")
local unit v = GetTriggerunit()
local real dam = 5*GetHeroAgi(u,true)
call UnitDamageTarget(u,v,dam,false,false,ATTACK_TYPE_NOTMAL,DAMAGE_TYPE_NORMAL,null
call SetUnitState(u,UNIT_STATE_LIFE,GetUnitState(u,UNIT_STATE_LIFE)+(.25*dam))
call DestroyEffet(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl",v,"overhead"))
set u = null
set v = null
endfunction
function Dash_Effects takes nothing returns nothing
local timer t = GetExpiredTimer()
local string s = GetAttachmentTable(t)
local trigger trig
local string strig
local unit u = GetTableUnits (s,"u")
local real and = GetTableReal(s,"ang")
local real dist = GetTableReal(s,"dist")
local real moved = GetTableReal(s, "moved")
call SetUnitPosition(u,GetUnitX(u) + 30 * Cos(ang * bj_DEGTORAD, GetUnitY(u) + 20 * Sin(ang * bj_DEGTORAD) )
call SetUnitAnimationByIndex(u,1)
set moved = moved+30
if moved>=dist or GetUnitState(u,UNIT_STATE_LIFE<=0 then
set trig = GetTableTrigger(s,"trig")
set strig = GetAttTable(trig)
call TriggerRemoveAction(trig,GetTableTriggerAction(strig,"ta"))
call ClearTable(trig)
call DestroyTrigger(trig)
set trig = null
call SetUnitTimeScalePercent(u, 100)
call SetUnitPathing(u,true)
call SetUnitAnimationByIndex(u,0)
call ClearTable(s)
call PauseTimer(t)
call DestroyTimer(t)
else
call SetTableReal(s,"moved",moved)
endif
set u = null
endfunction
function Trig_Dash_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location 1 = GetSpellTargetLoc()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real xtarg = GetLocationX(1)
local real ytarg = GetLocationY(1)
local real ang = bj__RADTODEG * Atan2(ytarg - y, xtarg - x)
local real dx = xtarg - x
local real dy = ytarg - y
local real dist =SquareRoot(dx * dx + dy * dy)
local trigger trig = CreateTrigger()
local string strig = GetAttachmenTable(trig)
local timer t = CreateTimer()
local string s = GetAttachmentTable(t)
call TriggerRegisterUnitinRange(trig,u,150,null)
call TriggerAddCondition( trig, Condition( function Dash_Dam_Cond ) )
call SetTableObject(strig,"ta", TriggerAddAction( trig, function Dash_Dam ))
call SetTableObject(strig,"u",u)
call SetTableReal(s,"and",ang)
call SetTableReal(s,:dist",dist)
call SetTableReal(s,"moved",0)
call SetTableObject(s,"u",u)
call SetTableObject(s,"trig",trig)
call TimerStart(t,.03,true,function Dash_Effects)
call SetUnitTimeScalePercent(u, 400)
call SetUnitPathing(u,false)
call SetUnitAnimationByIndex(u,1)
set u = null
call RemoveLocation(1)
set 1 = null
set trig = null
endfunction
endfunction
//===========================================================================
function InitTrig_Dash takes nothing returns nothing
set gg_trg_Dash = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Dash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Dash, Condition( function Trig_Dash_Conditions ) )
call TriggerAddAction( gg_trg_Dash, function Trig_Dash_Actions )
call preload ("Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl")
endfunction
my copy as text didnt go to well but the script is the same just some of the
functions go down an extra line, sorry if this is an inconvienance.
Overall question, what did i do wrong, i click test map and it comes up with
all sorts of errors, like expected a name and stuff like that, whats up with
this script?
function Trig_Dash_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'ACfb'
endfunction
function Dash_Dam_Cond takes nothing returns boolean
local string s = GetAttachmentTable(GetTriggeringTrigger() )
return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTableUnit(s,"u")))==true and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
endfunction
function Dash_Dam takes nothing returns nothing
local string s = GetAttachmentTable)GetTriggeringTrigger()
local unit u = GetTableUnits(s,"u")
local unit v = GetTriggerunit()
local real dam = 5*GetHeroAgi(u,true)
call UnitDamageTarget(u,v,dam,false,false,ATTACK_TYPE_NOTMAL,DAMAGE_TYPE_NORMAL,null
call SetUnitState(u,UNIT_STATE_LIFE,GetUnitState(u,UNIT_STATE_LIFE)+(.25*dam))
call DestroyEffet(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl",v,"overhead"))
set u = null
set v = null
endfunction
function Dash_Effects takes nothing returns nothing
local timer t = GetExpiredTimer()
local string s = GetAttachmentTable(t)
local trigger trig
local string strig
local unit u = GetTableUnits (s,"u")
local real and = GetTableReal(s,"ang")
local real dist = GetTableReal(s,"dist")
local real moved = GetTableReal(s, "moved")
call SetUnitPosition(u,GetUnitX(u) + 30 * Cos(ang * bj_DEGTORAD, GetUnitY(u) + 20 * Sin(ang * bj_DEGTORAD) )
call SetUnitAnimationByIndex(u,1)
set moved = moved+30
if moved>=dist or GetUnitState(u,UNIT_STATE_LIFE<=0 then
set trig = GetTableTrigger(s,"trig")
set strig = GetAttTable(trig)
call TriggerRemoveAction(trig,GetTableTriggerAction(strig,"ta"))
call ClearTable(trig)
call DestroyTrigger(trig)
set trig = null
call SetUnitTimeScalePercent(u, 100)
call SetUnitPathing(u,true)
call SetUnitAnimationByIndex(u,0)
call ClearTable(s)
call PauseTimer(t)
call DestroyTimer(t)
else
call SetTableReal(s,"moved",moved)
endif
set u = null
endfunction
function Trig_Dash_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location 1 = GetSpellTargetLoc()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real xtarg = GetLocationX(1)
local real ytarg = GetLocationY(1)
local real ang = bj__RADTODEG * Atan2(ytarg - y, xtarg - x)
local real dx = xtarg - x
local real dy = ytarg - y
local real dist =SquareRoot(dx * dx + dy * dy)
local trigger trig = CreateTrigger()
local string strig = GetAttachmenTable(trig)
local timer t = CreateTimer()
local string s = GetAttachmentTable(t)
call TriggerRegisterUnitinRange(trig,u,150,null)
call TriggerAddCondition( trig, Condition( function Dash_Dam_Cond ) )
call SetTableObject(strig,"ta", TriggerAddAction( trig, function Dash_Dam ))
call SetTableObject(strig,"u",u)
call SetTableReal(s,"and",ang)
call SetTableReal(s,:dist",dist)
call SetTableReal(s,"moved",0)
call SetTableObject(s,"u",u)
call SetTableObject(s,"trig",trig)
call TimerStart(t,.03,true,function Dash_Effects)
call SetUnitTimeScalePercent(u, 400)
call SetUnitPathing(u,false)
call SetUnitAnimationByIndex(u,1)
set u = null
call RemoveLocation(1)
set 1 = null
set trig = null
endfunction
endfunction
//===========================================================================
function InitTrig_Dash takes nothing returns nothing
set gg_trg_Dash = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Dash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Dash, Condition( function Trig_Dash_Conditions ) )
call TriggerAddAction( gg_trg_Dash, function Trig_Dash_Actions )
call preload ("Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl")
endfunction
my copy as text didnt go to well but the script is the same just some of the
functions go down an extra line, sorry if this is an inconvienance.
Overall question, what did i do wrong, i click test map and it comes up with
all sorts of errors, like expected a name and stuff like that, whats up with
this script?