Page 1 of 1

Script Requesting

Posted: Thu Oct 12, 2017 4:07 pm
by CrazyDuck
I don't know how to write scripts at all , So I hope to have a player that good at scripting can help me write a small script
If someone could help me , i will be able to finish my map . thank you guys!
The Scripts i need will resurrect the player on the body 5 seconds after he dead, and remove dead bodies from Resurrection, and if the body disappears, he will not be resurrected. And the script is in the form of public void, because I want to use it on the map instead of using it independently

Re: Script Requesting

Posted: Thu Oct 12, 2017 7:14 pm
by JakSparro98
CrazyDuck wrote:
Thu Oct 12, 2017 4:07 pm
I don't know how to write scripts at all , So I hope to have a player that good at scripting can help me write a small script
If someone could help me , i will be able to finish my map . thank you guys!
The Scripts i need will resurrect the player on the body 5 seconds after he dead, and remove dead bodies from Resurrection, and if the body disappears, he will not be resurrected. And the script is in the form of public void, because I want to use it on the map instead of using it independently
Before I can start the code I need to ask you if the player have to resurrect in the same position he died and if the script needs to start at game start.

Then I want to precise that "public void form" as you say doesn't automatically makes a script for a map or indipendent, in particular the public keyword allows to declare if the code needs to be visible on more "levels" that's why when you trigger some script from game objects we use public instead of leaving it blank or giving it private.

Re: Script Requesting

Posted: Sat Oct 14, 2017 7:00 am
by CrazyDuck
JakSparro98 wrote:
Thu Oct 12, 2017 7:14 pm
CrazyDuck wrote:
Thu Oct 12, 2017 4:07 pm
I don't know how to write scripts at all , So I hope to have a player that good at scripting can help me write a small script
If someone could help me , i will be able to finish my map . thank you guys!
The Scripts i need will resurrect the player on the body 5 seconds after he dead, and remove dead bodies from Resurrection, and if the body disappears, he will not be resurrected. And the script is in the form of public void, because I want to use it on the map instead of using it independently
Before I can start the code I need to ask you if the player have to resurrect in the same position he died and if the script needs to start at game start.

Then I want to precise that "public void form" as you say doesn't automatically makes a script for a map or indipendent, in particular the public keyword allows to declare if the code needs to be visible on more "levels" that's why when you trigger some script from game objects we use public instead of leaving it blank or giving it private.
Thank you for reply,
Yes, I need to make it work at the beginning of the game
I don't need it to work on more levels, but on a particular map
The place where I need players to resurrect is changeable, and where their bodies are moved, he'll be resurrected there unless his body is destoryed or removed
Thank you very much for helping me
:D

Re: Script Requesting

Posted: Fri Oct 20, 2017 8:58 pm
by JakSparro98
CrazyDuck wrote:
Sat Oct 14, 2017 7:00 am
JakSparro98 wrote:
Thu Oct 12, 2017 7:14 pm
CrazyDuck wrote:
Thu Oct 12, 2017 4:07 pm
I don't know how to write scripts at all , So I hope to have a player that good at scripting can help me write a small script
If someone could help me , i will be able to finish my map . thank you guys!
The Scripts i need will resurrect the player on the body 5 seconds after he dead, and remove dead bodies from Resurrection, and if the body disappears, he will not be resurrected. And the script is in the form of public void, because I want to use it on the map instead of using it independently
Before I can start the code I need to ask you if the player have to resurrect in the same position he died and if the script needs to start at game start.

Then I want to precise that "public void form" as you say doesn't automatically makes a script for a map or indipendent, in particular the public keyword allows to declare if the code needs to be visible on more "levels" that's why when you trigger some script from game objects we use public instead of leaving it blank or giving it private.
Thank you for reply,
Yes, I need to make it work at the beginning of the game
I don't need it to work on more levels, but on a particular map
The place where I need players to resurrect is changeable, and where their bodies are moved, he'll be resurrected there unless his body is destoryed or removed
Thank you very much for helping me
:D
Sorry for the late answer, I was been busy all the week, here's what you requested:
Download template
You can move the spawnpoint by triggering ScriptTriggers as set as in the map example, the last triggered will be used next time a player die and his body is still present. When not even one is triggered, the default spawn will be at map origin (0,0).

Tell me if it's what you wanted, I'm at your disposal for any question.

Re: Script Requesting

Posted: Sun Oct 22, 2017 5:18 am
by CrazyDuck
JakSparro98 wrote:
Fri Oct 20, 2017 8:58 pm
CrazyDuck wrote:
Sat Oct 14, 2017 7:00 am
JakSparro98 wrote:
Thu Oct 12, 2017 7:14 pm

Before I can start the code I need to ask you if the player have to resurrect in the same position he died and if the script needs to start at game start.

Then I want to precise that "public void form" as you say doesn't automatically makes a script for a map or indipendent, in particular the public keyword allows to declare if the code needs to be visible on more "levels" that's why when you trigger some script from game objects we use public instead of leaving it blank or giving it private.
Thank you for reply,
Yes, I need to make it work at the beginning of the game
I don't need it to work on more levels, but on a particular map
The place where I need players to resurrect is changeable, and where their bodies are moved, he'll be resurrected there unless his body is destoryed or removed
Thank you very much for helping me
:D
Sorry for the late answer, I was been busy all the week, here's what you requested:
Download template
You can move the spawnpoint by triggering ScriptTriggers as set as in the map example, the last triggered will be used next time a player die and his body is still present. When not even one is triggered, the default spawn will be at map origin (0,0).

Tell me if it's what you wanted, I'm at your disposal for any question.
Thank you! but, i can't open this download link...
maybe you can send the txt file to my email 798108753@qq.com

Re: Script Requesting

Posted: Sun Oct 22, 2017 12:03 pm
by JakSparro98
CrazyDuck wrote:
Sun Oct 22, 2017 5:18 am
Thank you! but, i can't open this download link...
maybe you can send the txt file to my email 798108753@qq.com
I modified the link in the previous post, can you retry?

Re: Script Requesting

Posted: Mon Oct 23, 2017 6:48 am
by CrazyDuck
JakSparro98 wrote:
Sun Oct 22, 2017 12:03 pm
CrazyDuck wrote:
Sun Oct 22, 2017 5:18 am
Thank you! but, i can't open this download link...
maybe you can send the txt file to my email 798108753@qq.com
I modified the link in the previous post, can you retry?
Yes , thank you . But I think you not fully understand what I mean... Your script is similar to the checkpoint script, but what I need is to make fighters like zombies, where to die and where to rise :) Please help me revise it again , Thank You!
By the way , my map has been completed, and now it's just need the script to make it work. It will be a really fun and creative map!

Re: Script Requesting

Posted: Mon Oct 23, 2017 10:39 am
by JakSparro98
CrazyDuck wrote:
Mon Oct 23, 2017 6:48 am
Yes , thank you . But I think you not fully understand what I mean... Your script is similar to the checkpoint script, but what I need is to make fighters like zombies, where to die and where to rise :) Please help me revise it again , Thank You!
By the way , my map has been completed, and now it's just need the script to make it work. It will be a really fun and creative map!
Never talked about reviving bots, I thought you needed it for players, and yes, this code is a variation of the checkpoint system.
Do you need only to revive bots or both players and bots?

Re: Script Requesting

Posted: Tue Oct 24, 2017 8:03 am
by CrazyDuck
JakSparro98 wrote:
Mon Oct 23, 2017 10:39 am
CrazyDuck wrote:
Mon Oct 23, 2017 6:48 am
Yes , thank you . But I think you not fully understand what I mean... Your script is similar to the checkpoint script, but what I need is to make fighters like zombies, where to die and where to rise :) Please help me revise it again , Thank You!
By the way , my map has been completed, and now it's just need the script to make it work. It will be a really fun and creative map!
Never talked about reviving bots, I thought you needed it for players, and yes, this code is a variation of the checkpoint system.
Do you need only to revive bots or both players and bots?


I'm talking about getting players to resurrect on their bodies, not checkpoints! Right on their dead bodys! It's in the dead place resurrection rather than teleport to the checkpoint! And when the body was destroyed, they would not revive, and that was the most important thing!

Re: Script Requesting

Posted: Mon Oct 30, 2017 6:02 pm
by JakSparro98
CrazyDuck wrote:
Tue Oct 24, 2017 8:03 am
JakSparro98 wrote:
Mon Oct 23, 2017 10:39 am
CrazyDuck wrote:
Mon Oct 23, 2017 6:48 am
Yes , thank you . But I think you not fully understand what I mean... Your script is similar to the checkpoint script, but what I need is to make fighters like zombies, where to die and where to rise :) Please help me revise it again , Thank You!
By the way , my map has been completed, and now it's just need the script to make it work. It will be a really fun and creative map!
Never talked about reviving bots, I thought you needed it for players, and yes, this code is a variation of the checkpoint system.
Do you need only to revive bots or both players and bots?


I'm talking about getting players to resurrect on their bodies, not checkpoints! Right on their dead bodys! It's in the dead place resurrection rather than teleport to the checkpoint! And when the body was destroyed, they would not revive, and that was the most important thing!
Clear, here's the script, I hope it's what you're asking:

Code: Select all

const int RespawnSeconds = 5;
static List < DeadPlayer > DPlayersList = new List < DeadPlayer > ();
Events.PlayerDeathCallback m_playerDeathEvent = null;
Events.UpdateCallback m_updateEvent = null;
class DeadPlayer {
 IProfile P_profile;
 public IUser P_user;
 public IPlayer P_body;
 public float P_DeathTime = 0f;
 PlayerTeam P_team;
 public DeadPlayer(IPlayer player) {
  P_profile = player.GetProfile();
  P_user = player.GetUser();
  P_DeathTime = Game.TotalElapsedGameTime;
  P_body = player;
  P_team = player.GetTeam();
 }
 public void Respawn() {
  IPlayer pl = Game.CreatePlayer(P_body.GetWorldPosition());
  pl.SetUser(this.P_user);
  pl.SetProfile(this.P_profile);
  pl.SetTeam(this.P_team);
  this.P_body.Remove();
  DPlayersList.Remove(this);
 }
}
public void OnStartup() {
 m_playerDeathEvent = Events.PlayerDeathCallback.Start(OnPlayerDeath);
 m_updateEvent = Events.UpdateCallback.Start(OnUpdate, 0);
}
public void OnPlayerDeath(IPlayer player) {
 if (!player.IsBot && !player.IsRemoved && DPlayersList.FirstOrDefault(s => s.P_user.UserID == player.GetUser().UserID) == null) {
  DeadPlayer pl = new DeadPlayer(player);
  DPlayersList.Add(pl);
 }
}
public void OnUpdate(float elapsed) {
 for (int i = 0; i < DPlayersList.Count; i++)
  if (IsElapsed(DPlayersList[i].P_DeathTime, RespawnSeconds * 1000) && !DPlayersList[i].P_body.IsRemoved)
   DPlayersList[i].Respawn();
}
public static bool IsElapsed(float TimeStarted, float TimeToElapse) {
 if ((float)(Game.TotalElapsedGameTime - TimeStarted) >= TimeToElapse)
  return true;
 else
  return false;
}