DJGameFreakTheIguana
Active member
I did, I posted the screenshots of it above.
x)
x)
void main(){
int player = getlocalvar("player");
void self = getplayerproperty(player, "ent");
{
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"), 1);
}
}
name MiBoard
type NPC
subtype follow
#alpha 1
nolife 1
#nomove 1
facing 1
setlayer 1
gfxshadow 1
palette data/chars/Mikey/Pal
#animationscript data/scripts/script.c
#animationscript data/scripts/Map.c
anim idle
loop 1
delay 3
offset 151 150
@cmd changeentityproperty getlocalvar("self") "Subject_to_Gravity" 0
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard1.gif
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard2.gif
anim Walk
loop 1
delay 3
offset 151 150
@cmd changeentityproperty getlocalvar("self") "Subject_to_Gravity" 0
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard1.gif
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard2.gif
anim Spawn
@script
void self = getlocalvar("self");
if( frame == 1){
int r = rand()%100;
if( r > 11){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
} else if( r < 0){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
}
}
@end_script
loop 1
delay 1
offset 151 150
#spawnframe 0 0 0 1 0
#custentity MiBoard
#@cmd spawn01 "MiBoard" 0 0 0
frame data/chars/Mikey/Idle1.gif
frame data/chars/Mikey/Idle1.gif
frame data/chars/Mikey/Idle1.gif
anim FOLLOW1
loop 0
delay 1
offset 151 150
#spawnframe 0 0 0 1 0
#custentity MiBoard
#@cmd spawn01 "MiBoard" 0 0 0
@cmd spawnbind2 "MiBoard" 0 0 0 1 0
frame data/chars/Mikey/Idle1.gif
frame data/chars/Mikey/Idle1.gif
anim FOLLOW2
loop 0
delay 1
offset 151 150
#spawnframe 0 0 0 1 0
#custentity MiBoard
#@cmd spawn01 "MiBoard" 0 0 0
@cmd spawnbind2 "MiBoard" 0 0 0 1 0
frame data/chars/Mikey/Idle1.gif
frame data/chars/Mikey/Idle1.gif
void anichange(void Ani, int Frame)
{// Animation changer
void self = getlocalvar("self");
changeentityproperty(self, "animation", openborconstant(Ani), 2); //Change the animation
updateframe(self, Frame);
}
name MiBoard
type none
subtype follow
#alpha 1
nolife 1
#nomove 1
facing 1
setlayer 1
gfxshadow 1
subject_to_gravity 1
no_adjust_base 0
palette data/chars/Mikey/Pal
ondrawscript data/scripts/board_script.c
onspawnscript data/scripts/board_spawn_script.c
anim idle
@script
void self = getlocalvar("self");
int frame = getlocalvar("frame");
if ( frame == 0 ) {
void subent;
clearspawnentry();
setspawnentry("name","surf_shadow");
subent = spawn();
changeentityproperty(subent,"parent",self);
changeentityproperty(subent,"setlayer",getentityproperty(self,"setlayer")-2);
bindentity(subent,self,0,0,0,1,0);
}
@end_script
loop 1 1 2
delay 3
offset 151 150
#@cmd changeentityproperty getlocalvar("self") "Subject_to_Gravity" 0
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard1.gif
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard2.gif
frame data/chars/Mikey/SBoard0.gif
anim Walk
loop 1
delay 3
offset 151 150
#@cmd changeentityproperty getlocalvar("self") "Subject_to_Gravity" 0
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard1.gif
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard2.gif
#include "data/scripts/defines.h"
#import "data/scripts/lib.c"
#import "data/scripts/player_check_entities.c"
#import "data/scripts/wave.c"
#import "data/scripts/stairs.c"
// ENTITYVARS: "scene"
void main() {
void self = getlocalvar("self");
void parent = getentityproperty(self,"parent");
/*if ( getentityproperty(parent,"exists") ) {
//if ( getentityproperty(parent,"no_adjust_base") && !is_on_base(parent) ) {
if ( !is_on_base(parent) ) {
wave_flag = check_wave_ents(self);
}
}*/
check_entities(self);
if ( getentityvar(self,"scene") != 1 ) {
check_altitude(self,parent);
check_position(self,parent);
}
check_existence(self,parent);
setlocalvar("wave_is_on_board_flag",NULL());
setlocalvar("stair_is_on_board_flag",NULL());
//drawstring(0,100,0,"esisto!");
}
int check_existence(void self, void parent) {
if ( !getentityproperty(parent,"exists") && getlocalvar("candie") != NULL() ) {
bindentity(self,NULL());
killentity(self);
} else {
setlocalvar("candie",1);
}
}
int check_position(void self, void parent) {
if ( getentityproperty(parent,"exists") ) {
float x = getentityproperty(self,"x");
float z = getentityproperty(self,"z");
float a = getentityproperty(self,"y");
float base = getentityproperty(self,"base");
int dir = getentityproperty(self,"direction");
float px = getentityvar(parent,"x");
float pz = getentityvar(parent,"z");
float pa = getentityvar(parent,"y");
float pbase = getentityvar(parent,"base");
float pxdir = getentityproperty(parent,"xdir");
float pzdir = getentityproperty(parent,"zdir");
float ptossv = getentityproperty(parent,"tossv");
int pdir = getentityvar(parent,"direction");
int p_ent_type = getentityproperty(parent,"type");
char defaultmodel = getentityproperty(self,"defaultmodel");
float scr_posy = openborvariant("ypos");
int wave_flag = getlocalvar("wave_is_on_board_flag");
int stair_flag = getlocalvar("stair_is_on_board_flag");
float xshift = 0, zshift = 0, new_dir = 0;
// zshift = -2 or 0 but sorid < parent
if ( px == NULL() ) px = getentityproperty(parent, "x");
if ( pz == NULL() ) pz = getentityproperty(parent, "z");
if ( pa == NULL() ) pa = getentityproperty(parent, "y");
if ( pbase == NULL() ) pbase = getentityproperty(parent, "base");
if ( pdir == NULL() ) pdir = getentityproperty(parent, "direction");
if ( p_ent_type == openborconstant("TYPE_PLAYER") ) {
new_dir = 1;
} else if ( p_ent_type == openborconstant("TYPE_ENEMY") ) {
new_dir = 0;
}
if ( defaultmodel == "surf" ) {
xshift = 5;
if ( !dir ) xshift *= 1;
//zshift = 20;
} else if ( defaultmodel == "esurf" ) {
xshift = 0;
if ( !dir ) xshift *= 1;
//zshift = 18;
} else if ( defaultmodel == "skate" ) {
xshift = 2;
if ( !dir ) xshift *= 1;
//zshift = 10;
} else if ( defaultmodel == "eskate" ) {
xshift = -1;
if ( !dir ) xshift *= 1;
//zshift = 10;
} else if ( defaultmodel == "ufo" ) {
xshift = 5;
if ( !dir ) xshift *= 1;
//zshift = 20;
} else if ( defaultmodel == "eufo" ) {
if ( !dir ) xshift = -2;
else xshift = 1;
//zshift = 20;
} else if ( defaultmodel == "snow" ) {
xshift = 5;
if ( !dir ) xshift *= 1;
//zshift = 20;
} else if ( defaultmodel == "esnow" ) {
if ( !dir ) xshift = -2;
else xshift = 1;
//zshift = 20;
}
//drawstring( 10,50,0,"Var (board x): "+px );
//drawstring( 10,60,0,"Var (board z): "+pz );
//drawstring( 10,60,0,"Var: "+getentityproperty(self,"speed") );
//bindentity(self,parent,xshift,zshift,-1*(pa-pbase),0,0);
//bindentity(self,NULL());
/*float threshold = 0.001, inc = 1;
float decimal_px, decimal_pz;
decimal_px = px-trunc(px);
decimal_pz = pz-trunc(pz);
if ( decimal_px >= threshold ) {
if ( !pdir ) inc *= -1;
px = px + inc;
} else px = px;
if ( decimal_pz >= threshold ) {
if ( getentityproperty(parent,"zdir") < 0 ) inc *= -1;
pz = pz + inc;
} else pz = pz;*/
//if ( glv("aaa") == NULL() ) {
//if ( pzdir == 0 ) zshift = -1;
changeentityproperty(self,"position",px+xshift,pz+zshift,NULL()); // pbase
//slv("aaa",1);
//}
//changeentityproperty(self,"speed",getentityproperty(parent,"speed"));
//changeentityproperty(self,"aiflag","running","speed",getentityproperty(parent,"aiflag","running","speed"));
changeentityproperty(self,"velocity",pxdir/2,pzdir/2,NULL());
if ( (wave_flag == NULL() || wave_flag == 0) && (stair_flag == NULL() || stair_flag == 0) ) {
if ( pa <= pbase ) {
changeentityproperty(self,"no_adjust_base",1);
} else {
if ( getentityproperty(self,"no_adjust_base") == 1 ) changeentityproperty(self,"no_adjust_base",0);
}
}
if ( pa <= pbase && ptossv == 0 ) {
changeentityproperty(self,"base",pbase);
changeentityproperty(self,"position",NULL(),NULL(),pbase);
}
if ( is_on_base(parent) && base != pbase && ptossv == 0 ) {
changeentityproperty(self,"base",pbase);
}
if ( dir != new_dir ) changeentityproperty(self,"direction",new_dir);
}
}
int check_altitude(void self, void parent) {
if ( getentityproperty(parent,"exists") ) {
float x = getentityproperty(self,"x");
float z = getentityproperty(self,"z");
float a = getentityproperty(self,"y");
float base = getentityproperty(self,"base");
float px = getentityproperty(parent,"x");
float pz = getentityproperty(parent,"z");
float pa = getentityproperty(parent,"y");
float pbase = getentityproperty(parent,"base");
if ( pa < a ) {
changeentityproperty(self,"position",NULL(),NULL(),pa);
changeentityproperty(self,"base",pbase);
}
}
}
int check_entities(void self) {
int i = 0;
int stair_found_flag = 0, stair_is_on = 0, tmp_stair_is_on = 0;
int wave_found_flag = 0, wave_is_on = 0;
void parent = getentityproperty(self,"parent");
if ( getglobalvar("in_menu") != 1 && openborvariant("in_level") ) { // Waiting, Select
if ( getlevelproperty("type") != 2 ) {
check_interact_entities(self);
for (i = 0; i < get_interact_ent_size(); ++i) { // openborvariant("count_entities") --- openborconstant("MAX_ENTS")
void ent = get_interact_ent(i);
if ( getentityproperty(ent, "exists") ) {
int type = getentityproperty(self,"type");
char ent_type = getentityvar(ent, "type");
/// WAVE ///
if ( getentityproperty(parent,"exists") ) {
if ( !is_on_base(parent) ) {
if ( ent_type == "wave_r" || ent_type == "wave_l" || ent_type == "wave_c" ) {
wave_found_flag = 1;
if ( !wave_is_on || wave_is_on == 2 ) {
wave_is_on = check_wave(self, ent);
setlocalvar("wave_is_on_board_flag",wave_is_on);
}
//if (wave_is_on == 1) break;
} // fine if wave
}
}
/// STAIR ///
if ( ent_type == "stair_r" || ent_type == "stair_l" || ent_type == "stair_q" ) {
stair_found_flag = 1;
if ( !stair_is_on || stair_is_on == 2 ) {
tmp_stair_is_on = check_side_stairs(self, ent);
if ( tmp_stair_is_on ) { stair_is_on = tmp_stair_is_on; setlocalvar("stair_is_on_board_flag",stair_is_on); }
}
//if (stair_is_on == 1) break;
} else if ( ent_type == "stair_c" ) {
stair_found_flag = 1;
if ( !stair_is_on || stair_is_on == 2 ) {
tmp_stair_is_on = check_frontal_stairs(self, ent);
if ( tmp_stair_is_on ) { stair_is_on = tmp_stair_is_on; setlocalvar("stair_is_on_board_flag",stair_is_on); }
}
//if (stair_is_on == 1) break;
} // fine if stair
} // fine if exists
} // fine for all_ents
/// WAVE ///
if ( !wave_found_flag || wave_is_on <= 0 ) {
reset_wave(self);
setlocalvar("wave_is_on_board_flag",NULL());
}
/// STAIR ///
if ( !stair_found_flag || stair_is_on <= 0 ) {
reset_stairs(self);
setlocalvar("stair_is_on_board_flag",NULL());
}
}
}
}
#include "data/scripts/defines.h"
#import "data/scripts/lib.c"
void main() {
void self = getlocalvar("self");
if ( !gep(self,"no_adjust_base") ) cep(self,"no_adjust_base",1);
spawn_dust(self);
}
int spawn_dust(void self) {
float x = gep(self,"x");
float z = gep(self,"z");
float y = gep(self,"y");
float base = gep(self,"base");
int dir = gep(self,"direction");
char defaultmodel = gep(self,"defaultmodel");
char dust_name = "board_dust";
void ent;
if ( defaultmodel == "surf" ) {
} else if ( defaultmodel == "esurf" ) {
} else if ( defaultmodel == "skate" ) {
} else if ( defaultmodel == "eskate" ) {
} else if ( defaultmodel == "ufo" ) {
} else if ( defaultmodel == "eufo" ) {
} else if ( defaultmodel == "snow" ) {
float xshift = 36;
if ( !dir ) xshift *= -1;
//ent = spawnsubentity_relative(dust_name,0,-2,0,self);
ent = spawnsubentity_parent(dust_name,x,z-1,y,self);
bindentity(ent,self,xshift,-1,0,-1,0);
cep(ent,"map",3);
//cep(ent,"direction",dir);
} else if ( defaultmodel == "esnow" ) {
float xshift = 36;
if ( !dir ) xshift *= -1;
//ent = spawnsubentity_relative(dust_name,0,-2,0,self);
ent = spawnsubentity_parent(dust_name,x,z-1,y,self);
bindentity(ent,self,xshift,-1,0,-1,0);
cep(ent,"map",3);
//cep(ent,"direction",dir);
}
}
Script compile error: can't find function 'is_on_base'
Script compile error in 'ondrawscript': is_on_base line 149, column 13
name Board
type none
gfxshadow 1
anim idle
@script
void self = getlocalvar("self");
void Parent = getentityproperty(self, "parent");
if(Parent!=NULL()){
float Tx = getentityproperty(Parent,"x");
float Tz = getentityproperty(Parent,"z");
float Health = getentityproperty(Parent,"health");
if(Health>0){
changeentityproperty(self, "position", Tx, Tz);
} else {
killentity(self);
}
}
@end_script
loop 1
delay 1
offset 45 11
frame data/chars/misc/board.gif
frame data/chars/misc/board.gif
anim spawn
delay 8
offset 27 48
seta 40
frame data/chars/knbot/knbot2.png
@cmd spawner "Board" 0 -40 0
frame data/chars/knbot/knbot3.png
void spawner(void Name, float dx, float dy, float dz)
{ // Spawn certain entity and set it as child
void self = getlocalvar("self");
void Spawn;
Spawn = spawn01(Name, dx, dy, dz);
changeentityproperty(Spawn, "parent", self);
}
void spawn01(void vName, float fX, float fY, float fZ)
{
//spawn01 (Generic spawner)
//Damon Vaughn Caskey
//07/06/2007
//
//Spawns entity next to caller.
//
//vName: Model name of entity to be spawned in.
//fX: X location adjustment.
//fY: Y location adjustment.
//fZ: Z location adjustment.
void self = getlocalvar("self"); //Get calling entity.
void vSpawn; //Spawn object.
int iDirection = getentityproperty(self, "direction");
clearspawnentry(); //Clear current spawn entry.
setspawnentry("name", vName); //Acquire spawn entity by name.
if (iDirection == 0){ //Is entity facing left?
fX = -fX; //Reverse X direction to match facing.
}
fX = fX + getentityproperty(self, "x"); //Get X location and add adjustment.
fY = fY + getentityproperty(self, "a"); //Get Y location and add adjustment.
fZ = fZ + getentityproperty(self, "z"); //Get Z location and add adjustment.
vSpawn = spawn(); //Spawn in entity.
changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
return vSpawn; //Return spawn.
}
anim FOLLOW1
loop 0
delay 1
offset 151 150
#spawnframe 0 0 0 1 0
#custentity MiBoard
#@cmd spawn01 "MiBoard" 0 0 0
#@cmd spawnbind2 "MiBoard" 0 0 0 1 0
@cmd spawner "MiBoard" 0 0 0
frame data/chars/Mikey/Idle1.gif
frame data/chars/Mikey/Idle1.gif
anim FOLLOW2
loop 0
delay 1
offset 151 150
#spawnframe 0 0 0 1 0
#custentity MiBoard
#@cmd spawn01 "MiBoard" 0 0 0
#@cmd spawnbind2 "MiBoard" 0 0 0 1 0
@cmd spawner "MiBoard" 0 0 0
frame data/chars/Mikey/Idle1.gif
frame data/chars/Mikey/Idle1.gif
name MiBoard
type none
subtype follow
#alpha 1
nolife 1
#nomove 1
facing 1
setlayer 1
gfxshadow 1
#subject_to_gravity 1
#no_adjust_base 0
palette data/chars/Mikey/Pal
animationscript data/scripts/script.c
#animationscript data/scripts/Map.c
#ondrawscript data/scripts/board_script.c
#onspawnscript data/scripts/board_spawn_script.c
anim idle
@script
void self = getlocalvar("self");
void Parent = getentityproperty(self, "parent");
if(Parent!=NULL()){
float Tx = getentityproperty(Parent,"x");
float Tz = getentityproperty(Parent,"z");
float Health = getentityproperty(Parent,"health");
if(Health>0){
changeentityproperty(self, "position", Tx, Tz);
} else {
killentity(self);
}
}
@end_script
loop 1
delay 3
offset 151 150
#@cmd changeentityproperty getlocalvar("self") "Subject_to_Gravity" 0
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard1.gif
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard2.gif
anim FOLLOW1
delay 1
offset 151 150
frame data/chars/Mikey/Idle1.gif
@cmd spawner "MiBoard" 0 0 0
frame data/chars/Mikey/Idle1.gif
anim FOLLOW2
delay 1
offset 151 150
frame data/chars/Mikey/Idle1.gif
@cmd spawner "MiBoard" 0 0 0
frame data/chars/Mikey/Idle1.gif

