ACS script isn't working properly.

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
User avatar
iSpook
Posts: 743
Joined: Sun Feb 05, 2006 9:23 am
Location: In the middle of Stephen King Territory
Contact:

ACS script isn't working properly.

Post by iSpook »

Giving this a shot on my own resulted in a bit of failure.

Code: Select all

#include "zcommon.acs"
script 1 open {
  if(GetActorProperty(0, APROP_HEALTH) <25)
  {
  Giveinventory(HealthBonus, 1);
  {
  Delay(36);
  restart;
  }
Could someone tell me what I did wrong, please? (For extra information, this is meant as a script that is supposed to Start as soon as the player enters the level.)
User avatar
Ceeb
Posts: 5125
Joined: Wed Jun 11, 2008 4:07 pm
Location: Castle Wut

Re: ACS script isn't working properly.

Post by Ceeb »

Code: Select all

script 1 enter
User avatar
Apothem
Posts: 2070
Joined: Sat Nov 29, 2003 7:13 pm
Location: Performing open heart surgery on an ACS compiler.

Re: ACS script isn't working properly.

Post by Apothem »

When using a script that has open associated with it, the activator is the map. If you use ENTER, the activator is the player. For commands like giveinventory, you need to make sure the activator is the appropriate actor. In this case, it's the player.
User avatar
Ceeb
Posts: 5125
Joined: Wed Jun 11, 2008 4:07 pm
Location: Castle Wut

Re: ACS script isn't working properly.

Post by Ceeb »

Apothem wrote:When using a script that has open associated with it, the activator is the map. If you use ENTER, the activator is the player. For commands like giveinventory, you need to make sure the activator is the appropriate actor. In this case, it's the player.
Which is what I said. Very abbreviated. :P
User avatar
iSpook
Posts: 743
Joined: Sun Feb 05, 2006 9:23 am
Location: In the middle of Stephen King Territory
Contact:

Re: ACS script isn't working properly.

Post by iSpook »

Alright, I just need a more help, the script doesn't activate for some reason. (I've deliberately damaged myself to 20-18 points, to see if it'll activate, and it doesn't Here's where i've tried to stick the Execute in the decorate.

Code: Select all

States
  {
  Spawn:
    PLAY A -1
    PLAY A 0 ACS_ExecuteAlways(1,0,0,0,0)
    Loop
I dunno if it's the Script itself ( I doubt it, but there's always a chance.), the way I set up the Command or if I'm doing this entirely wrong. (I am quite new at this.)
User avatar
Remmirath
Posts: 2562
Joined: Sun Dec 23, 2007 3:53 am
Graphics Processor: nVidia with Vulkan support
Location: My house
Contact:

Re: ACS script isn't working properly.

Post by Remmirath »

It won't never jump to the state with the ACS execute because you are using a -1 duration in the first state.
User avatar
iSpook
Posts: 743
Joined: Sun Feb 05, 2006 9:23 am
Location: In the middle of Stephen King Territory
Contact:

Re: ACS script isn't working properly.

Post by iSpook »

Oh... It's always the most obvious mistakes, thanks.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: ACS script isn't working properly.

Post by HotWax »

Um, if you used script 1 enter (as previously suggested), you should not need to activate the script manually. A copy of it should automatically start running for each player the moment they enter the map. So unless you're terminating it elsewhere, I don't see why it wasn't working for you previously.

Scratch that, yes I do. You've got a bracket flipped, and you've misused GiveInventory.

Code: Select all

script 1 enter
{
	if (GetActorProperty(0, APROP_Health) < 25)
	{
		GiveInventory("HealthBonus", 1); // Note the quotation marks
	} // Note the fixed bracket

	delay (36)
	restart;
}
Frankly I'm surprised your previous version compiled. (You did compile it, right?)
User avatar
iSpook
Posts: 743
Joined: Sun Feb 05, 2006 9:23 am
Location: In the middle of Stephen King Territory
Contact:

Re: ACS script isn't working properly.

Post by iSpook »

Nope, I did not. I was working in a SCRIPT lump directly.
User avatar
Remmirath
Posts: 2562
Joined: Sun Dec 23, 2007 3:53 am
Graphics Processor: nVidia with Vulkan support
Location: My house
Contact:

Re: ACS script isn't working properly.

Post by Remmirath »

To make it working, you have to compile it.
User avatar
iSpook
Posts: 743
Joined: Sun Feb 05, 2006 9:23 am
Location: In the middle of Stephen King Territory
Contact:

Re: ACS script isn't working properly.

Post by iSpook »

Oh, didn't think it was -required- to make it work, thought 'compile' was the equivalent to 'saving' it.
User avatar
Remmirath
Posts: 2562
Joined: Sun Dec 23, 2007 3:53 am
Graphics Processor: nVidia with Vulkan support
Location: My house
Contact:

Re: ACS script isn't working properly.

Post by Remmirath »

The compiling process transforms the text into a compiled lump called BEHAVIOR. That makes it readable for the engine.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: ACS script isn't working properly.

Post by HotWax »

Morpheus wrote:The compiling process transforms the text into a compiled lump called BEHAVIOR. That makes it readable for the engine.
Which is also convenient for error-checking, to make sure you've written a valid script.
User avatar
Remmirath
Posts: 2562
Joined: Sun Dec 23, 2007 3:53 am
Graphics Processor: nVidia with Vulkan support
Location: My house
Contact:

Re: ACS script isn't working properly.

Post by Remmirath »

That, too. :P

If syntax is incorrect, it simply won't compile the script.
Locked

Return to “Editing (Archive)”