Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP

Expert
Realspawn  Offline 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 laugh

here's what i have now

Code:
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 ?


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
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 Offline
Senior Expert
Pappenheimer  Offline
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: Pappenheimer] #411005
11/11/12 23:23
11/11/12 23:23
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
thx for your fast response i tried this and the ball stops bouncing but stays in the level. I need it to be fully removed laugh


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
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 Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
ah - sorry, forgot to add the ent_remove(me); after the while loop! tongue

After:
"
wait(1);
}
"

Last edited by Pappenheimer; 11/11/12 23:30.
Re: How to remove the mdl with it's action [Re: Pappenheimer] #411007
11/11/12 23:32
11/11/12 23:32
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
Yay thx man i make sure you get in the credits as this is part of my upcoming workshop. First i learn then the other noobs grinnnn

thx thx thx


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
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 Offline
Member
frankjiang  Offline
Member

Joined: Dec 2009
Posts: 128
China
you can set a var to control this.
Code:
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!

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1