I was about to call "Work done", but then I died and that happened:
That started to happen after I add the boss mechanics to my game. After days of grinding, I cant see wheres the error in the code below:
g_new_ai_zombie_state = {}
g_grab = 0
g_ai_boss1_state = {}
function giant1_init( e )
pointerImage2 = LoadImage ( "scriptbank\\hp\\healthbar0.png" )
pointerImage1 = LoadImage ( "scriptbank\\hp\\healthbar1.png" )
g_ai_boss1_state = 0
g_new_ai_zombie_state[ e ] = 0
CharacterControlLimbo( e )
SetAnimationFrames( 135, 140 )
PlayAnimation( e )
end
function giant1_main( e )
if g_Entity[e]['health'] > 23 then
Boss = g_Entity[e]['health']
if g_Entity[e]['health'] <= 23 then
Boss = 100
end
end
if g_ai_boss1_state > 0 then
SetSpritePosition ( pointerSprite2 , 25 , 17)
SetSpritePosition ( pointerSprite1 , 25 , 17)
SetSpriteSize ( pointerSprite2 , 43.86 , 4 )
SetSpriteSize ( pointerSprite1 , Boss/22.5, 4 )
TextColor(38,15,3, "FLESHGRASP" ,252,255,51 )
PlaySoundIfSilent(e,4)
end
local Ent = g_Entity[ e ]
local playerDist = GetPlayerDistance( e )
if playerDist < 600 and g_new_ai_zombie_state[ e ] == 0 then
pointerSprite2 = CreateSprite ( pointerImage2 )
pointerSprite1 = CreateSprite ( pointerImage1 )
Spawn(1167)
g_ai_boss1_state = 1
SetAnimationFrames( 105, 160)
SetAnimationSpeed( e, 1 )
PlayAnimation( e )
g_new_ai_zombie_state[ e ] = 'rising'
PlaySound(e,0)
elseif
g_new_ai_zombie_state[ e ] == 'rising' and
GetAnimationFrame( e ) >= 155 then
g_new_ai_zombie_state[ e ] = 'runtoplayer'
elseif
g_new_ai_zombie_state[ e ] == 'attack' then
CharacterControlLimbo( e )
SetAnimationSpeed( e, 2 )
SetAnimationFrames( 275, 325 )
LoopAnimation( e )
PlaySoundIfSilent(e,1)
g_new_ai_zombie_state[ e ] = 'attacking'
elseif
g_new_ai_zombie_state[ e ] == 'attacking' and playerDist >= 100 then
g_new_ai_zombie_state[ e ] = 'runtoplayer'
end
if g_new_ai_zombie_state[ e ] == 'runtoplayer' then
SetAnimationFrames( 540, 565)
SetAnimationSpeed( e, 2 )
LoopAnimation( e )
g_new_ai_zombie_state [ e ] = 'running'
end
if g_new_ai_zombie_state [ e ] == 'running' then
RotateToPlayer(e)
MoveForward(e,250)
MoveUp(e,250)
end
if GetPlayerDistance(e) < 100 and g_new_ai_zombie_state [ e ] == 'running' then
g_new_ai_zombie_state [ e ] = 'grab'
end
if g_new_ai_zombie_state [ e ] == 'grab' then
FreezePlayer()
HurtPlayer(e,2)
TextColor(50,40,5,"PRESS E TO ESCAPE!",252,255,51)
PlaySound(e,2)
if g_grab >= 10 then
g_new_ai_zombie_state[ e ] = 'grabfree'
g_grab = 0
end
end
if g_KeyPressE == 1 and g_new_ai_zombie_state [ e ] == 'grab' then
g_grab = g_grab + 1
end
if g_new_ai_zombie_state [ e ] == 'grabfree' then
DeleteSprite ( pointerSprite2 )
DeleteSprite ( pointerSprite1 )
UnFreezePlayer()
RefreshEntity(e)
g_new_ai_zombie_state[ e ] = 0
CharacterControlLimbo( e )
SetAnimationFrames( 135, 140 )
PlayAnimation( e )
end
if g_PlayerHealth <= 0 then
g_new_ai_zombie_state[ e ] = 'rising'
UnFreezePlayer()
SetEntityHealth(e,1000)
g_ai_boss1_state = 1
end
end
function giant1_exit(e)
Destroy(1167)
UnFreezePlayer()
PlaySound(e,3)
DeleteSprite ( pointerSprite2 )
DeleteSprite ( pointerSprite1 )
end
I dont understand whats GG is calling on player death that could result in this error. I removed this script from the map and it worked fine.
The author of this post has marked a post as an answer.
Go to answer