1 registered members (Dico),
16,767
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Respawn [Solved]
#379530
08/04/11 00:03
08/04/11 00:03
|
Joined: Aug 2011
Posts: 58 Colombia/Bogotá
wdakfenixx
OP
Junior Member
|
OP
Junior Member
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]
#379626
08/05/11 01:50
08/05/11 01:50
|
Joined: Sep 2003
Posts: 5,900 Bielefeld, Germany
Pappenheimer
Senior Expert
|
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).
#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;
}
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|