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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
angrymerc29
Posts: 27
Joined: Wed Nov 16, 2016 9:34 am
Location: yo mama's house

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

Post by angrymerc29 »

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 all

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
TDRR
Posts: 816
Joined: Sun Mar 11, 2018 4:15 pm
Location: Venezuela

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

Post by TDRR »

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 all

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
angrymerc29
Posts: 27
Joined: Wed Nov 16, 2016 9:34 am
Location: yo mama's house

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

Post by angrymerc29 »

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 all

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

Return to “Scripting”