AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   removing entity members (https://forums.alliedmods.net/showthread.php?t=20268)

commonbullet 11-04-2005 23:05

removing entity members
 
I wonder if there's a way to remove an entity member
i.e. removing the "target" entry of a func_button
(not the same as setting target to a string like "").

thanks.

Hawk552 11-04-2005 23:10

You mean classname:

"info_target"

to

"info_"

? I don't get it.

XxAvalanchexX 11-04-2005 23:17

Code:
// assuming "ent" is your func_button  new target[32];  entity_get_string(ent,EV_SZ_target,target,31);  new tEnt = find_ent_by_tname(-1,target);  if(is_valid_ent(tEnt)) remove_entity(tEnt);

commonbullet 11-04-2005 23:40

I mean a property of a entity.
Let's take this example of a func_breakable.
These are some values of an entity recorded into the bsp file:
Code:

{
"model" "*54"
"explodemagnitude" "40"
"spawnobject" "0"
"explosion" "0"
"material" "6"
"health" "550"
"delay" "0"
"target" "spy_dev_destroyed"
"rendercolor" "0 0 0"
"renderamt" "0"
"classname" "func_breakable"
}

I know i can pick up or change these values with engine functions like
entity_get_string, entity_set_int, etc...
But I wonder if remove a property like "target", instead of setting it to an empty string...

XxAvalanchexX 11-05-2005 00:37

I don't think you can, Pawn has no NULL. When would you need to completely null it instead of having it as an empty string?

commonbullet 11-05-2005 07:55

doors for instance...
if a door has got any targetname reference, like targetname="";
this will cause it to be opened only with a external link, like buttons, etc.

I'll try to copy the entire entity members collection, remove the entity and then respawn it only with the desired properties.

commonbullet 11-05-2005 09:48

but I can't find some indexes correspondence in Engine constants.
i.e.,
what's is the key for "delay" property?
there's nothing like ENV_FL_delay...

Is there any reference somewhere in SDK?

commonbullet 11-05-2005 14:15

I'm sorry. Maybe I'm getting a little non-sense.
I'm too newbie...

The question is simpler:
How can I read the "delay" or "wait" property of a func_door?

XxAvalanchexX 11-05-2005 14:38

You'd have to do something like this...

Code:
public pfn_keyvalue(ent) {    new classname[32], keyname[32], keyvalue[32];    copy_keyvalue(classname,31,keyname,31,keyvalue,31);    if(equali(classname,"func_door") && equali(keyname,"wait")) {       entity_set_float(ent,EV_FL_fuser1,floatstr(keyvalue));    }    else if(equali(classname,"func_door") && equali(keyname,"delay")) {       entity_set_float(ent,EV_FL_fuser2,floatstr(keyvalue));    } }

This hooks keyvalues being set and then will store "wait" and "delay" in seperate containers within a func_door. Use EV_FL_fuser1 and EV_FL_fuser2 to retrieve them.

commonbullet 11-05-2005 17:39

Thank you. I'll try it.

How do these forwards work? I mean, when are these values being set?
Is there any reference to it?


All times are GMT -4. The time now is 23:40.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.