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
3 registered members (AndrewAMD, SBGuy, Petra), 801 guests, and 8 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
detect when player is in a specific room? #146917
08/09/07 13:48
08/09/07 13:48
Joined: Jun 2007
Posts: 28
D
Doriel Offline OP
Newbie
Doriel  Offline OP
Newbie
D

Joined: Jun 2007
Posts: 28
Hello Everyone,

I need to display a panel (and possibly execute some other functions) ONLY when the user is in a specific room. How do I detect that the user is in the boundaries of the room? And when the user leaves the room, how can I detect that?

Any ideas / advice is much appreciated!

Regards,

Doriel

Re: detect when player is in a specific room? [Re: Doriel] #146918
08/09/07 14:49
08/09/07 14:49
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Several ways.

One could be triggers, put a dummy object in the entrance / door of the room and assign an action / function to trigger the event when the player touches the objec.

Ex:

Code:

function my_event
{
if ( EVENT_TYPE == EVENT_ENTITY )&&( you == room1)
{
my._roomPos = 1;
// other functions
}
}



In player action put:

my.enable_entity = on;
my.event = my_event;

In rooms dummy action:

my.passable = on;
my.enable_entity = on;

Re: detect when player is in a specific room? [Re: demiGod] #146919
08/09/07 15:47
08/09/07 15:47
Joined: Jun 2007
Posts: 28
D
Doriel Offline OP
Newbie
Doriel  Offline OP
Newbie
D

Joined: Jun 2007
Posts: 28
I tried the whole passable object idea but couldn't get it working. I'll have to try it again now that I have some script to look at.

Thanks!

Re: detect when player is in a specific room? [Re: Doriel] #146920
08/09/07 18:31
08/09/07 18:31
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
You need to c_move your player in order to
trigger events.

Maybe try :
Code:

if (vec_dist(player.x,specific_room.x) < boundary)
{
// do something when player inside the room
} else {
// do somthing when player outside the room
}



Re: detect when player is in a specific room? [Re: vlau] #146921
08/09/07 22:26
08/09/07 22:26
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline
User
MrCode  Offline
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
maybe you could use c_content?


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: detect when player is in a specific room? [Re: demiGod] #146922
08/10/07 00:15
08/10/07 00:15
Joined: Jun 2007
Posts: 28
D
Doriel Offline OP
Newbie
Doriel  Offline OP
Newbie
D

Joined: Jun 2007
Posts: 28
I have just tried getting it to work using the passable object. It seems like it would work. The only problem is, when i'm walking through the object, i think it's going into SWIM mode? It makes a splashing sound and the player crouches? Something like that. Oh, and it doesn't trigger my function. When i turn off passable for the object, it triggers my function. Weird.

Any ideas? If not, I will have to try some of the other suggestions.

Regards,

Doriel

Re: detect when player is in a specific room? [Re: Doriel] #146923
08/10/07 02:47
08/10/07 02:47
Joined: Jul 2004
Posts: 21
K
Keebo Offline
Newbie
Keebo  Offline
Newbie
K

Joined: Jul 2004
Posts: 21
You could make it not passable and invisible and remove it just after triggering your function.

You could also compare the player's x, y, and z coordinates to the room coordinates and trigger your function when they coincide. I used that on several occasions back in A5.


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