offline
Опыт:
22,103
Активность:
|
Ошибка в коде
Писал код для одного спела, но почему-то компилятор нервно умерает
Помогите пожалуйста понять ошибку
» ProblemInCode
scope GravityOut
include "cj_types_priv.j"
globals
hashtable H=InitHashtable()
private boolexpr b = null
endglobals
define
{
private Count = 12
private Damage = 300.00
private Speed = 20.00
private Radius = 200.00
private DummyId = 'h000'
private EffectId = "Abilities\\Weapons\\GlaiveMissile\\GlaiveMissileTarget.mdl"
private SpellId = 'A000'
}
private scope Data
group g
unit c
real x
real y
endstruct
private bool GroupEnum()
{
Data D = LoadInteger(H, GetHandleId(GetExpiredTimer()), 0)
unit u = GetFilterUnit()
real x = GetUnitX(u)
real y = GetUnitY(u)
real a = Atan2(y-D.y, x-D.x)
if IsUnitEnemy(u, GetOwningPlayer(D.c)) and GetWidgetLife(u) > 0.45 then
if not IsUnitInGroup(u, D.g) then
GroupAddUnit(D.g, u)
UnitDamageTarget(D.c, u, Damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
endif
endif
u = null
return false
}
private bool Move()
{
Data D = LoadInteger( H, GetHandleId(GetExpiredTimer()), 0)
group g = CreateGroup()
unit u = GetEnumUnit()
real x = GetUnitX(u)
real y = GetUnitY(u)
real a = Atan2(y - D.y, x - D.x)
DestroyEffect(AddSpecialEffect(EffectId, x, y))
GroupEnumUnitsInRange(g, x, y, Radius, b)
x = x + Speed * Cos(a)
y = y + Speed * Sin(a)
if (y-D.y)*(y-D.y)+(x-D.x)*(x-D.x) < Distance then
SetUnitX(u, x)
SetUnitY(u, y)
else
if GetUnitTypeId(u)==DummyId then
KillUnit(u)
GroupRemoveUnit(D.g, u)
else
GroupRemoveUnit(D.g, u)
endif
endif
DestroyGroup(g)
u = null
g = null
return false
}
private void Timer()
{
timer t = GetExpiredTimer()
Data D = LoadInteger(H, GetHandleId(t), 0)
if CountUnitsInGroup(D.g) == 0 then
PauseTimer(t)
DestroyGroup(D.g)
D.g = null
D.c = null
D.x = 0.00
D.y = 0.00
D.destroy()
FlushChildHashtable(H, GetHandleId(t))
DestroyTimer(t)
else
ForGroup(D.g, function Move)
endif
t = null
}
private void Actions()
{
Data D = Data.create()
timer t = CreateTimer()
integer i = 0
real a = 0.00
unit array u
D.c = GetSpellAbilityUnit()
D.g = CreateGroup()
D.x = GetUnitX(D.c)
D.y = GetUnitY(D.c)
b = Condition(function GroupEnum)
loop
exitwhen i >= Count
u[i] = CreateUnit(GetOwningPlayer(D.c), DummyId, D.x, D.y, a )
SetUnitX(u[i], D.x)
SetUnitY(u[i], D.y)
GroupAddUnit(D.g, u[i])
u[i] = null
a = a + 360 / Count
i = i + 1
endloop
SaveInteger(H, GetHandleId(t), 0, D)
TimerStart(t, 0.03, true, function Timer)
t = null
}
private bool Conditions()
{
return GetSpellAbilityId() == SpellId
}
function InitTrig_Stomp takes nothing returns nothing
gg_trg_Stomp = CreateTrigger()
TriggerRegisterPlayerUnitEvent(gg_trg_Stomp, Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
TriggerRegisterPlayerUnitEvent(gg_trg_Stomp, Player(1), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
TriggerRegisterPlayerUnitEvent(gg_trg_Stomp, Player(2), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
TriggerRegisterPlayerUnitEvent(gg_trg_Stomp, Player(3), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
TriggerRegisterPlayerUnitEvent(gg_trg_Stomp, Player(4), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
TriggerRegisterPlayerUnitEvent(gg_trg_Stomp, Player(5), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
TriggerRegisterPlayerUnitEvent(gg_trg_Stomp, Player(6), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
TriggerRegisterPlayerUnitEvent(gg_trg_Stomp, Player(7), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
TriggerRegisterPlayerUnitEvent(gg_trg_Stomp, Player(8), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
TriggerRegisterPlayerUnitEvent(gg_trg_Stomp, Player(9), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
TriggerAddCondition(gg_trg_Stomp, Condition( function Conditions))
TriggerAddAction(gg_trg_Stomp, function Actions)
Preload( EffectId )
PreloadEnd(.5)
endfunction
endscope
конкретно, ошибка в дефайне (ну туда вернее указывает), не может распознать к какому типу присвоить
Expected: "type", "struct", "interface", "function", "keyword" or "scope"
Отредактировано AlexKARASb, 15.05.2010 в 19:26.
|