Jump to content
  • 0

Using ACS to change a line action to execute a named script (UDMF)


SMG_Man

Question

I'm inserting a few scripts into all of my WAD's levels, and for ease of mind I've decided to give them strings as names instead of numbers (so for example, "player_tracker"). On static lines this has worked just fine using line action 80 and setting the "String" flag. However, there are places where I don't want these scripts to trigger until after the player has done something specific, but when I use

 

SetLineSpecial(108, ACS_Execute, "player_tracker", 32, 7);

to apply the "player_tracker" script to line 108 after a certain point, nothing happens. The rest of the script works fine and I can see it trigger, but this part of it is having no effect. What should I do?

Share this post


Link to post

11 answers to this question

Recommended Posts

  • 2

String arguments in line actions are actually some "weird hacks" (afaik something like it sets the argument to a negative number as index in string table when the map is loaded).

I think you cannot set those string arguments in SetLineSpecial.

Share this post


Link to post
  • 1
2 minutes ago, SMG_Man said:

Here's the thing

I've understood what you're trying to do, that's why I said that you can't with a named script and you have to change that "player_tracker" to a number

Share this post


Link to post
  • 1

I would suggest setting the script activation (80) on the line in editor along with the string name, but without setting the activation to activate on walk.

Then in the script that is supposed to "activate" the line, you would use SetLineActivation function to set up the walkover activation.

Share this post


Link to post
  • 0
1 hour ago, boris said:

You have to use ACS_NamedExecute (https://zdoom.org/wiki/ACS_NamedExecute) or any of the other ACS_Named* actions.

From the wiki:

 

Quote

 

Variant of ACS_Execute for named scripts.

There is both an ACS and a DECORATE version of this function. Both behave identically.

However, it is not available as an action special: to call named scripts from a a line or thing special, you have to use the non-named variant (ACS_Execute) in UDMF, with the arg0str custom argument set to the name of the script — this will override the first parameter.

 

 

How can I set this "arg0str" thing on the lines properly?

Share this post


Link to post
  • 0
21 hours ago, SMG_Man said:

How can I set this "arg0str" thing on the lines properly?

It's very likely referring to the "string" check on the left side.

 

Back to this 

Quote

to apply the "player_tracker" script

Unfortuantely you cannot set the "ACS_NamedExecute" with SetLineSpecial, so you have to convert that named script to a numeric one (that arg0 in SetLineSpecial arguments is not what the wiki about ACS_Execute is referring to)

Edited by Kan3

Share this post


Link to post
  • 0
21 hours ago, SMG_Man said:

From the wiki:

 

 

How can I set this "arg0str" thing on the lines properly?

arg0str means literally the first argument should be the string.

 

So in other words, set the line special to ACS_Execute, then for Argument 1, put the named script (player_tracker).

 

This, however, only works if you're mapping in UDMF format. If you're doing Doom-in-Hexen, this won't work.

Edited by Dark Pulse

Share this post


Link to post
  • 0
7 minutes ago, Kan3 said:

It's very likely referring to the "string" check on the left side.

Here's the thing - when I select line special 80, the "String" box is there (that's why it's working for the other lines that have this script placed on them). Like so:

image.png.5369bfe5e5b82a1a8a0afc939ca89d9c.png

 

But for this line, I don't want it to have a special until the player has passes a certain point in the map, and at that point, I want to use a script to assign the proper action special to the line, so at the beginning of the map, this line 108 should have 0 for its action. When I do that, however:

 

image.png.ca9e7d2c7266ff649856b526a46a82e5.png

 

The "String" box on the left disappears, meaning that I can't have it set beforehand.

Edited by SMG_Man

Share this post


Link to post
  • 0
6 minutes ago, Kan3 said:

I've understood what you're trying to do, that's why I said that you can't with a named script and you have to change that "player_tracker" to a number

He could possibly use LockedExecute, and give the player a dummy item that will activate that script if the player has the item. Otherwise it will do nothing.

 

https://zdoom.org/wiki/ACS_LockedExecute

 

Possibly ExecuteWait, as well.

 

https://zdoom.org/wiki/ACS_ExecuteWait

Edited by Dark Pulse

Share this post


Link to post
  • 0

All right then, I'm just gonna have to make a numbered version of it then. Thanks for the help through this mild frustration.

Share this post


Link to post
  • 0

I know this thread has been dormant for years, but I ran into the same issue today, and found something that lets you use named scripts with SetLineSpecial: StrArg

 

Here's an example of how I have used it, where I have written a script named "PurchaseWeapon":

SetLineSpecial(300, ACS_ExecuteAlways, StrArg("PurchaseWeapon"), 0, 500, "supershotgun", "Super Shotgun");


...and it does, in fact, work!

Also works with ExecuteWithResult, if your script has 4 arguments:

SetLineSpecial(301, ACS_ExecuteWithResult, StrArg("PurchaseItemN"), 100, 8, "shell", "Shells");

 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...