heady89@Posted: Sat Nov 10, 2012 5:06 pm :
Hello folks,

Let me first say that every answer so far has been very helpful, and i appreciate your time.
I'm wondering how i can trigger a target_setkeyval to set the health of for example a func_fracture to 0.

Tried to set the keyval as health;0 and then have it target the actual func_fracture without success.
I'm not quite sure how the setkeyval works, i mean could i trigger it from a trigger_once so that i have control of when it occurs?

My second question relates more to scripting, could i perhaps just use a trigger_once that calls my script function and then somehow
set the health of a specific entity from my scriptfunction. If possible, how would that syntax look?

Kind regards,
heady



chimueloeldragon2011@Posted: Sat Nov 10, 2012 5:38 pm :
I'm not sure how exactly the key/val target works in the editor, but I don't know if you can actually, dynamically change spawnargs of an entity while running a game other than "hide" or some shaderparms/guiparms, (those are toggled on trigger events)

What I do know is that you can set a key/val for further use in script, which would look like this:

Code:
void setkey() {

   entity ent;
   ent = sys.getEntity("func_static_1");

   ent.setKey( "spawnarg_here", "0 or 1 or whatever number" );
}


That worked fine for me and does the job but it doesn't actually change the behaviour of the entity while in game.
Then you can later fetch the key value using "getKey"

Anyway, take a look at script/doom_events, that will help you a lot!

doom_events wrote:
// Sets a key on this entity's spawn args. Note that most spawn args are evaluated when
// this entity spawns in, so this will not change the entity's behavior in most cases.
// This is chiefly for saving data the script needs in an entity for later retrieval.

scriptEvent void setKey( string key, string value );

// Retrieves the value of a specific spawn arg.

scriptEvent string getKey( string key );


I hope somebody else can give you more detailed, working info.
Good luck



bladeghost@Posted: Sat Nov 17, 2012 5:38 am :
from what I'm reading here is that your trying to shatter a func_fracture or something or at least make it break apart when triggered.
what you can try is putting a func_explosion by it and trigger that and then the func_fracture should break apart, thats one method.
I did this in my phantasm beyond D3 mod with a closet mirror as I needed it to shatter on cue , that's what I used and that worked well for what I needed, you didn't really describe how or what your func_fracture relates to but just trying to trigger a func_fracture directly won't work as you'll need something else to 'affect it and that will in essence trigger it. good luck with it.



heady89@Posted: Sat Nov 10, 2012 5:06 pm :
Hello folks,

Let me first say that every answer so far has been very helpful, and i appreciate your time.
I'm wondering how i can trigger a target_setkeyval to set the health of for example a func_fracture to 0.

Tried to set the keyval as health;0 and then have it target the actual func_fracture without success.
I'm not quite sure how the setkeyval works, i mean could i trigger it from a trigger_once so that i have control of when it occurs?

My second question relates more to scripting, could i perhaps just use a trigger_once that calls my script function and then somehow
set the health of a specific entity from my scriptfunction. If possible, how would that syntax look?

Kind regards,
heady



chimueloeldragon2011@Posted: Sat Nov 10, 2012 5:38 pm :
I'm not sure how exactly the key/val target works in the editor, but I don't know if you can actually, dynamically change spawnargs of an entity while running a game other than "hide" or some shaderparms/guiparms, (those are toggled on trigger events)

What I do know is that you can set a key/val for further use in script, which would look like this:

Code:
void setkey() {

   entity ent;
   ent = sys.getEntity("func_static_1");

   ent.setKey( "spawnarg_here", "0 or 1 or whatever number" );
}


That worked fine for me and does the job but it doesn't actually change the behaviour of the entity while in game.
Then you can later fetch the key value using "getKey"

Anyway, take a look at script/doom_events, that will help you a lot!

doom_events wrote:
// Sets a key on this entity's spawn args. Note that most spawn args are evaluated when
// this entity spawns in, so this will not change the entity's behavior in most cases.
// This is chiefly for saving data the script needs in an entity for later retrieval.

scriptEvent void setKey( string key, string value );

// Retrieves the value of a specific spawn arg.

scriptEvent string getKey( string key );


I hope somebody else can give you more detailed, working info.
Good luck



bladeghost@Posted: Sat Nov 17, 2012 5:38 am :
from what I'm reading here is that your trying to shatter a func_fracture or something or at least make it break apart when triggered.
what you can try is putting a func_explosion by it and trigger that and then the func_fracture should break apart, thats one method.
I did this in my phantasm beyond D3 mod with a closet mirror as I needed it to shatter on cue , that's what I used and that worked well for what I needed, you didn't really describe how or what your func_fracture relates to but just trying to trigger a func_fracture directly won't work as you'll need something else to 'affect it and that will in essence trigger it. good luck with it.