Noob question - Pistol
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
-
- Posts: 132
- Joined: Sat Jan 01, 2005 10:11 pm
- Location: Saint Paul, MN
Noob question - Pistol
I have a quick question.
How do I make it so you spawn with a random pistol weapon? For example. I start a new game and instead of the pistol, it's the Gold Wand. Then I start another new game, and instead of the Gold Wand, it's the pistol? I tried looking into the wiki,, put couldn't find anything. So if I missed it, sorry.
Anybody that can help me out?
How do I make it so you spawn with a random pistol weapon? For example. I start a new game and instead of the pistol, it's the Gold Wand. Then I start another new game, and instead of the Gold Wand, it's the pistol? I tried looking into the wiki,, put couldn't find anything. So if I missed it, sorry.
Anybody that can help me out?
- The NUtcracker
- Posts: 843
- Joined: Sun Jan 14, 2007 9:12 pm
- Location: South Dakota
- Contact:
-
- Posts: 132
- Joined: Sat Jan 01, 2005 10:11 pm
- Location: Saint Paul, MN
The following enter script swaps the player's starting inventory half the time.
Note if this is to be used in a library, you will need a flag that disables it after the first time it is run. This is to avoid the script having an effect on subsequent maps.
Code: Select all
script 1 ENTER {
if (random(0, 1)) {
TakeInventory("Pistol", 1);
TakeInventory("Clip", 50);
GiveInventory("GoldWand", 1);
GiveInventory("GoldWandAmmo", 20); // May need to adjust that number, that's from memory
}
}
- Project Shadowcat
- Posts: 9369
- Joined: Thu Jul 14, 2005 8:33 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: Blacksburg, SC USA
- Contact:
This seems to work not too badly, given that I have terrible code writing skills and that it could be improved greatly 

- Attachments
-
random-test1.zip
- I can't figure out though WHY the cell pack spawns everytime :/
- (1.14 KiB) Downloaded 21 times
- Project Shadowcat
- Posts: 9369
- Joined: Thu Jul 14, 2005 8:33 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: Blacksburg, SC USA
- Contact:
Then it should be 30. Eh, whatever, the player always likes more ammo.HotWax wrote:Ah, but how much does the GoldWand give?
The number above should be (NormalStartAmmo - GoldWandAmmoGive).
...
Hmm, but it should be noted that the Elvenwand only has a maximum capacity of 100, as opposed to the pistol's 200.
-
- Posts: 132
- Joined: Sat Jan 01, 2005 10:11 pm
- Location: Saint Paul, MN