[DECORATE] [SOLVED] How to make sv_weaponstay work on spawned weapons?

Discuss all aspects related to modding Zandronum here.
Post Reply
Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

[DECORATE] [SOLVED] How to make sv_weaponstay work on spawned weapons?

#1

Post by Konda » Mon Jun 06, 2016 12:57 pm

I'm essentially trying to replace one weapon in the map with another weapon, and to make it configurable so I can choose what I can replace the weapons with. I thought it would be a good idea to make an actor that replaces all weapons, and would spawn a weapon depending on what I tell it to. I want this spawned weapon to remain on the ground permanently and behave like a normal weapon that was placed in the map by the mapper. Is there any way to apply sv_weaponstay behavior to spawned weapons?

I know I can apply some hax but I'm trying to keep the code simple so it can be easily extended for custom weapons. I'm relying on the tiny possibility that there is some function that allows me to have a spawned weapon treated like the weapons that are placed by the mapper.
Last edited by Konda on Mon Jun 06, 2016 7:50 pm, edited 1 time in total.

User avatar
Ænima
Addicted to Zandronum
Posts: 3579
Joined: Tue Jun 05, 2012 6:12 pm

[DECORATE] Re: How to make sv_weaponstay work on spawned weapons?

#2

Post by Ænima » Mon Jun 06, 2016 1:16 pm

Weapons spawned via RandomSpawner respect sv_weaponstay.

I know because in my Doom64 mod a few versions ago, I made an enemy drop a RandomSpawner that dropped another RandomSpawner which spawned a chaingun, which caused the level to fill with chainguns which couldn't be picked up if you already had one, unless I turned sv_weaponstay off.
Reinforcements: midgame Survival joining/respawning
Doom64: Unabsolved: Doom64 + Diablo II
ZandroSkins: a pack made by our community
AeniPuffs: 3D blood and bullet puff effects, free to use for your own mods
Squad Radio: a WASD-based radio chat menu, add your own custom sounds!
Mercenaries (on hold)
Image

User avatar
Combinebobnt
Retired Staff / Community Team Member
Posts: 1905
Joined: Mon Jun 04, 2012 3:37 am
Location: Earth
Contact:

[DECORATE] Re: How to make sv_weaponstay work on spawned weapons?

#3

Post by Combinebobnt » Mon Jun 06, 2016 2:08 pm

Nice I will try that aenima

edit: works

User avatar
SwordGrunt
Forum Regular
Posts: 377
Joined: Thu Jun 07, 2012 8:43 pm

[DECORATE] Re: How to make sv_weaponstay work on spawned weapons?

#4

Post by SwordGrunt » Mon Jun 06, 2016 2:49 pm

If for whatever reason you can't work with a RandomSpawner, have the actor remove its own DROPPED flag in its Spawn state, which is what lets the game know it was spawned/dropped instead of placed directly on the map. This does have its side effects since manually dropping the weapon/item would also clear its DROPPED flag, so you can make an item respawn indefinitely (and its spawn point is usually desynced) the same way you can drop weapons to get infinite ammo.

Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

[DECORATE] Re: How to make sv_weaponstay work on spawned weapons?

#5

Post by Konda » Mon Jun 06, 2016 4:02 pm

Alright, thanks for the info, saved me a lot of trouble. Btw, do you guys know of a way to remove an item dropped by a randomspawner without modifying the item's Decorate code? What happens to the item if the randomspawner itself is removed?

Bloax
Forum Regular
Posts: 411
Joined: Mon Jun 04, 2012 5:11 pm

[DECORATE] Re: How to make sv_weaponstay work on spawned weapons?

#6

Post by Bloax » Mon Jun 06, 2016 6:18 pm

SwordGrunt wrote:the same way you can drop weapons to get infinite ammo.
You can fix that one by making weapon pickups not give any ammo though.

Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

[DECORATE] Re: How to make sv_weaponstay work on spawned weapons?

#7

Post by Konda » Mon Jun 06, 2016 7:49 pm

Konda wrote:Btw, do you guys know of a way to remove an item dropped by a randomspawner without modifying the item's Decorate code? What happens to the item if the randomspawner itself is removed?
I correctly answered my own question here. To remove an item dropped by a randomspawner, just remove the randomspawner. So this is officially SOLVED
Thank you guys again, you saved me a loooooooooot of work.

Post Reply