- Joined
- Jun 17, 2014
- Messages
- 236
hello, hive.
i here want to ask why my script not working, i've try to search the problem, and i change the script that i think is wrong, and when i test it the script still not working, after repeat it about 10 times, i give up because i'm new on vJass.
and i've try to debug the script and only work on :
roar.onInit method and roar.con method, the onCast is not working.
the script is not error when i compile it, just not working.
i here want to ask why my script not working, i've try to search the problem, and i change the script that i think is wrong, and when i test it the script still not working, after repeat it about 10 times, i give up because i'm new on vJass.
and i've try to debug the script and only work on :
roar.onInit method and roar.con method, the onCast is not working.
the script is not error when i compile it, just not working.
JASS:
library garspell1
globals
private constant integer SPELL_ID = 'AHds' //INSERT SPELL ID
private constant real DURATION = 15.
private unit caster
private constant string soundname = "war3mapImported\blablacapskjdiuoqwehsa7fbgt76awetr"
private constant real DAMAGE = 1234
private constant real ANIM_DUR = 1.2
private constant integer AB_ID1 = 'ANpi'
private constant integer AB_ID2 = 'Avul'
private constant integer AB_ID3 = 'Apiv'
endglobals
struct roar
static method con takes nothing returns boolean
call BJDebugMsg("con")
return GetSpellAbilityId( ) == SPELL_ID
endmethod
static method cam takes nothing returns nothing
call CameraSetEQNoiseForPlayer( GetEnumPlayer( ), 3 )
call PolledWait( ANIM_DUR )
call CameraClearNoiseForPlayer( GetEnumPlayer( ) )
endmethod
static method onCastd takes nothing returns nothing
local timer casttime = CreateTimer()
local real x = GetUnitX( caster )
local real y = GetUnitY( caster )
local sound cc
local group kz
local unit p
local player enemy = GetOwningPlayer( caster )
call BJDebugMsg("onCast")
set caster = GetTriggerUnit( )
// IF UNIT LESS THAT CRITICAL
if GetUnitLifePercent( caster ) <= 50 then
//PLAY CAM
call ForForce( GetPlayersAll( ), function thistype.cam )
//PICK UNIT
call GroupEnumUnitsInRange( kz, x, y, 1600., null )
loop
set p = FirstOfGroup( kz )
exitwhen p == null
if IsUnitEnemy( p, enemy ) and GetUnitState( p, UNIT_STATE_LIFE ) >= 0 then
call UnitDamageTarget( caster, p, DAMAGE, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS )
//SLOW TARGET HERE
endif
endloop
//PLAY A SOUND
set cc = CreateSound( soundname, false, false, true, 12700, 12700, "" )
call StartSound( cc )
call KillSoundWhenDone( cc )
//END OF PLAY A SOUND
//PAUSE AND PLAY ANIM
call PauseUnit( caster, true )
call SetUnitAnimation( caster, "some animation" )
call SetUnitAnimationByIndex( caster, /* some integer anim */ 1 )
call PauseUnit( caster, false )
call PauseUnit( caster, true )
call TimerStart( casttime, ANIM_DUR, false, function thistype.onCast2 )
else
set cc = CreateSound( soundname, false, false, true, 12700, 12700, "" )
call StartSound( cc )
call KillSoundWhenDone( cc )
//END OF PLAY A SOUND
//PAUSE AND PLAY ANIM
call PauseUnit( caster, true )
call SetUnitAnimation( caster, "some animation" )
call SetUnitAnimationByIndex( caster, /* some integer anim */ 1 )
call PauseUnit( caster, false )
call PauseUnit( caster, true )
call DestroyGroup(kz)
call TimerStart( casttime, ANIM_DUR, false, function thistype.onCast2 )
endif
endmethod
static method onCast2 takes nothing returns nothing
local timer dur = CreateTimer()
call BJDebugMsg("onCast2")
call PauseUnit( caster, false )
call UnitAddAbility( caster, AB_ID1 )
call UnitAddAbility( caster, AB_ID2 )
call UnitAddAbility( caster, AB_ID3 )
if GetUnitLifePercent( caster ) >= 50. then
call SetUnitAbilityLevel( caster, AB_ID1, 1 )
call SetUnitAbilityLevel( caster, AB_ID2, 1 )
call SetUnitAbilityLevel( caster, AB_ID3, 1 )
else
call SetUnitAbilityLevel( caster, AB_ID1, 2 )
call SetUnitAbilityLevel( caster, AB_ID2, 2 )
call SetUnitAbilityLevel( caster, AB_ID3, 2 )
endif
call TimerStart( dur, DURATION, false, function thistype.onExpire )
endmethod
static method onExpire takes nothing returns nothing
call UnitRemoveAbility( caster, AB_ID1 )
call UnitRemoveAbility( caster, AB_ID2 )
call UnitRemoveAbility( caster, AB_ID3 )
endmethod
static method onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
local integer i = 0
call BJDebugMsg("OnInit")
loop
exitwhen i > 15
call TriggerRegisterPlayerUnitEvent( t, Player( i ), EVENT_PLAYER_UNIT_SPELL_EFFECT, null )
call BJDebugMsg(I2S(i))
set i = i + 1
endloop
call TriggerAddCondition( t, function thistype.con )
call TriggerAddAction( t, function thistype.onCastd )
endmethod
endstruct
endlibrary