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

More Hexen ACS scripting woes (questions).

Recommended Posts

So. I have this area of a map where I give a text clue to find something that I want the player to find. In this case a key.

Now once that key is picked up. I don't want the player to keep activating the message. But I don't know how that works in Hexen/ACS. In FS I had to check the life of the item (usually over and over with a loop). And once it disappeared, the game considered it dead and the script would change. But I think ACS got something more eloquent in store for this. But I dunno how to do it and I am not sure where I can find a good example that I can look at.

Share this post


Link to post

IIRC and understand what you're asking for (a "you need to do that" message only until you retrieve the item):

Make the key activate a script on pick-up (by giving the thing an ACS_Execute special) that sets a global variable to 1 (it will be 0 on map startup). Make the message-triggering script check if that global variable is set, and only display the message if the variable is cleared.

If the key and the puzzle-door are in different maps of the hub, you'll need to use a 'world' variable instead. I don't remember how it's done exactly, but I guess it's about adding variables to an included ACS file that comes shipped with ACC. Hopefully the Hexen Specs covers this feature.

Share this post


Link to post

What Printz says (put special 80 on the key to make it trigger a script) would work. Alternatively, you may use a FraggleScript-like approach by using ThingCount (looking at the Hexen source code, it should work just like explained on the ZDoom wiki). The Hexen keys have spawn numbers in the 85-94 range, depending on type.

printz said:

If the key and the puzzle-door are in different maps of the hub, you'll need to use a 'world' variable instead. I don't remember how it's done exactly, but I guess it's about adding variables to an included ACS file that comes shipped with ACC. Hopefully the Hexen Specs covers this feature.

World scope is explained on the ZDoom wiki. I'm pretty sure it's the same system in vanilla Hexen, the only difference here would be that I think global scope is a ZDoom addition.

Share this post


Link to post

If the object is a key, it makes more sense to use CheckInventory() rather than ThingCount().

Is the message triggered in the map, say when crossing a linedef, or does it always stay on screen until you pick up the key? If it's the former, it's as simple as:

Script 1 (void)
{
  If(!CheckInventory("RedCard")) Print(s:"Clue about red key here.");
}
One line of code.

Share this post


Link to post

Having checked the hexen specs now, I can say that Gez is right concerning world variables, but it's also a good idea to define them in the central WVARS.ACS included file, so that every script can use them.

Also, as an erratum, I meant "map" scope in my post, not "global" scope which is ZDoom-exclusive. I was using general programming wording there.

I couldn't find 'CheckInventory' in the Hexen Specs, so I assume it doesn't exist in Hexen.

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  
×