Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, SBGuy, Petra, flink, 1 invisible), 699 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Kill function does not work #381162
08/24/11 18:59
08/24/11 18:59
Joined: Jul 2010
Posts: 974
United Arab Emirates, Dubai
TheShooter Offline OP
User
TheShooter  Offline OP
User

Joined: Jul 2010
Posts: 974
United Arab Emirates, Dubai
Hi,
I have some spikes. When the ball collides with them, the ball shall get removed. But it falls through the spikes.

Here my action code:

Code:
var abstand;
ENTITY* ent_piekser;

function kill()
{
	
	while(1)
	{
		abstand = vec_dist(ent_piekser, ent_ball);
		if(abstand = 0)
		{
			ent_remove(ent_ball);
			return;
		}
		wait(1);
	}
}



action piekser()
{
	ent_piekser = me;
	kill();
}



piekser = spikes.

abstand = distance

I included it in the main, and set the action in WED to the model.

Whats the problem here?

regards,
TheShooter

Last edited by TheShooter; 08/24/11 18:59.

Staub ist das neue Prime!!

Programming is like sex:
One mistake and you have to support it for the rest of your life.

Aktuelles Projekt: http://thisiswargame.bplaced.net/index.html

A8 Commercial *freu*
Re: Kill function does not work [Re: TheShooter] #381166
08/24/11 19:27
08/24/11 19:27
Joined: Mar 2009
Posts: 88
Walori Offline
Junior Member
Walori  Offline
Junior Member

Joined: Mar 2009
Posts: 88
Code:
if(abstand = 0)
		{
			ent_remove(ent_ball);
			return;
		}



Should be:
Code:
if(abstand == 0)
		{
			ent_remove(ent_ball);
			return;
		}



Re: Kill function does not work [Re: Walori] #381167
08/24/11 19:36
08/24/11 19:36
Joined: Jul 2010
Posts: 974
United Arab Emirates, Dubai
TheShooter Offline OP
User
TheShooter  Offline OP
User

Joined: Jul 2010
Posts: 974
United Arab Emirates, Dubai
Ok, thank you. But it does not solve the problem. But i think the problem is not the code. I i disable the action, the ball falls throught the spikes anyway.

But thank you for the tipp.


Staub ist das neue Prime!!

Programming is like sex:
One mistake and you have to support it for the rest of your life.

Aktuelles Projekt: http://thisiswargame.bplaced.net/index.html

A8 Commercial *freu*
Re: Kill function does not work [Re: TheShooter] #381169
08/24/11 19:48
08/24/11 19:48
Joined: Jul 2007
Posts: 16
F
Farodin Offline
Newbie
Farodin  Offline
Newbie
F

Joined: Jul 2007
Posts: 16
is the distance exactly 0? i would use the kill-function in an collision-event. then you didn´t have to compute the distance.

Re: Kill function does not work [Re: Farodin] #381170
08/24/11 20:07
08/24/11 20:07
Joined: Jan 2011
Posts: 797
Da wo du nicht bist! Muhahaha!
xxxxxxx Offline
User
xxxxxxx  Offline
User

Joined: Jan 2011
Posts: 797
Da wo du nicht bist! Muhahaha!
ent_piekser and ent_ball aren't vectors, use ent_ball.x!
BTW: Your script trys to remove the ball when it has the same position then the spikes(this will never happen).
xxxxxxx


Es ist immer wieder erstaunlich, dass Leute die riesen Scripte schreiben die einfachsten sachen nicht können zb. mich mit SIEBEN x zu schreiben! tongue
Re: Kill function does not work [Re: xxxxxxx] #381171
08/24/11 20:31
08/24/11 20:31
Joined: Jul 2010
Posts: 974
United Arab Emirates, Dubai
TheShooter Offline OP
User
TheShooter  Offline OP
User

Joined: Jul 2010
Posts: 974
United Arab Emirates, Dubai
Maybe I should use a collide detector. Becouse I have some "pieksers" above. And with that I'm a little bit flexiblier.
BTW:




Staub ist das neue Prime!!

Programming is like sex:
One mistake and you have to support it for the rest of your life.

Aktuelles Projekt: http://thisiswargame.bplaced.net/index.html

A8 Commercial *freu*
Re: Kill function does not work [Re: TheShooter] #381172
08/24/11 20:36
08/24/11 20:36
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Code:
action piekser()
{
	while(!ent_ball);
		wait(1);

	while(vec_dist(ent_piekser, ent_ball) > 0.01)
		wait(1);
	
        ent_remove(ent_ball);
}




Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com

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