Load / unload entities

O Ilusionista

Captain 100K
I know that when an entity is loaded, any other load call will be ignored, since the entity is already on the memory and the engine won't load the same content twice.

But I want to unload some entities after a certain stage, since they won't be used anymore. For that, I would use:

Code:
Load "entity" 1

(the manual says we must use "1" to unload, but I remember uTunnels saying we should use "3" although I don't remember what it means)

my question is: if I use "load" with that extra setting after I use the normal load, with the same entity, will the engine unload it or ignore it, since it's the same entity?

Edit: by the way, we can unload entities using script, no?
 
Not sure I follow your question. Do you mean having two instances of load for the same model in models.txt?

Load is an action performed in sequence, not an attribute - meaning that one load does not override the next (unlike attributes such as defense, where "last one read wins"). My guess is that the second load will be ignored regardless of any extra settings the first load has. When the second load is performed, the engine will search for the model in memory first, and when it finds it, stop right there and do nothing.

If you UNLOAD a model and then load it again, I believe the second load settings will take precedence. Outside of log entries, the engine does waste memory keeping a record of previous loads - that's the whole point.

I'd have to check through the code to be sure though, which is why I need you to clarify a bit.

DC
 
Sorry, I am on the phone + my crap english.

What happens is:

- I have a stage which loads some entities (which were put as KNOW in models.txt). I haven’t use any LOAD in this stage, I simply spawn the enemy on the level and the engine loads the entity by its own.

- After the chapter ends (a group of levels), I want to unload those entities, because they won’t be seen in any other place on the game, so they will just waste memory.

TL;DR
How to unload a previously loaded entity?
 
Can i reload currently used entity /player character in lets say special animation?
Dont want to close open engine all the time i make changes to him :'(
---
OK i figured how to do this, use this in levelst txt

Code:
skipselect myhero
z 440  660   
file	data/levels/stage.txt

Then in your stage.txt :
Code:
Load myhero 1
This will reload character everytime you play this level so you dont have to exit the engine when you make changes to his txt file.Just rerun the stage.
Im still interested how to do it with special button tho  :)

 
I know we have a load command for known entities in models.txt but i have not heard of UNLOAD is that a real command?

And i think levels unload known entities that were loaded at the end of the level.  I am not sure of this I hope DC can confirm.
 
I know we have a load command for known entities in models.txt but i have not heard of UNLOAD is that a real command?
You can unload using the load command

to unload an entity
load nameofentity 1

Load accepts 3 values - 1, 2 and 3.
One unloads the model, one unloads the sprites and the third unload everything, If I an not wrong.

With scripting, you can use the loadmodel function too, take a look:
Code:
HRESULT openbor_loadmodel(ScriptVariant **varlist , ScriptVariant **pretvar, int paramCount)
 
If we can load and unload models at will then this is a great. We could make 1 on 1 fighting games without wasting memory loading every character.
 
Back
Top Bottom