Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
baja blast rd.

*** The "ask a miscellaneous editing question" thread ***

Recommended Posts

Can anyone help me with Custom ACS libraries?

I want to use CallACS to run a script (which is defined as "Checkepisode") to inhibit the spawning of a certain Actor should the LEVELINFO_CLUSTERNUM = 3 (Inferno). It looks something like this:

Actor "Zombiereplacer"

TNT A 0
TNT A 0 JumpIf(CallACS("CheckEpisode", 0, 0, 0, 0) ==1, "Skip")
TNT A 0 JumpIf(CallACS("CheckEpisode", 0, 0, 0, 0) ==2, "Skip")
TNT A 0 JumpIf(CallACS("CheckEpisode", 0, 0, 0, 0) ==3, "Normal")


"Skip" should make it implement the "Zombiereplacer"

"Normal" should make it just spawn "Zombieman"

Whatever I am doing, it's making my entire GZDOOM crash spectacularly! All of the above is included in DECORATE.

For the ACS script, I know I must include #library "Whatever my file is called"
#include "zcommon.acs"

script "CheckEpisode" (void)
{ int GetLevelInfo(LEVELINFO_CLUSTERNUM);



After this, my layman's knowledge runs dry!

Share this post


Link to post

Post the exact DECORATE definition of the Zombiereplacer actor and the exact content of the file with your library script. Also make sure you have compiled the library and used LOADACS to load it.

Share this post


Link to post
scifista42 said:

Post the exact DECORATE definition of the Zombiereplacer actor and the exact content of the file with your library script. Also make sure you have compiled the library and used LOADACS to load it.


Okay, here is everything in its (inadequate) entirety:

// DECORATE entry (partly credited to Scifista42):

Actor Zombiereplacer replaces Zombieman {
States {
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(90,"Spawn2")
TNT1 A 0 A_SpawnItemEx("Zombieman1",0,0,0,0,0,0,0,SXF_TRANSFERAMBUSHFLAG|SXF_TRANSFERSPECIAL)
stop
Spawn2:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("ScientistSpawn",0,0,0,0,0,0,0,SXF_TRANSFERAMBUSHFLAG|SXF_TRANSFERSPECIAL)
stop

}
}


// ACS script is named "CUSTOM"

#library "CUSTOM"
#INCLUDE "zcommon.acs"

script "Checkepisode" (void)
{
int GetLevelInfo(LEVELINFO_CLUSTERNUM);

}


I also added "CUSTOM" to the LOADACS document, and I know it is being recognized because of the aforementioned spectacular gzdoom crashes that are being caused! Any advice for this layman?

Share this post


Link to post

I can't see the "Checkepisode" script being used in the Zombiereplacer's code??? Anyway:

1. Change the script line from "int GetLevelInfo(LEVELINFO_CLUSTERNUM);" to "SetResultValue(GetLevelInfo(LEVELINFO_CLUSTERNUM));"
2. Select the "CUSTOM" lump in SLADE3, bring up the context menu and choose "Scripts -> Compile ACS".

Share this post


Link to post

How would I go about creating a camera that follows the player in a 2D platform game kind of fashion?

I made a small test level and set up a AimingCamera and the following script:

script 1 OPEN
{
ChangeCamera(2, TRUE, FALSE);
}

2 of course being the TID of the AimingCamera.

It does work whenever I test the game in GZDoom, but I can't figure out how to make the camera actually follow me. I actually put the player tag in the Target Thing Tag box, but it doesn't work.

Anybody care to help me out? :o

Share this post


Link to post
scifista42 said:

I can't see the "Checkepisode" script being used in the Zombiereplacer's code??? Anyway:

1. Change the script line from "int GetLevelInfo(LEVELINFO_CLUSTERNUM);" to "SetResultValue(GetLevelInfo(LEVELINFO_CLUSTERNUM));"
2. Select the "CUSTOM" lump in SLADE3, bring up the context menu and choose "Scripts -> Compile ACS".


Great! I'll go about that now.

And yes, there is nothing in the DECORATE file because I really am not sure how to go about it. I was thinking:

TNT A 0 JumpIf(CallACS("Checkepisode", 0, 0, 0, 0) ==3, "//SOMETHING!")

Share this post


Link to post

@Agentbromsnor: Firstly, you should make an ENTER script (which has the player as its activator) rather than an OPEN script (which has no activator). Secondly, you should not assign a tag to the player by tagging the player start thing - that doesn't work. You can, however, give him a tag via Thing_ChangeTID called from the ENTER script. Thirdly, if you want the camera to dynamically change position (not just an angle, which is what Aiming Camera does) in an arbitrary way, use a continually running script calling SetActorPosition affecting the camera thing.

Share this post


Link to post
scifista42 said:

2. Select the "CUSTOM" lump in SLADE3, bring up the context menu and choose "Scripts -> Compile ACS".


I do that and I get an error message saying "Error: ACC path not defined. Please configure in Preferences".

Share this post


Link to post

Go to "Edit -> Preferences -> Scripting -> ACS" and browse path to the "acc" (ACS compiler) executable - for example from (GZ)Doom Builder's "compilers" folder.

Share this post


Link to post
scifista42 said:

@Agentbromsnor: Firstly, you should make an ENTER script (which has the player as its activator) rather than an OPEN script (which has no activator). Secondly, you should not assign a tag to the player by tagging the player start thing - that doesn't work. You can, however, give him a tag via Thing_ChangeTID called from the ENTER script. Thirdly, if you want the camera to dynamically change position (not just an angle, which is what Aiming Camera does) in an arbitrary way, use a continually running script calling SetActorPosition affecting the camera thing.


Good point about the OPEN script. I just changed it to ENTER instead.

I'm going to delve into those wiki pages and see what I can make of it. I might return to this topic for some follow-up questions, but this should be a good ACS exercise for me regardless. :)

Thanks for the reply.

Share this post


Link to post
scifista42 said:

Go to "Edit -> Preferences -> Scripting -> ACS" and browse path to the "acc" (ACS compiler) executable - for example from (GZ)Doom Builder's "compilers" folder.


Brilliant! Thanks!

I successfully managed to filter out that ACTOR from Episode 3, with your help.

Share this post


Link to post

How, oh, how do I use the sector specials in GZDoom builder?

I'm using the GZDoom mode, and there's thing options for making fog and such. I looked online, and it says that they need arguments. I dont see any place to enter thing arguments.

Some other things require being tagged and operated by an ACS script. I don't see any place to tag things.

Can somebody tell me how to do these things?

Share this post


Link to post

This is for udmf.

Spoiler

In the red circle you can see specials your sector curretly has and if you click the small icon on the right it opens up a list a various sector actions available. Generalized tab has more basic specials.

If you want to set up sector's special via acs eg. http://zdoom.org/wiki/Sector_SetDamage
you need to use the script editor to do that (located next to save map button in the top toolbar)
http://zdoom.org/wiki/A_quick_beginner%27s_guide_to_ACS
Spoiler

If you want your sector to have a fog effect you need to click black button labeled as fade (you can also type in a number in the box if you are 1337artperson). This opens up a window that lets you derp around with various color settings of your fog effect (pure black is no fog, pure white is really thick fog) after you have happy with your abomination just click ok and you have fog in your sector.

The white button above fade is sector light color it works the same way.

edit: You can see the sectors "tag" right at the bottom of the properties window.

Also don't use the word "thing" like you do because "thing" has a special meaning when it comes to doom mapping

Share this post


Link to post
everennui said:

How do I set a z-height on a line special so it is only triggered on top of a 3D Floor?

You don't.

You'll have to make the line activate a script that will check for activator height and then perform the effect you want or not.

Share this post


Link to post

I'm trying to create a door that will only open if the player has crossed a line somewhere else in the map.

int doorCheck = 0;

Script 17 (void)
{
  if (doorCheck == 0);
       {
         doorCheck = 1;
       }
}
Script 18 (void)
{
  if (doorCheck == 1);
    {
      Door_Raise(53, 16, 0);
    }
  else (doorCheck == 0); //line 164
    {
      PrintBold("This door cannot be opened from here.");
    }
}
It says, "Invalid Statement" at line 164

Edit: semicolon

Might be then?

Share this post


Link to post

I'm sorry to blow up this thread today... but does anyone know how to turn on the lines that connect linedefs with actions to affected sectors in GZDB? I accidently shut it off and I can't find it in the Preferences > Control tab. What would that even be called? I've also looked at reference.html and google searched it, but no luck.

Share this post


Link to post
everennui said:

      PrintBold("This door cannot be opened from here.");
It says, "Invalid Statement" at line 164

You have to put a cast type first. Remember that when ACS is compiled, all strings are put in a table and replaced by their index in that table, so the instruction will become something like PrintBold(6); and the VM will not know what that means.

http://zdoom.org/wiki/Print

      PrintBold(s:"This door cannot be opened from here.");

Share this post


Link to post

When I close groups of lines in Doom builder, it automatically creates a sector. This erases all of the texture settings in the shape, and is very annoying in general, especially when editing complex large column-like shapes. How do I stop Doom Builder from doing this?

Share this post


Link to post
Gez said:

http://zdoom.org/wiki/Print

      PrintBold(s:"This door cannot be opened from here.");

Thanks. It's a bad habit.

What's it called when you use an if/else statement? The wiki is very helpful, but I feel at times that it is geared more toward people who already have an understanding of programming. If it's something simple like Script 1 theNameSaysItAll(you can't, fuck, this up); then I don't really have a problem, but creating logical expressions with "machine" (only for a lack of a better word) language is a little frustrating.

I think that I've got a pretty good grip on the "Hello World" aspect of this, but I don't even know how to move forward.

Shouldn't this code work?

Doesn't it say, "Computer! Here's doorCheck. It has a value of 0."
Next Step:
I draw a line in the middle of a door that executes a script. That script says, if doorCheck is equal to 0 (which it is) then change the value to 1.

Then when the player gets to the door it says, "Wait. I got to check to see the value of this variable." If the value of doorCheck is equal to 1 (then you've passed through a specific door) and you've changed the value. In this case the door will open.

If the player doesn't pass through the door, the int is not changed and the door fails to open with a message displayed.

Is it supposed to be:

{
 if
  {}
 else
  {}
}
or
{
 if
  {}
}
 else
... no that doesn't make sense because that would close of the script before the "else"

When I tried to use, then, it says, "function then is used buy not defined".


I understand the principal of nesting to degree from HTML,

Share this post


Link to post

The function is defined in zcommon.acs. Try putting this line before ANYTHING else:

#include "zcommon.acs"

This will make the code behave as if everything defined in zcommon (all those functions) was defined in the script.

Share this post


Link to post
NEANDERTHAL said:

The function is defined in zcommon.acs. Try putting this line before ANYTHING else:

#include "zcommon.acs"

All day, every day.

Share this post


Link to post
everennui said:

I'm sorry to blow up this thread today... but does anyone know how to turn on the lines that connect linedefs with actions to affected sectors in GZDB? I accidently shut it off and I can't find it in the Preferences > Control tab. What would that even be called? I've also looked at reference.html and google searched it, but no luck.


Do you mean Event Lines?



click the icon or press I to toggle

Share this post


Link to post
everennui said:

Is it supposed to be:

{
 if
  {}
 else
  {}
}

Yes. More precisely:

{
    if (condition)
    {
        instruction;
    }
    else if (other condition)
    {
        other instruction;
    }
    else
    {
        yet another instruction;
    }
}
You can have any number of "else if" between the opening if and the final else.

Share this post


Link to post
everennui said:

int doorCheck = 0;

Script 17 (void)
{
  if (doorCheck == 0);
       {
         doorCheck = 1;
       }
}
Script 18 (void)
{
  if (doorCheck == 1);
    {
      Door_Raise(53, 16, 0);
    }
  else (doorCheck == 0); //line 164
    {
      PrintBold("This door cannot be opened from here.");
    }
}

Remove the semicolons after each "if()" and "else()", here is why.

Share this post


Link to post

I don't know why I feel the need to bring it up, but I find code more readable if the open curly brace comes immediately after the if statement.

Example:

UGLY:

if(formattingSucks)
{
    //this sucks! :(
}



PRETTY:
if(formattingRules) {
    //this rules! :)
}
Spoiler

Another one I've taken to in recent years is variable formatting.

I now prefer "variableName" over "VariableName".

I guess I'm interested in other people's coding habits and preferences!

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
×