O Ilusionista
Captain 80K
If you need to ternimate an entity, for whatever reason, you can use this script:
Usage:
@cmd terminate "Max"
Just keep in mind that script is arbitrary: It will look for all models that have that name and finish ALL of them at once, not just one.
So, if you have two entities called "burnknuc" but you wanted to terminate just one of them, the script won't work - it will remove them all, as it looks for all models with that name, not just one, and ignores any alias you have given to them.
When I created this script, the idea was to eliminate entities that had somehow gotten stuck somewhere. You can use it for this, just keep in mind that it works by brute force and will affect all entities present in the game.
I have a series of scripts that manipulate entities, for different purposes and that vary in the degree of arbitrary: some check by name, animation, remaining life, etc. Others don't.
For example, this is a variation of the same script, but it will only work with entities that have the same "alias" that you provide:
Therefore, if you have two entities named "joe" but one of them you gave the alias "max", the script will terminate only the one named "max" if you tell it to do it:
@cmd terminateAlias "Max"
And another thing to be aware of: scripts are case sensitive.
If you ask the script to end an entity called "Max", it will not work if its alias is "max", "MAX", etc.
Thanks White Dragon for the help on the original topic.
C-like:
void terminate(char target_name)
{// kill any entity on the screen by the given name
//Douglas Baldan - 11.27.2016 - Really thanks for the fix, White Dragon
// Thanks Lagarto
int i;
for (i = 0; i < openborvariant("count_entities"); ++i)
{
void ent = getentity(i);
if ( getentityproperty(ent, "exists") )
{
if ( getentityproperty(ent,"model") == target_name)
{
killentity(ent);
continue;
}
} else continue;
}
return;
}
Usage:
@cmd terminate "Max"
Just keep in mind that script is arbitrary: It will look for all models that have that name and finish ALL of them at once, not just one.
So, if you have two entities called "burnknuc" but you wanted to terminate just one of them, the script won't work - it will remove them all, as it looks for all models with that name, not just one, and ignores any alias you have given to them.
When I created this script, the idea was to eliminate entities that had somehow gotten stuck somewhere. You can use it for this, just keep in mind that it works by brute force and will affect all entities present in the game.
I have a series of scripts that manipulate entities, for different purposes and that vary in the degree of arbitrary: some check by name, animation, remaining life, etc. Others don't.
For example, this is a variation of the same script, but it will only work with entities that have the same "alias" that you provide:
C-like:
void terminateAlias(char target_name)
{// kill any entity on the screen by the given name
//Douglas Baldan - 2021.06.17 - Really thanks for the fix, White Dragon
// Thanks Lagarto
int i;
for (i = 0; i < openborvariant("count_entities"); ++i)
{
void ent = getentity(i);
if ( getentityproperty(ent, "exists") )
{
if ( getentityproperty(ent,"name") == target_name)
{
killentity(ent);
continue;
}
} else continue;
}
return;
}
Therefore, if you have two entities named "joe" but one of them you gave the alias "max", the script will terminate only the one named "max" if you tell it to do it:
@cmd terminateAlias "Max"
And another thing to be aware of: scripts are case sensitive.
If you ask the script to end an entity called "Max", it will not work if its alias is "max", "MAX", etc.
Thanks White Dragon for the help on the original topic.
Last edited: