is there a way to resurrect a player via acs script?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

is there a way to resurrect a player via acs script?

Postby angrymerc29 » Thu Jan 31, 2019 11:40 am

as the title of this topic implies i would like to know if there a way to resurrect the player when they die through acs scripting

here's what i have atm

Code: Select allExpand view
script 15 death //when player dies in mini game
{
If(CheckInventory("playerisgaming") <= 1)
{
TakeInventory("playerisgaming",1);
Teleport_NoFog(0,0,6);
UnMorphActor(0);
}
}
User avatar
angrymerc29
remember on the zdoom forums jokes are heresy
 
Joined: 16 Nov 2016
Location: yo mama's house

Re: is there a way to resurrect a player via acs script?

Postby TDRR » Thu Jan 31, 2019 7:25 pm

This should work, do note that this has the side effect of always teleporting the player if it dies, so you may want to be careful with it.

Code: Select allExpand view
script 15 ENTER //when player dies in mini game
{
If(CheckInventory("playerisgaming") == 1)
{
SetPlayerProperty (0, 1, PROP_BUDDHA); //never allow the player to die, but allow it's health to decay
If(GetActorProperty(0, APROP_HEALTH) == 1)  //Check if the player is "dead"
{
SetActorProperty(0, APROP_HEALTH, 100); //reset health back to 100
SetPlayerProperty (0, 0, PROP_BUDDHA);
TakeInventory("playerisgaming",1);
Teleport_NoFog(0,0,6);
UnMorphActor(0);
}
}
delay(5); //check every 5 tics
restart;
}


EDIT: Fixed code, now it will only resurrect the player if it has died while playing a minigame.

Also, if you don't mind telling, what is this about? Sounds pretty cool.
User avatar
TDRR
Zandronum Edition
 
Joined: 11 Mar 2018
Location: Venezuela
Discord: TDRR#5820
Operating System: Windows Vista/7/2008 64-bit
Graphics Processor: Intel (Modern GZDoom)

Re: is there a way to resurrect a player via acs script?

Postby angrymerc29 » Thu Jan 31, 2019 8:31 pm

TDRR wrote:This should work, do note that this has the side effect of always teleporting the player if it dies, so you may want to be careful with it.

Code: Select allExpand view
script 15 ENTER //when player dies in mini game
{
If(CheckInventory("playerisgaming") == 1)
{
SetPlayerProperty (0, 1, PROP_BUDDHA); //never allow the player to die, but allow it's health to decay
If(GetActorProperty(0, APROP_HEALTH) == 1)  //Check if the player is "dead"
{
SetActorProperty(0, APROP_HEALTH, 100); //reset health back to 100
SetPlayerProperty (0, 0, PROP_BUDDHA);
TakeInventory("playerisgaming",1);
Teleport_NoFog(0,0,6);
UnMorphActor(0);
}
}
delay(5); //check every 5 tics
restart;
}


EDIT: Fixed code, now it will only resurrect the player if it has died while playing a minigame.

Also, if you don't mind telling, what is this about? Sounds pretty cool.


thank you very much for fixing it, and if you wanna know this script is for i'll dm you the details as this is for a personal mod i'm working on for a few discord friends of mine i will more then likely not upload it due to some "sensitive" stuff and if i do decided to upload it i will have to modify certain assets
User avatar
angrymerc29
remember on the zdoom forums jokes are heresy
 
Joined: 16 Nov 2016
Location: yo mama's house


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests