Garry's Mod

Garry's Mod

Battle Royale
Denne tråd er blevet låst
Eliwynn 22. mar. 2017 kl. 15:09
Can we randomize the weapons ?
If someone know how to randomize weapons it will be great.
I'm lazy after 5 games to see the guns are always the same in the same place....
So the strat will be to aim landing at one point to find our favorite weapon and begin killing ppl..
Please I want an answer :)
Sidst redigeret af Eliwynn; 22. mar. 2017 kl. 15:10
< >
Viser 1-2 af 2 kommentarer
murray  [udvikler] 22. apr. 2017 kl. 12:41 
Yes, opening shared.lua you can edit the weapon drop on LootSpawn() function. You can change the weapons on the same function of the drop changing.
Example:

local M4A1 = ents.Create( "weapon_m4a1" ) #weapon entity
if ( !IsValid( M4A1 ) ) then return end
M4A1:SetPos( Vector( 13826, 12370, -7000 ) ) # position
M4A1:Spawn()

#weapon entiy: you will change this line for the your workshop weapon entity name.
#position: changing the vector = changing the weapon spawn position, you can make it random making a table and using math.random function too.

Example to make it random:

Put this code in the beginning of LootSpawn() function

weapon_positon = { Vector( 13826, 12370, -7000 ), Vector( 4232, 2342, -7000 )}

then change M4A1:SetPos( Vector( 13826, 12370, -7000 ) ) to
M4A1:SetPos( table.random(weapon_position) )

Of course, put more vectors on the weapon_position table.
murray  [udvikler] 28. juli 2017 kl. 13:47 
random weapons on spawn added on patch 21 [0.3a]
< >
Viser 1-2 af 2 kommentarer
Per side: 1530 50