CS2D General Random Weapon? Random Weapon?
9 replies Hi all,
I want to create an entity to get a random weapon (like the mistery box in CoD 5)
Somebody know how to do it?
Thx I think that's impossible. Zune5 COMMUNITY BANNED Offline
PM lee, or he'll post it here. the entitiy is impossible, but its quite easy with scripts Zune5 COMMUNITY BANNED Offline
Yeah lua scripts basically. And even if you requested it to DC, he probably would make a .lua script instead. DC Admin Offline
yes. use a Lua script.
the cs2d command you need is spawnitem (see changelog). you have to call it in Lua with the parse command. Lee Moderator Offline
the concept is rather simple actually, all you need is a table that contains the code for all of the weapons, seed the random generator to the epoch time and use math.random(1, #wpntable) as the index, this will return a weapon code that is picked out at random. Thx you all, but i don't know how to do.
Can you tell me everything to do?
(sorry it's maybe wrong but im french --) lee, you dont need math.random(1,#wpntable)
math.random(#wpntable) would suffice, since if you only pass 1 parameter, it chooses a random number from 1 to that number Please answer, i don't understand.. What's a table?