|
make entity remove after reaching end path :)
#454141
08/29/15 22:39
08/29/15 22:39
|
Joined: Jul 2001
Posts: 4,801 netherlands
Realspawn
OP
Expert
|
OP
Expert
Joined: Jul 2001
Posts: 4,801
netherlands
|
this is what i use now :
action moveontrack_01()
{
var walk_percentage;
var walking_speed = 0.3;
VECTOR last_pos[3];
VECTOR direction[3];
var distance = 0;
var dist_to_node;
var current_node = 1;
set(my,SHADOW|PASSABLE);
path_set(me, "path_000");
while(1)
{
ent_animate(my, "run", walk_percentage, ANM_CYCLE); // play the "walk" animation
walk_percentage += 6 * time_step; // "3" controls the animation speed
path_spline(me, my.x, distance);
distance += walking_speed ;
vec_diff(direction, my.x, last_pos);
vec_to_angle(my.pan, direction);
vec_set(last_pos, my.x);
wait(1);
}
now it keeps cycling :) how to remove it when it comes to the last point of the path ? :)
thx for your time and help :)
}
|
|
|
Re: make entity remove after reaching end path :)
[Re: Realspawn]
#454145
08/29/15 23:39
08/29/15 23:39
|
Malice
Unregistered
|
Malice
Unregistered
|
action car(){
track_select=random(2);; // GLOBlE NOTICE
//if(track_select >2)
//track_select = 1;
if(integer( track_select) ==0)
path_set(my,"path_000");
if(integer( track_select) ==1)
path_set(my,"path_001");
/////////////////////////////////////////////////////////////////////
my.NODE_NEXT=path_nextnode(my,1,1); // SET THE NODE
while(1)
{
// PATH NODE DETECTION AND RANDOMIZATION AND FACING //////////////////////////////////
if(vec_dist(my.x,vec_next_node.x) < my.max_x)
{
// HERE you have to adjust the code REALSPAWN
if(my.NEXT_NODE == 10) // replace 10 with the number for the last node, inside the cheese
ent_remove(me);
//path_next(my); // will jump from current path to new path// Jump to new path
my.NODE_NEXT=path_nextnode(my,my.NODE_NEXT,1); // Grab Next node on new path -- NOTE ALL PATHS MUST HAVE THE SAME NUM NODE IN SAME GEN LOCATION
}
path_getnode(my,my.NODE_NEXT,vec_next_node,NULL); // Get next node actual vector location
vec_to_angle(my.pan,vec_diff(NULL,vec_next_node,my.x)); // face the new node
///////////////////////////////////////////////////////////////////////////
// SOFT AND HARD MOVEMENTs /////////////////////////////////////////////////////////////
c_move(my,vector(my.skill3*time_step,0,0),nullvector,GLIDE | IGNORE_PASSABLE);
wait(1);
}
}
test and play with this. This does seem to work but the ent_remove will cause a crash.
Last edited by Malice; 08/29/15 23:42.
|
|
|
Re: make entity remove after reaching end path :)
[Re: JcI_the_second]
#454148
08/29/15 23:52
08/29/15 23:52
|
Malice
Unregistered
|
Malice
Unregistered
|
you are correct or move the ent_remove out the loop. I was just telling spawn because he knows i uninstalled 3dgs and would not be testing this when he ask me to make the hacks
|
|
|
|