|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
How to remove the mdl with it's action
#411003
11/11/12 22:52
11/11/12 22:52
|
Joined: Jul 2001
Posts: 4,801 netherlands
Realspawn
OP

Expert
|
OP

Expert
Joined: Jul 2001
Posts: 4,801
netherlands
|
i've been toying days with this aum code. The code i have works 100% the ball gets transported when it reaches a certain point. What i need is instead of the teleport the ball should be fully removed. i tried adding ent_remove(me); but then i get an error telling : invalid functions in ball_collide. I am prolly doing something stupid wrong but hey taking baby steps  here's what i have now
function ball_collides()
{
if (event_type == EVENT_ENTITY)
{
if (you.skill1 == 999)
{
you.skill1 = 0;
}
}
vec_to_angle(my.pan,bounce);
snd_play(bounce_wav,100,0);
my.pan += 20 - random(20);
my.tilt = 0;
}
ENTITY* kball;
action bouncing_ball()
{
VECTOR temp;
kball = me;
set(my,BRIGHT);
my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY); // make the entity sensitive to collisions with level blocks and entities
my.event = ball_collides;
while(1)
{
c_move(my, vector(25 * time_step, 0, 0),nullvector, NULL); // 10 gives the ball movement speed
vec_for_vertex(temp, my, 483); // generate particles from the 10th vertex of the entity
effect(my_effect, 1, temp.x, nullvector);
if(kball.x< -230)
{
ent_create("explo2+16.tga", vector(my.x,my.y,my.z), sprite_played);
kball.x=576;
kball.y= 0;
kball.z= -16;
lives_count -= 1;
}
wait (1);
}
}
what am i overlooking ?
|
|
|
Re: How to remove the mdl with it's action
[Re: Realspawn]
#411004
11/11/12 23:11
11/11/12 23:11
|
Joined: Sep 2003
Posts: 5,900 Bielefeld, Germany
Pappenheimer
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
|
replace the teleporting: kball.x=576; kball.y= 0; kball.z= -16; with my.event = NULL; break;
As often, I didn't test it...
Last edited by Pappenheimer; 11/11/12 23:11.
|
|
|
Re: How to remove the mdl with it's action
[Re: Realspawn]
#411006
11/11/12 23:28
11/11/12 23:28
|
Joined: Sep 2003
Posts: 5,900 Bielefeld, Germany
Pappenheimer
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
|
ah - sorry, forgot to add the ent_remove(me); after the while loop!  After: " wait(1); } "
Last edited by Pappenheimer; 11/11/12 23:30.
|
|
|
Re: How to remove the mdl with it's action
[Re: Realspawn]
#411008
11/12/12 02:20
11/12/12 02:20
|
Joined: Dec 2009
Posts: 128 China
frankjiang
Member
|
Member
Joined: Dec 2009
Posts: 128
China
|
you can set a var to control this.
function ball_collides()
{
if (event_type == EVENT_ENTITY)
{
if (you.skill1 == 999)
{
you.skill1 = 0;
}
}
vec_to_angle(my.pan,bounce);
snd_play(bounce_wav,100,0);
my.pan += 20 - random(20);
my.tilt = 0;
}
ENTITY* kball;
int statue = 1;
action bouncing_ball()
{
VECTOR temp;
kball = me;
set(my,BRIGHT);
my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY); // make the entity sensitive to collisions with level blocks and entities
my.event = ball_collides;
while(statue)
{
c_move(my, vector(25 * time_step, 0, 0),nullvector, NULL); // 10 gives the ball movement speed
vec_for_vertex(temp, my, 483); // generate particles from the 10th vertex of the entity
effect(my_effect, 1, temp.x, nullvector);
if(kball.x< -230)
{
ent_create("explo2+16.tga", vector(my.x,my.y,my.z), sprite_played);
kball.x=576;
kball.y= 0;
kball.z= -16;
lives_count -= 1;
}
wait (1);
}
// here, you can remove your ENTITY...
if(kball){
ptr_remove(kball);
}
}
void main(){
level_load(NULL);
statue = 1;
kball=ent_create("ball.mdl",vector(0,0,0),bouncing_ball);
wait(48);
//remove kball
statue = 0;
}
development 3d game is interesting!
|
|
|
|