entity not being purged after level load - causing E1515

Posted By: Stansmedia

entity not being purged after level load - causing E1515 - 09/01/14 19:35

Alright.. So I have a level in which my character has an action that creates a hair model. The hair model gets an action that stores its creator in a local pointer so it can attach itself to the head. When I return to the menu during the level and reload the level, I get error E1515 for the hairs action. I put a draw_text in the while loop of the hair and sure enough it stays running when I return to the menu. My game main menu is its own level (as a background to the panels). So... Why the heck wouldn't this model be getting removed after the level load?

Code:
action hairmodel()
{
ENTITY* creator = you;
while(creator != NULL)
{
proc_mode = PROC_LATE; //wait until animations done, etc
vec_set(...)//set myself to 'creator' head bone and stuff
}
}

action character()
{
ENTITY* myhair;
myhair = ent_create("chickhair.mdl",vector(my.x,my.y,my.z-32),hairmodel);
...
set(myhair,VISIBLE); //
...
}

Posted By: Kartoffel

Re: entity not being purged after level load - causing E1515 - 09/01/14 19:40

set(hairmodel,VISIBLE);
Is wrong. 'hairmodel' is your action, not an entity.
Posted By: Stansmedia

Re: entity not being purged after level load - causing E1515 - 09/01/14 21:20

My bad. I quickly whipped up that code as an example instead of copying and pasting the actions, they are quite long.
Posted By: Kartoffel

Re: entity not being purged after level load - causing E1515 - 09/01/14 21:25

yeah, simple copy&paste mistakes, everyone makes these.

one tip though, choose your names more careful. 'hairmodel' sounds indeed like an entity... I'd use something like 'AC_hairmodel' as action.
Posted By: Stansmedia

Re: entity not being purged after level load - causing E1515 - 09/01/14 21:29

no idea why the action hairmodels()'s while loop isn't terminating on level switch? I have a draw_text(...) in the loop to show when its running, and when i switch levels its still going. I don't know what's stopping it from terminating.
Posted By: Kartoffel

Re: entity not being purged after level load - causing E1515 - 09/01/14 22:31

1st. now that I notice it, there really should be a wait(1) at the and of that while (if you haven't put one there already).
2nd. I'd also add an ent_remove for the hair model after the loop has been terminated (except you're doing something special there and want to keep the hair model)
3rd. I'm not sure why your while look isn't working properly but #1 might solve that.
Posted By: Stansmedia

Re: entity not being purged after level load - causing E1515 - 09/01/14 23:31

proc_mode = PROC_LATE is screwing something over. I removed it and it seems to work. I don't understand why it's being so fussy. This is ridiculous. I use the same script in all the other levels, but for some reason this one wants to be... BAH.
© 2024 lite-C Forums