Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, degenerate_762, ozgur), 1,311 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
impact with entity in order to change levels not working... #232755
10/23/08 17:52
10/23/08 17:52
Joined: Feb 2004
Posts: 71
Milky Way Galaxy...
JoeMama Offline OP
Junior Member
JoeMama  Offline OP
Junior Member

Joined: Feb 2004
Posts: 71
Milky Way Galaxy...
I have a code that is supposed to change the level to when I touch an entity. But when I go to touch the model I assigned the action to, nothing happens and it is as if the model is solid. Here is the code I am using. It is from the FPS tutorial by Grimber.

function level_change()
{
wait(1);
if (EVENT_TYPE == event_impact)
{
changeto_level = my.skill1;
my = NULL;
vec_set(temp_loc,player.x);
vec_set(temp_ang,player.pan);
camera.visible = off;
freeze_mode = 1;
if (changeto_level == 1)
{
changeto_level = 0;
level_load("Out.wmb");
}
if (changeto_level == 2)
{
changeto_level = 0;
level_load("B.wmb");
}
freeze_mode = 0;
wait(2);
vec_set(player.x,temp_loc);
vec_set(player.pan,temp_ang);
camera.visible = on;
}
}

ACTION levelchange //*assign this to a map entity blocking the way out of the level*/!!!!
{

MY.INVISIBLE = ON; //makes entitie invisible
MY.ENABLE_IMPACT = ON; //enables player impact
MY.EVENT = level_change; //function name

}


If death is only the beginning, then life must be the end... -me
Re: impact with entity in order to change levels not working... [Re: JoeMama] #233784
10/30/08 17:06
10/30/08 17:06
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Try this! I think events need actions not functions

Code:
ACTION level_change //i think this must be an action
{
wait(1);
if (EVENT_TYPE == event_impact)
{
changeto_level = my.skill1;
my = NULL;
vec_set(temp_loc,player.x);
vec_set(temp_ang,player.pan);
camera.visible = off;
freeze_mode = 1;
if (changeto_level == 1)
{ 
changeto_level = 0;
level_load("Out.wmb");
}
if (changeto_level == 2)
{
changeto_level = 0;
level_load("B.wmb");
}
freeze_mode = 0;
wait(2);
vec_set(player.x,temp_loc);
vec_set(player.pan,temp_ang);
camera.visible = on;
}
}

ACTION levelchange 
{
MY.INVISIBLE = ON; //makes entitie invisible
MY.ENABLE_IMPACT = ON; //enables player impact
MY.EVENT = level_change; //action name
}


Also i would change
Code:
IF (EVENT_TYPE==EVENT_IMPACT) {

to
Code:
IF (EVENT_TYPE==EVENT_IMPACT)&&(YOU!=NULL)&&(YOU==PLAYER) {

I use YOU!=NULL to avoid empty MY errors...but u dont need to.
Checks if the player "impacted" with entity, not a monster
or something. If u dont use player_walk (templates), add this to ure player code:
Code:
entity* player;
ACTION Player_Walk { //or whatever
...
..
PLAYER = ME;
}



Tip: Use BEEP to check if events are called.

Last edited by rayp; 10/30/08 17:23.

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;

Moderated by  HeelX, rvL_eXile 

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