Even I need some acs help :D

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
jobro
Posts: 206
Joined: Sat Dec 30, 2006 1:56 pm

Even I need some acs help :D

Post by jobro »

So this script should collect the health of an enemy and when he's killed the level should exit. But it doesn't. What's wrong here?

Code: Select all

script 250 (void)
{
int enemyhealth;
  while(!(enemyhealth<=0))
  {
   enemyhealth =GetActorProperty(3,APROP_Health);
   print(i:Enemyhealth);
   Exit_Normal(0);
  }
  delay(3);
  restart;
}
User avatar
The NUtcracker
Posts: 843
Joined: Sun Jan 14, 2007 9:12 pm
Location: South Dakota
Contact:

Post by The NUtcracker »

It says if health is Less than or equal to 0 to do that. It needs to be > 0.
Last edited by The NUtcracker on Mon Jan 22, 2007 5:29 pm, edited 1 time in total.
User avatar
The NUtcracker
Posts: 843
Joined: Sun Jan 14, 2007 9:12 pm
Location: South Dakota
Contact:

Post by The NUtcracker »

Also, the restart needs to be removed The Exit_Normal needs to be out of the while loop, and the delay needs to be in the while loop.
jobro
Posts: 206
Joined: Sat Dec 30, 2006 1:56 pm

Post by jobro »

Thanks for your advice it solved the problem. All though another arised: I am planning to use the scripts on different levels. When I've saved the wad the script doesn't work in the otther level. What should I do?
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Post by randi »

Why not just give the monster the ACS_Execute special? Then you don't need to constantly poll its health in your script because it will automatically execute the script when it dies.

Or in this case, you don't even need a script. Just set its special to Exit_Normal.
User avatar
The NUtcracker
Posts: 843
Joined: Sun Jan 14, 2007 9:12 pm
Location: South Dakota
Contact:

Post by The NUtcracker »

Good advise randy. If you want the script to work in the other level, though, make sure you have the correct TID, and make sure it is in the other map's scripts lump and is compiled and saved.
jobro
Posts: 206
Joined: Sat Dec 30, 2006 1:56 pm

Post by jobro »

The funny thing is when I save the first level then the second doesn't work. When saving the second the first doesn't work. :D
User avatar
edward850
Posts: 5890
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Post by edward850 »

If your using Doom Builder, make sure your using 'Save map into'
User avatar
The NUtcracker
Posts: 843
Joined: Sun Jan 14, 2007 9:12 pm
Location: South Dakota
Contact:

Post by The NUtcracker »

If your using Doom Builder, make sure your using 'Save map into'
I never knew you could do that! Thanks for that! :D
Locked

Return to “Editing (Archive)”