My script stopped working after the update.
- Code: Select all
obj = 0;
spawnID = 0; -- Set Exist to 0 to spawn 1st barrel
function onInit(objID)
sky.lprint("LUA: Script Active!");
obj = objID;
x,y,z = entity.getWorldPosition( obj ); --Get the world position of the barrel spawn point
end
function onUpdate(timeDelta)
if( entity.exist(spawnID) == 0 ) then -- check that barrel doesnt exist
spawnID = entity.spawnPreset("Barrel05",x,y,z); -- Spawn the preset barrel05 @ world position of spawn point
entity.setTag(spawnID,"barrel01"); -- Set the Tag so barrel can be refrenced in other script.
end
end
The entity.setTag(spawnID,"barrel01"); command seems to have stopped assigning tags to spawned in presets.
The death trigger also has started to give errors again.
- Code: Select all
obj = 0;
x,y,z =0;
function onInit(objID)
sky.lprint("LUA: Script Active!");
obj = objID;
playerID = entity.getIDFromTag("player");
x,y,z = entity.getPosition(entity.getIDFromTag("spawnpoint"));
y=y+2;
end
-- Updated every frame
function onUpdate(timeDelta)
end
function onTrigger_Enter(hitID)
entname = entity.getTagFromID(hitID) --Get the TAG from the ID of the entity that collided with the trigger box
if(entname == "Player")then -- the name of the player entity
sky.lprint("Player Detected..."); --Left for debugging
character.setPosition(hitID,x,y,z);
end
if(entname == ("barrel01"))then -- the name of the player entity
entity.delete( entity.getIDFromTag("barrel01") );
end
if(entname == ("barrel02"))then -- the name of the player entity
entity.delete( entity.getIDFromTag("barrel02") );
end
end
The error in the console
- Code: Select all
LUA ERROR: Tag name [ barrel01 ] not found or it is invalid, have you used the correct tag name? Does the tagged object exist?
LUA WARNING:** DELETE OBJECT ** Attempt failed!
You can not delete an entity that was placed in the scene at edit time.
Only spawned entities can be deleted dynamically.
LUA ERROR: Tag name [ barrel02 ] not found or it is invalid, have you used the correct tag name? Does the tagged object exist?
LUA WARNING:** DELETE OBJECT ** Attempt failed!
You can not delete an entity that was placed in the scene at edit time.
Only spawned entities can be deleted dynamically.
| < Skyline Game Is Stopping! > |
The thing is that the entities that are been deleted are spawned in from the 1st script and the above error is generated when trying to delete them through a script attached to a trigger.