Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
rf`

Zdoom shot me

Recommended Posts

Something is wrong here. I wanted a certain part of this script to run or not depending on if a player died while the script is running. Unfortunately it doesn't do that. It runs everything else except for the extra bit that only occurs if the player is still alive. Any questions on why that part never works?

script 1 OPEN
{
	Thing_ChangeTid (17, 99); //player is set at tid 17
}

script 14 (void)
{
//eat me

if(getactorproperty(99, aprop_health) >= 1)
{
	exit_normal(0);
}

else if(getactorproperty(99, aprop_health) <= 0)
{
terminate;	//If the player is dead, terminate the script.
}

Delay (1);
restart;	//Checks player's health every tic.
}

Share this post


Link to post

THat cannot work.

You can't assign a tid to a player in an OPEN script. For that you have to use an ENTER script and use 0 as the source tid. This is the only way how you can assign a tid to a player for the first time in a level.

Second, this script cannot loop. If the player is alive it will exit immediately otherwise it will terminate immediately.

Share this post


Link to post

Would this work?

script 14 (void)
{
	stuff();
	acs_execute(15,0,0,0,0); //run script 15 at the end of all of this
}

script 15 (void) //this is to keep the level from ending even if you are dead
{
	if(getactorproperty(0, aprop_health) >= 1)
	{
		exit_normal(0);
	}

	else if(getactorproperty(0, aprop_health) <= 0)
	{
		terminate;
	}

	delay(1);
	restart;
}

Share this post


Link to post

I think ravage read my example wrong. I had the enter script and I explained everything pretty well. The ChangeTID command is WAY off though...

Thing_ChangeTID (#1, #2);

#1 - The ACTUAL THING NUMBER of the thing in the editor. Your script currently makes it change Thing Number 17's TID to 99, not the other way around.

#2 - This is the new TID of this thing.

That should fix that up.

EDIT: And no that certainly would not work. This is saying that TID 0 (This is a whole lot of things) is what the GetActorProp is getting. This means any player/enemy/object, etc. will contribute to the HP count. I gave you a working example. I tested it myself.

http://dtca.2webh.com/player_health_script.txt

If you don't believe me, copy the script entirely and add the appropriate information. If done properly it will work.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×