Custom Inventory & Respawn

Discuss all aspects related to modding Zandronum here.
User avatar
The_Spartan
 
Posts: 79
Joined: Fri Oct 12, 2012 1:12 pm
Location: Italy
Contact:

Custom Inventory & Respawn

#1

Post by The_Spartan » Sun Feb 02, 2014 11:07 pm

Hi guys, i have this problem:

I have these weapons, that are generated on the map and shown depending on the player class (it is supposed to be a multiplayer map) by an object that spawns them all (depending also on their own strenght) and makes each one shown only to a specific playerclass.

Now, I want the weapons to not disappear after they are picked up and be pickable suddenly by another player, and I can't use the sv_weaponstay command, because the object that is supposed to give you the weapon is just a custominventory item.

Just for example, i'll show you the definition of the object that is to give you the Fighter Axe from Hexen:
ACTOR AxeGiver : CustomInventory
{
SpawnID 27
Game Doom
Inventory.RespawnTics 35
Tag "Timon's Axe"
Inventory.PickupMessage "$TXT_WEAPON_F2"
//$Category Weapons
VisibleToPlayerClass "Fighter"
States
{
Spawn:
WFAX A -1
Stop
Pickup:
TNT1 A 0 A_JumpIfInventory("FWeapAxe", 1, "Failing")
TNT1 A 0 A_JumpIfInventory("ImaFighter", 1, "PickupWeapon")
Fail
Failing:
TNT1 A 0
Fail
PickupWeapon:
TNT1 A 0 A_GiveInventory("FWeapAxe", 1)
goto Spawn
}
}
Unfortunately, this item just disappears after a player picks it up. I've tried also to make the "axegiver" respawn with the command A_SpawnItem after pickup, but unfortunately, being the player the activator, the item just moves a bit on the floor following the player's movements, causing the object to move a bit on each pickup.

