Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, howardR), 1,001 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
collision with a specific entity #414781
01/07/13 15:45
01/07/13 15:45
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
ive managed to find out how to make something happen when any entity collides with an entity but how do i make only a specific entity react with another entity.
like for example i have a powerup that can only be collected by touching it with the player and not when you shoot it with another entity or enemy entities collide with it.

Re: collision with a specific entity [Re: Denn15] #414785
01/07/13 16:10
01/07/13 16:10
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Code:
#define id skill100
#define powerup 1

..
if (event_type == EVENT_ENTITY){ // fex
   if (you) if (you.id == powerup) _do_something();
}
..


and in the other model say
Code:
..
 my.id = powerup;
 ..



greets

Last edited by rayp; 01/07/13 16:11.

Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: collision with a specific entity [Re: rayp] #414832
01/08/13 18:12
01/08/13 18:12
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
ive tried it out with this script but nothing happens when they hit each other

Code:
#include <acknex.h>
#include <default.c>

#define id skill100
#define powerup 1

SOUND* sound = "gem.wav";
ENTITY* gem;
ENTITY* player_box;

function test()
{
	snd_play(sound,100,0);
}

action player_move()
{
	player_box = my;
	my.id = powerup;
	my.emask |= (ENABLE_IMPACT);
	while (1)
	{
		c_move(me, nullvector, vector((key_cuu-key_cud)*10*time_step, 0, (key_cur-key_cul)*10*time_step), GLIDE);
		wait (1);
	}
}

action gem_action()
{
	gem = my;
	my.emask |= (ENABLE_IMPACT);
	if (event_type == EVENT_IMPACT)
	{
		if (you) if (you.id== powerup) 
		{
			test();
		}
	}
}

function cam()
{
	while (1)
	{
		camera.x = - 300;
		camera.z =  450;
		camera.tilt = -30;
		wait (1);
	}
}

function main()
{
	level_load ("level.wmb");
	cam();
}


Re: collision with a specific entity [Re: Denn15] #414833
01/08/13 18:35
01/08/13 18:35
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
You should read about events.

Code:
..
 void _this_is_a_event(){
   if (event_type....
 }
 ..
 action bla...
 my.emask |= ENABLE_BLABLA
 my.event = _this_is_a_event; // note not ()



Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: collision with a specific entity [Re: rayp] #414862
01/09/13 14:46
01/09/13 14:46
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
sorry i didnt notice that i made that mistake. it works now laugh

Re: collision with a specific entity [Re: Denn15] #414865
01/09/13 14:55
01/09/13 14:55
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
No problem. We all make mistakes every day. Im glad it works now.
greets


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: collision with a specific entity [Re: rayp] #414935
01/10/13 18:06
01/10/13 18:06
Joined: Dec 2009
Posts: 82
D
Denn15 Offline OP
Junior Member
Denn15  Offline OP
Junior Member
D

Joined: Dec 2009
Posts: 82
one last question though. isnt it possible to use the entitys name instead of the id thingy? thst way it would be easier

Re: collision with a specific entity [Re: Denn15] #414939
01/10/13 19:07
01/10/13 19:07
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
use str_for_entfile or str_for_entname if you have the collider entity to get its filename or name in wed respectively.


Free world editor for 3D Gamestudio: MapBuilder Editor

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