Actor dependent item behavior?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Actor dependent item behavior?

Postby Zom-B » Sat Sep 04, 2021 11:55 am

Is it possible, in DECORATE/ACS (Zandronum compatibility), to make a pickup item that looks different and acts different depending on the inventory of each player?

I've managed as far as looking and acting different depending on the inventory of player 1, but I now want it to be multiplayer compatible.

For example, imagine two identical items next to each other on the floor, e.g. BFG9000. When player 1 picks up the BFG9000, he gets the weapon (custom non-conflicting actor BFG9000Weapon), and the other item turns into a BFG10K sprite. Player 2 still sees a BFG9000 on the floor because his inventory doesn't contain a BFG9000Weapon.

Code: Select allExpand view
ACTOR BFGItem : CustomInventory replaces BFG9000 {
   //Inventory.PickupMessage "$PICKUP_BFG10K" FIXME
     Inventory.PickupSound "misc/w_pkup"

   States {
         TNT1 A 0 A_JumpIfInventory("BFG9000Weapon", 1, "Spawn_BFG10K", AAPTR_PLAYER1)
         BFUG A 1
         goto Spawn
         BFG2 A 1
         goto Spawn

         TNT1 A 0 A_JumpIfInventory("BFG9000Weapon", 1, "Pickup_BFG10K")
         TNT1 A 0 A_GiveInventory("BFG9000") // For the status bar number
         TNT1 A 0 A_GiveInventory("BFG9000Weapon")
         TNT1 A 0 A_TakeInventory("BFG9000Weapon")
         TNT1 A 0 A_GiveInventory("BFG10K")

ACTOR BFG9000Weapon : BFG9000 { }

ACTOR BFG10K : DoomWeapon {

Joined: 31 Jul 2011

Re: Actor dependent item behavior?

Postby Jarewill » Sat Sep 04, 2021 12:35 pm

Sadly it's impossible to make it multiplayer compatible without the use of ZScript.
You only have access to the PLAYER1 pointer and that's it.

While not of help to you, this is how it can be done in ZScript for anyone else that needs it:
Joined: 21 Jul 2019

Re: Actor dependent item behavior?

Postby Zom-B » Sat Sep 04, 2021 1:13 pm

OK, that's unfortunate.

In that case, (for future readers) I'll do it differently. The pickup item will just be the same sprite for everyone, but the Pickup state increases a counter (dummy inventory item) in the player, and the player's DECORATE will upgrade/swap weapons accordingly.
Joined: 31 Jul 2011

Return to Scripting

Who is online

Users browsing this forum: NeoTerraNova and 1 guest