"Randomizing weapons"
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.
- DBThanatos
- Posts: 3101
- Joined: Fri Apr 14, 2006 3:17 pm
- Location: in "the darkness that lurks in our mind"
OK, but the thing is that as far as I see, the "136" value, will not be really random, that is why I used two technics to make it more random (still its doesnt, but whatever).jimmy91 wrote:Here's the new decorate, it's still only spawning an IDShotgun.Code: Select all
actor _Shotgun 2001 { States { Spawn: SHOT A 0 A_Jump(136,2) SHOT A 1 A_SpawnItem("IDShotgun") Stop SHOT A 0 A_Jump(136,2) SHOT A 1 A_SpawnItem("IDSuperShotgun") Stop SHOT A 0 A_Jump(136,2) SHOT A 1 A_SpawnItem("M16AssaultRifle") Stop SHOT A 0 A_Jump(136,2) SHOT A 1 A_SpawnItem("HeavyShotgun") Stop SHOT A 0 A_Jump(136,2) SHOT A 1 A_SpawnItem("RiotGun") Stop SHOT A 1 A_SpawnItem("DoubleBarrelHandgun") Stop } }
This is the first one (decreasing probability) :
Code: Select all
Actor ShotgunSpawner 2001
{
Radius 20
Height 0
States
{
Spawn:
NULL A 0
NULL A 0 A_Jump(210,2)
NULL A 1 A_SpawnItem("Q2Shotgun",1)
Goto Death
NULL A 0 A_Jump(205,2)
NULL A 1 A_SpawnItem("Doom3Shotgun",1)
Goto Death
NULL A 0 A_Jump(200,2)
NULL A 1 A_SpawnItem("DShotgun2",1)
Goto Death
NULL A 0 A_Jump(195,2)
NULL A 1 A_SpawnItem("FCrossBow",1)
Goto Death
NULL A 0 A_Jump(190,2)
NULL A 1 A_SpawnItem("AutomaticShotgun",1)
Goto Death
NULL A 0 A_Jump(185,2)
NULL A 1 A_SpawnItem("Magnum",1)
Goto Death
NULL A 0 A_Jump(180,2)
NULL A 1 A_SpawnItem("FLightningSpell",1)
Stop
NULL A 0
Loop
Death:
NULL A 0
Stop
}
}
Code: Select all
Actor ZombieManSpawner 3004
{
+IsMonster
Radius 20
States
{
Spawn:
NULL A 0
NULL A 0 A_Jump(158,27)
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FZombieMan",1)
Goto Death
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FInvisibleGuy",1)
Goto Death
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FQ2Soldier1",1)
Goto Death
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FFistMarine",1)
Goto Death
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FQuakeDog",1)
Goto Death
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FQuakeZombie",1)
Goto Death
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FCultist2",1)
Goto Death
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FArmoredGuy",1)
Goto Death
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FPistolMarine",1)
Goto Death
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FGrunt",1)
Goto Death
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FPlasmaZombie",1)
Goto Death
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FGrenadeZombie",1)
Goto Death
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FInvisibleGuy2",1)
Goto Death
NULL A 0 A_Jump(160,2)
NULL A 1 A_SpawnItem("FRocketZombie",1)
Stop
NULL A 0
Goto Spawn
Death:
NULL A 0
Stop
}
}
To be precise, with the DECORATE posted the chances roughly are:DBThanatos wrote: OK, but the thing is that as far as I see, the "136" value, will not be really random.
IDShotgun - 47%
IDSuperShotgun - 25%
M16AssaultRifle - 13%
HeavyShotgun - 7%
RiotGun - 4%
DoubleBarrelHandgun - 4%
At least, that's how the math works out. To balance out, the probabilities need to be carried forward. So for example with only 3 weapons, the values for jump chances should be 170 (66% chance not to spawn the first weapon on the list) and 128 (50% chance to skip the second weapon on the list.) This carries forward properly because .66 * .5 = .33, or a 1/3 chance to select the second or third weapon (which matches the 1/3 chance to get the first.)