b368 - Something wrong with recycled actors?

Darkhog

  • Posts: 1243
This what I've got when prepared Fear of Eights for new site:

ActionScript error:
TypeError: Error #1009: null object reference.
   at stencyl.api.engine::GameState/getRecycledActorOfType()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/engine/GameState.as:1054]
   at stencyl.api.engine::Script/createRecycledActor()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/engine/Script.as:930]
   at <anonymous>()[/mnt/temp/Stencyl/sandbox/flash/scripts/Design_4_4_CreateNumbers.as:47]
   at stencyl.api.engine::TimedTask/update()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/engine/TimedTask.as:37]
   at stencyl.api.engine::GameState/innerUpdate()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/engine/GameState.as:1365]
   at stencyl.api.engine::GameState/postUpdate()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/engine/GameState.as:1299]
   at stencyl.api.engine::GameState/update()[/Users/jon/Desktop/stencyl/plaf/flash/root/stencyl/api/engine/GameState.as:1281]
   at org.flixel::FlxGame/update()[/Users/jon/Desktop/stencyl/plaf/flash/flixel/org/flixel/FlxGame.as:343]




I am sure that on my side everything is okay, because on b367 I didn't get these errors and I have if actor alive blocks in all sensitive places.

There are no impossible things. There is only lack of skills.
Don't click this if your computer has less than 641 kilobytes of RAM.
Stencyl stencyling stencylish stencylers :D

Alexin

  • *
  • Posts: 3130
You also have to check if the actor has a value (Funtions > [ACTOR has value?]), besides checking if it's alive.
Nonetheless, something may be off...
"Find the fun"
alexin@stencyl.com

Darkhog

  • Posts: 1243
You also have to check if the actor has a value (Funtions > [ACTOR has value?]), besides checking if it's alive.

Everything's fine, but this won't work, because I mainly using if <[Self] is alive>, not any attributes.

There are no impossible things. There is only lack of skills.
Don't click this if your computer has less than 641 kilobytes of RAM.
Stencyl stencyling stencylish stencylers :D

Alexin

  • *
  • Posts: 3130
The value "actor" that appears in the dropdown refers to the current actor, ie. it's the same as "self".

In order to avoid errors of the type "null reference", you have to check if the actor has a value first AND if it's alive, in this exact order. Checking if the actor is alive can still throw an error and that's why these checks should always be together.

"Find the fun"
alexin@stencyl.com