name MiBoard
type none
setlayer 1
gfxshadow 1
palette data/chars/Mikey/Pal
anim idle
@script
void self = getlocalvar("self");
void Parent = getentityproperty(self, "parent");
if(Parent!=NULL()){
float Tx = getentityproperty(Parent,"x");
float Tz = getentityproperty(Parent,"z");
float Health = getentityproperty(Parent,"health");
if(Health>0){
changeentityproperty(self, "position", Tx, Tz);
} else {
killentity(self);
}
}
@end_script
loop 1
delay 3
offset 151 150
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard1.gif
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard2.gif
anim idle
@script
void self = getlocalvar("self");
void Parent = getentityproperty(self, "parent");
if(Parent!=NULL()){
float Tx = getentityproperty(Parent,"x");
float Tz = getentityproperty(Parent,"z");
float Health = getentityproperty(Parent,"health");
if(Health>0){
changeentityproperty(self, "position", Tx, Tz);
} else {
killentity(self);
}
}
@end_script
loop 1
delay 1
offset 151 150
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard1.gif
frame data/chars/Mikey/SBoard1.gif
frame data/chars/Mikey/SBoard1.gif
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard0.gif
frame data/chars/Mikey/SBoard2.gif
frame data/chars/Mikey/SBoard2.gif
frame data/chars/Mikey/SBoard2.gif
Is there a way to delay spawning? They would be spawned at the same "at #", but have them spawn one after the other rather then all of them at once
spawn trap
@script
void main()
{
void self = getlocalvar("self");
performattack(self, openborconstant("ANI_FOLLOW1"));
}
@end_script
coords 400 225
at 0
anim spawn
@script
if(frame==2){
void self = getlocalvar("self");
void Delay = getentityvar(self, 2);
if(Delay > 0){
setentityvar(self, 2, Delay-1);
updateframe(self, 0);
}
}
@end_script
delay 10
offset 1 1
frame data/chars/misc/empty.gif
delay 100
frame data/chars/misc/empty.gif
delay 1
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
spawn Flobber
@script
void main()
{
void self = getlocalvar("self");
setentityvar(self, 1, 10);
setentityvar(self, 2, 5);
}
@end_script
health 10
flip 1
coords 320 464 200
at 0

anim spawn
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
getlocalvar("Player1_Entity")
If Sonic - performattack("ANI_FOLLOW1")
if Knuckles - performattack("ANI_FOLLOW2")
getlocalvar("Player2_Entity")// "If Player 1 isn't detected"
If Sonic - performattack("ANI_FOLLOW1")
if Knuckles - performattack("ANI_FOLLOW2")
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
anim FOLLOW1
frame data/chars/misc/Sonictxt.gif
getlocalvar("Player2_Entity")
If Sonic - performattack("ANI_FOLLOW101")
if Knuckles - performattack("ANI_FOLLOW102")
getlocalvar("Player3_Entity")// "If Player 2 isn't detected"
If Shadow - performattack("ANI_FOLLOW101")
if Razor - performattack("ANI_FOLLOW102")
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif