Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,008 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Respawn [Solved] #379530
08/04/11 00:03
08/04/11 00:03
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
I read another post about this , if I want that the player respawn in another side I must not remove the entity and create another one where is the respawn point, I just run the dead animation and then move the player to the respawn point and restore his health points, ok I understand that, but, HOW I MOVE THE PLAYER TO THE RESPAWN POINT? also, if I have several respawn points, how can I make that the player respawn in the nearest one?,should I create a action for respawn the player and attach it to a entity on the respawn point?

Last edited by wdakfenixx; 08/05/11 00:14.

CAUTION :The content above could blow your mind
Re: Respawn [Re: wdakfenixx] #379532
08/04/11 00:17
08/04/11 00:17
Joined: Dec 2008
Posts: 1,660
North America
Redeemer Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
Are you writing your own code or using the templates? Because if you're writing your own code and you don't know how to displace an entity I really don't know where to start... -.-


Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: Respawn [Re: wdakfenixx] #379534
08/04/11 00:23
08/04/11 00:23
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
You simply set him to the position of the respawn point.
In case you have a player = me; in the beginning of the player action and you have the you pointer of the respawn point:

vec_set(you.x, player.x);

You can compare the distances with vec_dist.
You can search for the respawn points with ent_next.
You can give them an ID within a skill to find them among all the other entities.
To compare the distances you can set a varaible to a high value, and then compare its value to the dist of the respawn points, if the respawn points' distance is smaller, set the value to its dist and do this with each entity with the respawn point ID.

Re: Respawn [Re: wdakfenixx] #379536
08/04/11 00:26
08/04/11 00:26
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
o thanks, that is just what i need


CAUTION :The content above could blow your mind
Re: Respawn [Re: wdakfenixx] #379625
08/05/11 00:15
08/05/11 00:15
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
If someone else need more help check this article

http://www.coniserver.net/wiki/index.php/Respawn


CAUTION :The content above could blow your mind
Re: Respawn [Re: wdakfenixx] #379626
08/05/11 01:50
08/05/11 01:50
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Here is a fully functional example in a test level.
Copy it into an empty script in SED and save the script and start it.

Hit the Key 1 to get the cube(respawn point) that is nearest to the sphere (player).

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

#define _id skill1 //use any free skill

#define _id_player 1
#define _id_respawn 2

var nearest = 100000;
ENTITY* nearest_respawn;


action respawn_point()
{
	my._id = _id_respawn;
}

function find_nearest_respawn_point()
{
	you = ent_next(NULL);
	while(you)
	{
		if(you._id == _id_respawn)
		{
			if(vec_dist(you.x, player.x)< nearest)
			{
				nearest = vec_dist(you.x, player.x);
				nearest_respawn = you;
			}
		}
		you = ent_next(you);
	}
	set(nearest_respawn, TRANSLUCENT);
}


action player_func()
{
	var search_off = 1;
	player = me;
	my._id = _id_player;
	while(1)
	{
		if(key_1&&search_off)
		{
			find_nearest_respawn_point();
			search_off = 0;
		}
		wait(1);
	}
}

function main()
{
	randomize();
	level_load(NULL);
	ent_create(SPHERE_MDL, vector(0,0,0), player_func);
	ent_create(CUBE_MDL, vector(random(120)-60,random(120)-60,0), respawn_point);
	ent_create(CUBE_MDL, vector(random(120)-60,random(120)-60,0), respawn_point);
	ent_create(CUBE_MDL, vector(random(120)-60,random(120)-60,0), respawn_point);
	ent_create(CUBE_MDL, vector(random(120)-60,random(120)-60,0), respawn_point);
	camera.x = -140;
	camera.z = 40;
	camera.tilt = -12;
}




Gamestudio download | 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