Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
The Doommer

One-Level Use Gun

Recommended Posts

I want to add a weapon which is only usable in one level , and then replaces with another weapon which is going to be used in every level (don't count the level that the one level use weapon uses)
Can i do this with DECORATE , etc ?

Share this post


Link to post

No, but you can do it by manipulating player's inventory via ACS - upon start of the next level, check if the player has the weapon, and if he does, take it from him and give him the other weapon.

In practice: Make the 2 weapons normally in DECORATE. Let's say you named them "TheDoommersWeapon1" and "TheDoommersWeapon2". Then put this ACS script to your second map:

#include "zcommon.acs"

script 1 ENTER {
    if(CheckInventory("TheDoommersWeapon1")) {
        TakeInventory("TheDoommersWeapon1",1);
        GiveInventory("TheDoommersWeapon2",1);
    }
}

Share this post


Link to post
scifista42 said:

No, but you can do it by manipulating player's inventory via ACS - upon start of the next level, check if the player has the weapon, and if he does, take it from him and give him the other weapon.

In practice: Make the 2 weapons normally in DECORATE. Let's say you named them "TheDoommersWeapon1" and "TheDoommersWeapon2". Then put this ACS script to your second map:

#include "zcommon.acs"

script 1 ENTER {
    if(CheckInventory("TheDoommersWeapon1")) {
        TakeInventory("TheDoommersWeapon1",1);
        GiveInventory("TheDoommersWeapon2",1);
    }
}

There is a problem here :
That weapon is in a secret , not given by normal way...
EDIT : I think it was my mistake , sorry.
Thanks

Share this post


Link to post
The Doommer said:

I want when the doomguy takes the weapon , it gets replace by a weapon, how ?


Based on what your saying you might as well just make a new weapon in Decorate and place the file into your wad via Slade for pickup.

However if you're saying you want one level where the player is carrying a shotgun and when he picks up a health bonus (or anything you set it to) and suddenly the shotgun changes into a custom new weapon for the remainder of the level you can do so via ACS similar to the example above. You will also need to include the custom resource in your wad file. Change the ENTER into (void) and set the specific "Thing" to have script execute 1.

#include "zcommon.acs"

script 1 (void)

{
if(CheckInventory("TheDoommersWeapon1")) {
TakeInventory("TheDoommersWeapon1",1);
GiveInventory("PieceOfCheese",1);
}
}

However with my technique in mind there might be a fatal flaw, that being if you pick up the shotgun it may include both your new and old weapon in the inventory or just replace your current back to the original weapon. Or not, I never tried this before.

Share this post


Link to post

Alternatively: In DECORATE, redefine the "Select" state of the 2nd weapon to remove the 1st weapon from player's inventory. Example:

  Select:
    ABCD A 0 A_TakeInventory("MyFirstWeapon",1)
  Select2:
    ABCD A 1 A_Raise
    loop

Share this post


Link to post
The Doommer said:

A question by the way...
Can i set their slot number both as 0 ?
won't ZDoom generate an error ?

yes you can, using KEYCONF .

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
×