Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Grey_Wolf

Jump not working on CustomInventory item

Question

So, I'm making this player class that loses a bunch of random weapons when he enters a new map.
To do this, I'm making multiple actor, one for each weapon, that actually take the weapon from you.

I tried with something like this:

Spoiler

Actor SSGtaker : CustomInventory
{
Inventory.PickupMessage "\cGWho said that break action \cFSAWED OFF  \cGSHOTGUNS never break? I think someone said that. Well he was wrong. Especially when it gets crushed by demons."
   States
   {
 Spawn:
   TNT1 A 0
   TNT1 A 1
   Loop
   
 Pickup:
   TNT1 A 0
   TNT1 A 0 A_TakeInventory("SSG",1)
   TNT1 A 0 A_TakeInventory("SSGAmmo",2)
   TNT1 A 0 A_GiveInventory("AmmoShell",2)
   Stop
   
   }
}

 

And everything works like a charm, but I don't quite like it. This way I should spawn the items right under the player's feet, and make him pick them up. Furthermore, the message will show whether the player has the weapon or not.
So I tried this:

 

Spoiler

Actor Shotguntaker : CustomInventory
{
   +INVENTORY.QUIET
   States
   {
 Spawn:
   TNT1 A 0
   TNT1 A 1
   TNT1 A 1 A_JumpIfInventory("Shot_Gun",1,"Loss")
   Loop
   
 Loss:
   TNT1 A 0
   TNT1 A 0 A_Log("\cGYour trusted \cFSHOTGUN  \cGfailed you. With it malfunctioning, You'll have to find another one...")
   TNT1 A 0 A_TakeInventory("Shot_Gun",1)
   TNT1 A 0 A_TakeInventory("SlugShotgun",1)
   TNT1 A 0 A_TakeInventory("ShotgunAmmo",9)
   Stop
   
   }
}

 

But it seems like the jump is not performed even If I have the shotgun in inventory. What did I do wrong?

Share this post


Link to post

4 answers to this question

Recommended Posts

  • 0

Is Shot_Gun the correct name for your shotgun actor?  Also, you are also removing the SlugShotgun without checking if the player has one.

 

Anyway, this looks like a job for an ENTER script in ACS.  I was intimidated by ACS for quite a while, but when I finally dove in, it turned out to be not so hard.

 

Here is a rough example:

script 42 ENTER
{
	if (CheckInventory("Shot_Gun") == 1)
	{
		Log(s:"Your Shotgun has failed!  You will have to find another one.");
		TakeInventory("Shot_Gun",1);
		TakeInventory("SlugShotun",1);
		TaleInventory("ShotgunAmmo",9);
	};
}

 

Share this post


Link to post
  • 0

Does your example work when the player enters ANY map of ANY wad? Because I'm not trying to create new  maps, only doing a gameplay/rebalance mod

Share this post


Link to post
  • 2

It should work, if you make the script a named script (so it won't conflict with anybody else's script numbers), put it in a library, and load that library in LOADACS.  Give the script a name that nobody else will use, like GWShotgunTaker.

 

Remember, ACS needs to be compiled, unlike DECORATE.  Slade is a great tool for ACS and lots of other wad-making things.

 

Also, I believe that the color codes you were using should work in ACS, too.

 

Here again is the link for the ACS page.  It is how I learned.  Bookmark it, and refer to it as needed.  I do.

https://zdoom.org/wiki/ACS

Share this post


Link to post
  • 0
8 hours ago, Empyre said:

It should work, if you make the script a named script (so it won't conflict with anybody else's script numbers), put it in a library, and load that library in LOADACS.  Give the script a name that nobody else will use, like GWShotgunTaker.

 

Remember, ACS needs to be compiled, unlike DECORATE.  Slade is a great tool for ACS and lots of other wad-making things.

 

Also, I believe that the color codes you were using should work in ACS, too.

 

Here again is the link for the ACS page.  It is how I learned.  Bookmark it, and refer to it as needed.  I do.

https://zdoom.org/wiki/ACS

 

Thanks, you've been very helpful, I'll try that! :D

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
×