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

zdoom editing questions

Recommended Posts

In ZDoom, is this possible in a script:

- pick up more than one of the same key while telling ZDoom how many of those keys you have picked up after each key has been picked up
- one key gets taken from your inventory after you use it

So it'd be like: you pick up two red keycards, open a red door, now you have one red keycard left, open another red door, now you have no red keycards left.

If not with keys, then with a different item?

Share this post


Link to post

Try with puzzle items, like Hexen does (like that flame mask). They're essentially keys that are lost after use.

Share this post


Link to post

Thanks, that sounds perfect. I haven't done this sorta stuff before, so I'm a newbie. Can you carry more than one of the same puzzle item? There will be 4 different colors of keys and sometimes you'll have to carry more than one of the same color. Does this involve DECORATE?

Share this post


Link to post

Yes, you can carry several. (In Hexen, up to 25; but ZDoom allows you to select your own maximum value if so you want.) And yes, you'll have to make new DECORATE actors, but that won't be very complicated; a puzzle item definition is very simple.

Look at the ZDoom wiki, it should explain all you need to know:
http://zdoom.org/wiki/Classes:PuzzleItem

Share this post


Link to post
Creaphis said:

Ah, Zelda logic.


If you leave the key where it was used, (Korax skull for example) then it's logic that you no longer carry it with you.

Share this post


Link to post

Ok, it took my brain a while, but the decorate seems to be working. But, now I ran into a problem with this script:

#include "zcommon.acs"

script 1 (void)
{
	if (GetSectorFloorZ (1,0,0) > 1.0)
		UsePuzzleItem (19,2);
	else
		Print (s:"You need a green key!");
}
In this map, locked doors will be raised floors that you lower by pressing on them if you have the key (puzzle item). So I set one of the linedefs of a raised floor to execute script 1. It's set to repeatable so that you can still lower the floor if you've already tried pressing on the raised floor without the key. But, since puzzle items are used, you can accidentally use more than one key if you press more than once. That's why I used GetSectorFloorZ (it refers to sector with tag 1), so you only use a key if the floor hasn't been lowered yet. The script that UsePuzzleItem refers to (script 2) lowers the raised floor instantly.

But, I get an error when I try to compile the script and I'm not sure how to get it working:
Line 5 in file "script.acs" ...
script.acs:5: Function getsectorfloorz is used but not defined.
script.acs:6: Function usepuzzleitem is used but not defined.
20 doll hairs goes to the person who shows me my mistake (hairs are not real).

Share this post


Link to post

You may need to download a more recent ACC and definition files than the one you're currently using. See here.

Share this post


Link to post

Hmm, it still says "Function usepuzzleitem is used but not defined". Even if I set UsePuzzleItem as a line special, nothing happens when I press it. Here's what I wrote in the decorate lump:

actor KEYG : PuzzleItem 19019
{
     puzzleitem.number 19
     inventory.amount 1
     inventory.maxamount 666
     inventory.pickupmessage "You found a green key!"
     inventory.icon "KEYGA0"
     +INVENTORY.INVBAR
     +NOGRAVITY
     +FLOATBOB
     states
     {
     Spawn:
     KEYG A -1
     stop
     }
}
Edit: since I'm not smrt enough to use puzzle items, I'm just gonna replace the different ammo types with keys and then use checkinventory/takeinventory to open locked doors. Thanks for the help though, Gez.

Share this post


Link to post

No, that's a genuine bug. zspecial.acs is missing a line with

	129:UsePuzzleItem(2),
However, GetSectorFloorZ is there if you have a recent version.

Share this post


Link to post

It turns out that UsePuzzleItem must be used directly on a line, and cannot be used in a script.

Share this post


Link to post

Ok thanks. I ended up using the different types of ammo after all.
But now I have another question. In this pic:



Is it possible to make that red dot (a thing or projectile) travel around the black wall continuously at a constant speed? One way I can think of is to keep teleporting the thing silently around the wall in a script and loop it, but it would be better if the thing would just travel that route by itself.

Edit: n/m

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  
×