Any ideas? :(
Last edited by The_Spartan on Sun Feb 02, 2014 11:07 pm, edited 1 time in total.

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: Custom Inventory & Respawn

#2

Post by Vincent(PDP) » Thu Feb 20, 2014 10:16 am

Try adding

Code: Select all

TNT1 A 0 A_SpawnItem("AxeGiver", 0)
to the PickupWeapon line.

But why do you have to make it an inventory item?
Just take the weapon itself and add:

Code: Select all

Spawn:
  WFAX A -1
  Stop
And then give the weapon a number

Code: Select all

ACTOR <Name> : Weapon <Random number here>
Last edited by Vincent(PDP) on Thu Feb 20, 2014 10:20 am, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Untitled
Forum Regular
Posts: 519
Joined: Sat Dec 29, 2012 4:41 pm
Location: it is a mystery

RE: Custom Inventory & Respawn

#3

Post by Untitled » Thu Feb 20, 2014 6:36 pm

He wants to make it so only a certain playerclass can pick it up. I'm assuming he's just using Axe as frame of reference.
Last edited by Untitled on Thu Feb 20, 2014 6:38 pm, edited 1 time in total.
"I'm in despair! The fact someone would give me the title 'Forum Regular' has left me in despair!"
Spoiler: Me in a nutshell (Open)
<Untitled> this is a terrible idea
<Untitled> lets do it anyway

<Untitled> Depends
<Untitled> What kind of wad error is "Address not Mapped to Object (Signal 11)"?

<Untitled> So today I found out that stupidity is nested fractally
<Untitled> There is no lower bound
Projects:
SamsaraHold http://zandronum.com/forum/showthread.php?tid=3053

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: Custom Inventory & Respawn

#4

Post by Ijon Tichy » Thu Feb 20, 2014 6:48 pm

You have to use ACS to get a CustomInventory to respect sv_weaponstay. Things get more complicated then.
If you just want it to stay when you pick it up, use 'fail' (as you already are for the no-pickup cases), and the inventory item won't leave the floor, you won't get a pickup flash, no sound will play, and you won't get a pickup message. The flash and sound can be done with DECORATE, and the message can either be horribly faked with A_Print, or more convincingly faked with clientside ACS and Log (read msg0color to find out what color to make the message).

Also, why are you jumping to Spawn in a pickup state? Just use a 'stop'.

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: Custom Inventory & Respawn

#5

Post by Vincent(PDP) » Sat Feb 22, 2014 9:43 am

Untitled wrote: He wants to make it so only a certain playerclass can pick it up.
I get that, but who says you cannot try putting VisibleToPlayerClass on a weapon?
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

User avatar
The_Spartan
 
Posts: 79
Joined: Fri Oct 12, 2012 1:12 pm
Location: Italy
Contact:

RE: Custom Inventory & Respawn

#6

Post by The_Spartan » Sat Feb 22, 2014 7:54 pm

Ijon Tichy wrote: You have to use ACS to get a CustomInventory to respect sv_weaponstay. Things get more complicated then.
If you just want it to stay when you pick it up, use 'fail' (as you already are for the no-pickup cases), and the inventory item won't leave the floor, you won't get a pickup flash, no sound will play, and you won't get a pickup message. The flash and sound can be done with DECORATE, and the message can either be horribly faked with A_Print, or more convincingly faked with clientside ACS and Log (read msg0color to find out what color to make the message).
So, your idea is just to simulate a normal pickup even if it doesn't really happen?

User avatar
Popsoap
 
Posts: 86
Joined: Mon Jun 04, 2012 2:38 pm
Location: Inside a wall

RE: Custom Inventory & Respawn

#7

Post by Popsoap » Sat Feb 22, 2014 10:47 pm

Vincent(PDP) wrote: I get that, but who says you cannot try putting VisibleToPlayerClass on a weapon?
I'm certain that doesn't prevent it from being picked up, it just makes it invisible to every class except the one specified.

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: Custom Inventory & Respawn

#8

Post by Vincent(PDP) » Sun Feb 23, 2014 12:59 pm

The_Spartan, change 'CustomInventory' into Weapon, add a DoomEdNum and see what happens.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

User avatar
CloudFlash
Zandrone
Posts: 1074
Joined: Mon Jun 04, 2012 5:35 pm
Location: Wonderland (except not really)

RE: Custom Inventory & Respawn

#9

Post by CloudFlash » Sun Feb 23, 2014 1:16 pm

Maybe make it so when unauthorized player class picks it up, it immediately throws another one behind itself and erases itself from this player's inventory?
That's how would I do it, anyway
https://i.imgflip.com/i5tpe.jpg
*Hey, who wants to hear my solution to the modern world's problems? ^Me! %Me! @Me! #Me! *WELL TOO BAD @Did he just stab himself with this butcher knife? %Looks like it ^Hey, the pizza guy arrived! %Pizza! Yey

User avatar
The_Spartan
 
Posts: 79
Joined: Fri Oct 12, 2012 1:12 pm
Location: Italy
Contact:

RE: Custom Inventory & Respawn

#10

Post by The_Spartan » Sun Feb 23, 2014 2:33 pm

CloudFlash wrote: Maybe make it so when unauthorized player class picks it up, it immediately throws another one behind itself and erases itself from this player's inventory?
That's how would I do it, anyway
Tried, it makes the pickup weapon spawn a bit far away from the original position, making it move on each pickup. I'll tell you, it's quite funny too. :lol:

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: Custom Inventory & Respawn

#11

Post by Vincent(PDP) » Mon Feb 24, 2014 12:27 am

The_Spartan wrote: Tried, it makes the pickup weapon spawn a bit far away from the original position, making it move on each pickup. I'll tell you, it's quite funny too. :lol:
Either "cheat":

Code: Select all

ACTOR FWeapAxe : Weapon <DoomEdNum>
{
<Some of your code here>
States
{
Ready:
  TNT1 A 0 A_JumpIfInventory("ImaFighter", 0, NoWay)
  <More of your code>
  Stop
Select:
  TNT1 A 0 A_JumpIfInventory("ImaFighter", 0, "NoWay")
   ??? ? ? 1 A_Raise
  Loop
NoWay:
  TNT1 A 0 A_TakeInventory("FWeapAxe", 1)
  TNT1 A 0 A_Print("You're not allowed to pick up this weapon.")
  Stop
}
}
Or you can use ACS (Best way):

Code: Select all

Script 123 (void)
{
Spawn("AxeGiver", GetActorX(ActivatorTID()), GetActorY(ActivatorTID()), GetActorZ(ActivatorTID()), 0, 0)
}
If you want, send me the mod and i can fix the ACS part for you.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: Custom Inventory & Respawn

#12

Post by Vincent(PDP) » Thu Mar 13, 2014 6:55 am

Have you solved the problem yet? :3
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

User avatar
The_Spartan
 
Posts: 79
Joined: Fri Oct 12, 2012 1:12 pm
Location: Italy
Contact:

RE: Custom Inventory & Respawn

#13

Post by The_Spartan » Wed Mar 19, 2014 7:23 pm

Vincent(PDP) wrote: Have you solved the problem yet? :3
It just doesn't work: when you use the ActivatorTID command on the script, it considers the PLAYER as the activator, so it spawns the weapon where the player is, not where the weapon was before.
Considering also that using this method doesn't help much, because i would have to use a different script on each weapon, which is impossible.

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: Custom Inventory & Respawn

#14

Post by Vincent(PDP) » Wed Mar 19, 2014 9:08 pm

The_Spartan wrote:
Vincent(PDP) wrote: Have you solved the problem yet? :3
It just doesn't work: when you use the ActivatorTID command on the script, it considers the PLAYER as the activator, so it spawns the weapon where the player is, not where the weapon was before.
Considering also that using this method doesn't help much, because i would have to use a different script on each weapon, which is impossible.
How about this?

Code: Select all

 PickupWeapon:
 TNT1 A 0 A_GiveInventory("FWeapAxe", 1)
 Fail

--------------------------------------------------------------------------------------------


(Please try the above one first) A little change on the ACS:

Code: Select all

Script 123 (void)
{
Spawn("AxeGiver", GetActorX(0), GetActorY(0), GetActorZ(0), 0, 0)
}
And then on the weapon:

Code: Select all

PickupWeapon:
 TNT1 A 0 A_GiveInventory("FWeapAxe", 1)
 TNT1 A 0 ACS_ExecuteAlways(123, 0, 0, 0, 0)
 Stop
Last edited by Vincent(PDP) on Wed Mar 19, 2014 9:15 pm, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

User avatar
The_Spartan
 
Posts: 79
Joined: Fri Oct 12, 2012 1:12 pm
Location: Italy
Contact:

RE: Custom Inventory & Respawn

#15

Post by The_Spartan » Thu Mar 20, 2014 7:39 pm

Same thing again...

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: Custom Inventory & Respawn

#16

Post by Vincent(PDP) » Fri Mar 21, 2014 9:50 am

The_Spartan wrote: Same thing again...
I've got it! I actually think this should work:

Code: Select all

PickupWeapon:
TNT1 A 0 A_GiveInventory("FWeapAxe", 1)
TNT1 A 0 ACS_ExecuteAlways(123, 0, x, y, z)
Stop
And:

Code: Select all

Script 123 (int x, int y, int z)
{
Spawn("AxeGiver", x, y, z, 0, 0);
}
Last edited by Vincent(PDP) on Fri Mar 21, 2014 12:56 pm, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

User avatar
The_Spartan
 
Posts: 79
Joined: Fri Oct 12, 2012 1:12 pm
Location: Italy
Contact:

RE: Custom Inventory & Respawn

#17

Post by The_Spartan » Fri Mar 21, 2014 7:56 pm

Vincent(PDP) wrote:
The_Spartan wrote: Same thing again...
I've got it! I actually think this should work:

Code: Select all

PickupWeapon:
TNT1 A 0 A_GiveInventory("FWeapAxe", 1)
TNT1 A 0 ACS_ExecuteAlways(123, 0, x, y, z)
Stop
And:

Code: Select all

Script 123 (int x, int y, int z)
{
Spawn("AxeGiver", x, y, z, 0, 0);
}
Still nothing. I don't think that declaring new integers x y and z would mean checking the weapon position :surprised: I just think that we need to set the activator to be the OBJECT (the weapon) and not the player, so it doesn't respawn where the player is but where the weapon was on its original position.

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: Custom Inventory & Respawn

#18

Post by Vincent(PDP) » Fri Mar 21, 2014 8:16 pm

But it should work, try putting it on the regular pickup instead...
Because these x, y, z variables

Code: Select all

TNT1 A 0 ACS_ExecuteAlways(123, 0, x, y, z)
are used in decorate to get the objects position... See more: http://zdoom.org/wiki/DECORATE_expressions#Variables

Can you send me the wad, or atleast a PWAD with the weapon in? I'll see what i can do.
Last edited by Vincent(PDP) on Fri Mar 21, 2014 8:17 pm, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

User avatar
The_Spartan
 
Posts: 79
Joined: Fri Oct 12, 2012 1:12 pm
Location: Italy
Contact:

RE: Custom Inventory & Respawn

#19

Post by The_Spartan » Sat Mar 22, 2014 6:06 pm

They just don't work. I think they do ONLY in Decorate Expressions.

Yes, i can send you the wad. I would be very grateful to you if you could fix this annoying problem for me. Private Message?

Klofkac
Forum Regular
Posts: 481
Joined: Sat Jun 09, 2012 1:31 pm
Location: Ask Grandvoid servers

RE: Custom Inventory & Respawn

#20

Post by Klofkac » Sat Mar 22, 2014 6:16 pm

It might not be good thing, but try replacing the Stop in PickupWeapon with Fail.
𝕂𝕝𝕠𝕗𝕜𝕒𝕔

Post Reply