Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by dr_panther. 05/18/24 11:01
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
2 registered members (7th_zorro, dr_panther), 724 guests, and 3 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
Problem with Mario Kart-like respawn code #442885
07/05/14 11:11
07/05/14 11:11
Joined: Jun 2014
Posts: 97
Lagos, Nigeria
T
tolu619 Offline OP
Junior Member
tolu619  Offline OP
Junior Member
T

Joined: Jun 2014
Posts: 97
Lagos, Nigeria
My game has a lot of 3D platforming sections. When the player falls off the path into an abyss, I want him to respawn at the nearest checkpoint (checkpoints aren't visible). I don't want to check whether player.z has dropped below a certain height because I'll need to use the respawn function in some other instances. For example, when a flying character starts to fly off into the distance away from the path, he should also respawn at the nearest check point. So I decided to use invisible walls that trigger the respawn function on collision. I'm certain I'm not doing the collision event right because my invisible walls are showing absolutely no sign of collision at all.
Code:
//THIS IS ATTACHED TO INVISIBLE WALLS/FLOORS
action RespawnFallenMonSurface()
{
	my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_PUSH); 
	my.event = RespawnFallenMon;	
}

//YOU CAN SEE I'VE ENDED UP COMMENTING OUT MOST OF THE FUNCTION. JUST TRYING TO GET IT TO SHOW ANY SIGN THAT IT DETECTED A COLLISION
function RespawnFallenMon()
{
	if(event_type == EVENT_ENTITY)
	{
		beep();
	    printf("Touchdown!");
	}
//	beep();
//	printf("Touchdown!");
//	if(your.skill45 != 5555) //not a monster
//	{beep(); wait(-1); return;}
	
//	var test = 0;
//	wait(1); //avoid engine errors
//	if(test == 0)
//	printf("Touchdown!");
	
//	test = 1;
//	vec_set(vector(your.x,your.y,your.z), LastSolidGround);
}



Do I need to add the following line to my player action? It seems to make absolutely no difference at all.
Code:
my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_PUSH);


Also, if the invisible floor is already in contact with level structures such as terrain or pillars, will it affect its detection of collision with the player?

Re: Problem with Mario Kart-like respawn code [Re: tolu619] #442887
07/05/14 11:20
07/05/14 11:20
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Are your walls moving? Otherwise you can set POLYGON flag for them so they have better collision. Tapping f11 twice with #include <default.c> included will allow you to check collision. Also where do you set the invisible flag for the wall? One more thing, you are not using WED invisible blocks for your walls right , but just models right? Cause for when you want to make WED blocks invisible but still have collision you will have to set their surfaces to not shaded (instead of marking the invisible flag for them).

Re: Problem with Mario Kart-like respawn code [Re: Reconnoiter] #442890
07/05/14 12:10
07/05/14 12:10
Joined: Jun 2014
Posts: 97
Lagos, Nigeria
T
tolu619 Offline OP
Junior Member
tolu619  Offline OP
Junior Member
T

Joined: Jun 2014
Posts: 97
Lagos, Nigeria
They aren't moving. I'm using a flat plate created in WED and compiled so that actions can be attached to it. When I intentionally fall off the edge, my character reaches the invisible floor and then appears to be standing on thin air, and is able to run around on the invisible floor, but the code
Code:
if(event_type == EVENT_ENTITY)
	{
		beep();
	    printf("Touchdown!");
	}

doesn't seem to be running at all. I've set the polygon flag in WED now but I don't see any "not shaded" flag. I saw a "nofilter" flag so I checked that and unchecked the invisible flag. I've recompiled the level but the plate is still invisible! frown

Re: Problem with Mario Kart-like respawn code [Re: tolu619] #442891
07/05/14 12:25
07/05/14 12:25
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
EVENT_ENTITY is the wrong event as the obstacle is not moving, the player is. EVENT_IMPACT thus is the right choice.
Apart from that on a solid movement code the player('s bounding box) will never touch the floor but hover above it, so your event should not get triggered. What you can do in the gravity code is to use c_ignore and ignore the obstacle's group (assign one) or use IGNORE_FLAG2 and set FLAG2 for those obstacles/ trigger boxes.

Alternatively, a much nicer way probably is to use regions and region_check.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Problem with Mario Kart-like respawn code [Re: Superku] #442892
07/05/14 12:30
07/05/14 12:30
Joined: Jun 2014
Posts: 97
Lagos, Nigeria
T
tolu619 Offline OP
Junior Member
tolu619  Offline OP
Junior Member
T

Joined: Jun 2014
Posts: 97
Lagos, Nigeria
While I implement your suggestions, can you enlighten me on that last sentence? I mean, why is it nicer? It looks as if I used region_check, I'll have to be checking for quite a few regions per level. However, if I can get the respawn surfaces to work right, then I can simply re-use that code by attaching it to any object I want to in WED.

Re: Problem with Mario Kart-like respawn code [Re: tolu619] #442894
07/05/14 13:43
07/05/14 13:43
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
When you want to use models instead of regions you have more objects for the renderer/ tree and especially for c_move to process. Other objects (such as effects/ exploding and falling chunks, enemies, birds, ...) will all need to ignore those models too resulting in more work for you. Then, on collision your player will stop mid-air immediately, depending on what you want to achieve this may look bad. In my sidescroller there are bottomless pits and when the player falls from the platform he should not stop for one frame or more mid-aid but just continue falling to his doom while playing the death animation. You could try and use IGNORE_PUSH and a low push value for your obstacle objects, too.

When using regions you can just move and scale them to any size that you want. Checking for all regions can be somehow circumvented when you just use region_find instead and then compare the result. You can call the regions for example "abyssXYZ" and compare for "abyss", then, if necessary, use the number XYZ to determine a spawning position easily.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Problem with Mario Kart-like respawn code [Re: Superku] #442920
07/05/14 22:11
07/05/14 22:11
Joined: Jun 2014
Posts: 97
Lagos, Nigeria
T
tolu619 Offline OP
Junior Member
tolu619  Offline OP
Junior Member
T

Joined: Jun 2014
Posts: 97
Lagos, Nigeria
Ok thanks. I'll toy around with the region thing. A little help here, anybody?
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=442872
It's been unanswered for over a day


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