PDA

View Full Version : Reload all map entities



anggara_nothing
05-03-2016, 05:34 AM
how to reload all map entities when specific function called? is it possible with angelscript?
i want to create that kind of system just like counter-strike when round started

Solokiller
05-03-2016, 05:59 AM
Currently not possible.

anggara_nothing
05-03-2016, 09:27 AM
Oh well, i'll find func_breakable alternative then. :(

wolf-3d
05-03-2016, 09:35 AM
^ Currently not possible. (Entities are currently "space allocated" and "initalised" on map load).
Therefore assuming it was possible, if you could write AS code to reload existing entities it would cause a server crash. (Because that AS code could be run against any already existing map.)

However if you want "round started behavior" for a specific map you are making that is something different and potentially possible.

You will have to post the "exact behaviour steps" you want to achieve so we can suggest any possible methods/ways of getting it to work.

Note:
Players can be "respawned" which might be seen as the same as re-loaded (Depending on how you define "reload").
Monsters/most NPC "objects" can be teleported (origins shifted) or "recreated" (not re-loaded) by killing them and making a Fresh/New/Clone NPC appear at it's start location (Spawn a new NPC).

When describing the behaviour that you want, just remember spawn, respawn, load, reload, initalise & reinitialise mean different things and also may only apply when talking about Players or NPC's.

anggara_nothing
05-03-2016, 10:41 AM
when i'm said "reload" it means reload map entities from BSP file (.ent file when ripent'ed).

Probably func_button with assigned "health" value would be a great alternative.

anggara_nothing
05-03-2016, 10:58 AM
found a bug. func_button doesnt obey "health" parameter.

EDIT : no matters how big health is it, it's always trigger when get shot/hit. :/


int CButtonTarget::TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType )
{
Use( Instance(pevAttacker), this, USE_TOGGLE, 0 );

return 1;
}

Solokiller
05-03-2016, 11:12 AM
That's button_target, not func_button. It's supposed to trigger when it takes damage.

w00tguy123
05-03-2016, 01:47 PM
It might be possible with a lot of effort. Try saving the state of every entity on map load, then restore that state when the round ends. Any brush entities that are destroyed can be re-created with trigger_createentity. Other entities that are removed can be recreated with the state you saved at map load.

Sniper
05-03-2016, 02:18 PM
This is a feature we'll be adding at some point.

anggara_nothing
05-03-2016, 04:48 PM
It might be possible with a lot of effort. Try saving the state of every entity on map load, then restore that state when the round ends. Any brush entities that are destroyed can be re-created with trigger_createentity. Other entities that are removed can be recreated with the state you saved at map load.

Hmm interesting, any good examples or POC for this?

w00tguy123
05-03-2016, 05:21 PM
^ Nope, just an idea.