Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

SKY_nii

4
Posts
1
Topics
3
Following
A member registered Dec 10, 2023

Recent community posts

while playing, i noticed this problem with prince emrys sprite, hope it gets fixed in the full game..

Heres the code of  obj_Batlle:


instance_deactivate_all(true)

units = []

turn = 0

unitTurnOrder = []

unitRenderOrder = []

turnCount = 0

roundCount = 0

battleWaitTimeFrames = 30

battleWaitTimeRemaining = 0

currentUser = noone

currentAction = -1

currentTargets = noone

for (var i = 0; i < array_length(enemies); i++)

{

enemyUnits[i] = instance_create_depth(x+300+(i*10), y+100+(i*20), depth-10, obj_BattleUnitEnemy, enemies[i])

array_push(units, enemyUnits[i])

}

for (var i = 0; i < array_length(global.party); i++)

{

partyUnits[i] = instance_create_depth(x+100+(i*10), y+100+(i*15), depth-10, obj_BattleUnitPC, global.party[i])

array_push(units, partyUnits[i])

/*partyUnits[i] = instance_create_depth(x-60+(i*10), y+(i*15), depth-10, obj_BattleUnitPC, global.party[i])

array_push(units, partyUnits[i])*/

}

unitTurnOrder = array_shuffle(units)

RefreshRenderOrder = function()

{

unitRenderOrder = []

array_copy(unitRenderOrder, 0, units, 0, array_length(units));

array_sort(unitRenderOrder, function(_1, _2)

{

return _1.y - _2.y;

})

}

RefreshRenderOrder()

function BattleStateSelectAction()

{

var _unit = unitTurnOrder[turn]

if (!instance_exists(_unit)) || (_unit.hp <= 0)

{

battleState = BattleStateVictoryCheck;

exit;

}

BeginAction(_unit.id, global.ActionLibrary.attack, _unit.id);

}

function BeginAction(_user, _action, _targets)

{

currentUser = _user

curentAction = _action

currentTargets = _targets

if (!is_array(_targets)) _targets = [_targets]

battleWaitTimeRemaining = battleWaitTimeFrames

with (_user)

{

acting = true

if (!is_undefined(_action[$ "userAnimation"])) && (!is_undefined(_user.sprites[$ _action.userAnimation]))

{

sprite_index = sprites[$ _action.userAnimation]

image_index = 0

}

}

battleState = BattleStatePerformAction

}

function BattleStatePerformAction()

{

if currentUser.acting

{

if currentUser.image_index >= currentUser.image_number -1

{

with currentUser

{

sprite_index = sprites.idle

image_index = 0

acting = false

}

if (variable_struct_exists(currentAction, "effectSprite"))

{

if (currentAction.effectOnTarget == MODE.ALWAYS) || ( (currentAction.effectOnTarget == MODE.VARIES) && (array_length(currentTargets) <= 1 ) )

{

for (var i = 0; i < array_length(currentTargets); i++)

{

instance_create_depth(currentTargets[i].x,currentTargets[i].y,currentTargets[i].depth-1,obj_BattleEffect,{sprite_index : currentAction.effectSprite})

}

}

else

{

var _effectSprite = currentAction.effectSprite

if (variable_struct_exists(currentAction, "effectSpriteNoTarget")) _effectSprite = currentAction.effectSpriteNoTarget;

instance_create_depth(x,y,depth-100,obj_BattleEffect,{sprite_index : _effectSprite});

}

}

currentAction.func(currentUser, currentTargets);

}

}

else

{

if (!instance_exists(obj_BattleEffect))

{

battleWaitTimeRemaining--

if (battleWaitTimeRemaining == 0)

{

battleState = BattleStateVictoryCheck;

}

}

}

}

function BattleStateVictoryCheck()

{

battleState = BattleStateTurnProgression

}

function BattleStateTurnProgression()

{

turnCount++

turn++

if (turn > array_length(unitTurnOrder) -1)

{

turn = 0

roundCount++

}

battleState = BattleStateSelectAction

}

battleState = BattleStateSelectAction

I've checked everything and currentTargets are assigned correctly and it still not working  :'(

Every time i boot up the game and enter battle this error pops up:


############################################################################################

ERROR in

action number 1

of  Step Event0

for object obj_Battle:

Variable <unknown_object>.func(100019, -2147483648) not set before reading it.

 at gml_Script_BattleStatePerformAction@gml_Object_obj_Battle_Create_0 (line 143) -                      currentAction.func(currentUser, currentTargets);

############################################################################################

gml_Script_BattleStatePerformAction@gml_Object_obj_Battle_Create_0 (line 143)

gml_Object_obj_Battle_Step_0 (line 1) - battleState()



I tried moving the currentAction.func(currentUser, currentTargets); in other places (because gamemaker show that this line is the problem) and with that everything work besides that hp is not going down and effect animations are not working at all!

I'm following the youtube tutorial and copied every line of code but it still not working, please help!