oldyz
Well-known member
O Ilusionista
after running some experiments i found that the "terminate an entity" script disappears the entity & there is no item drop
but at least gave me some idea of a binding script that targets an entity by name
UPDATE:
Type 1
the parasytic entity will jump from the original possessor to another,
it might be useful for a game where a "spirit" jumps from one body to the next & with more modification it can even boost the health or other factors in the "possessed"
Type 2 - the Object remains with the entity that called it
how to use both scripts:
first
save those codes as bindobject00.c & bindobject01.c and put them i the scripts folder.
2nd
make sure to import them on whatever animationscript data/scripts/nameofchar.c
your entity has -
you open the nameofchar.c file & paste their paths this way:
#import "data/scripts/bindobject00.c"
3rd
you must give an alias for the entity in question for it to be called in the level.txt file:
4th
characters entities can get a hold of it after an animation frame like this:
a bind tool: https://www.mediafire.com/file/9bfh7wqlzvk30il/spawnbind_tool.ods/file
after running some experiments i found that the "terminate an entity" script disappears the entity & there is no item drop
but at least gave me some idea of a binding script that targets an entity by name
UPDATE:
Type 1
the parasytic entity will jump from the original possessor to another,
it might be useful for a game where a "spirit" jumps from one body to the next & with more modification it can even boost the health or other factors in the "possessed"
Code:
void bindobject00(char target_name, float dx, float dy, float dz, int Dir, int Flag)
{// bind any entity on the screen by the given name
//Douglas Baldan - 11.27.2016 - Really thanks for the fix, White Dragon
// Thanks Lagarto
//i pity the fool who don't use it like this: //@cmd bindobject00 "aliasofentity" 1 2 5 1//
//see bindentity in manual for the number meanings
void self = getlocalvar("self");
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);
bindentity(ent, self, dx, dz, dy, Dir, Flag);
continue;
}
} else continue;
}
return;
}
}
Type 2 - the Object remains with the entity that called it
Code:
void bindobject01(char target_name, float dx, float dy, float dz, int Dir, int Flag)
{// bind any entity on the screen by the given name
//Douglas Baldan - 11.27.2016 - Really thanks for the fix, White Dragon
// Thanks Lagarto
//i pity the fool who don't use it like this: //@cmd bindobject01 "aliasofentity" 1 2 5 1//
//see bindentity in manual for the number meanings
void self = getlocalvar("self");
int i;
for (i = 0; i < openborvariant("count_entities"); ++i)
{
void ent = getentity(i);
if ( getentityproperty(ent, "exists") )
{
if ( getentityproperty(ent,"name") == target_name)
{
changeentityproperty(ent, "name", "melunchbox");// ----changes the alias so no other clone char can grab it
//killentity(ent);
bindentity(ent, self, dx, dz, dy, Dir, Flag);
continue;
}
} else continue;
}
return;
}
how to use both scripts:
first
save those codes as bindobject00.c & bindobject01.c and put them i the scripts folder.
2nd
make sure to import them on whatever animationscript data/scripts/nameofchar.c
your entity has -
you open the nameofchar.c file & paste their paths this way:
#import "data/scripts/bindobject00.c"
3rd
you must give an alias for the entity in question for it to be called in the level.txt file:
Code:
spawn lunchbox
alias lvl8lunchbox
item broodwich
coords 35 200
at 0
4th
characters entities can get a hold of it after an animation frame like this:
Code:
anim spawn
@script
if(frame == 0){
void self = getlocalvar("self");
int map = rand()%2;
if(map < 0)
{
-map == map;
}
changeentityproperty(self, "map", map);
}
@end_script
delay 100 ########################
offset 73 133 ######################
bbox 0 0 0 0
frame data/chars/mutant2/01
@cmd bindobject01 "lvl8lunchbox" 1 2 5 1
frame data/chars/mutant2/02
a bind tool: https://www.mediafire.com/file/9bfh7wqlzvk30il/spawnbind_tool.ods/file