Forum

> > CS2D > General > Random Weapon?
ForenübersichtCS2D-ÜbersichtGeneral-ÜbersichtEinloggen, um zu antworten

Englisch Random Weapon?

9 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Random Weapon?

redstar
User Off Offline

Zitieren
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

alt Re: Random Weapon?

Zune5
COMMUNITY BANNED Off Offline

Zitieren
Yeah lua scripts basically. And even if you requested it to DC, he probably would make a .lua script instead.

alt Re: Random Weapon?

DC
Admin Off Offline

Zitieren
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.

alt Re: Random Weapon?

Lee
Moderator Off Offline

Zitieren
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.

alt Re: Random Weapon?

redstar
User Off Offline

Zitieren
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 --)

alt Re: Random Weapon?

Tehmasta
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenGeneral-ÜbersichtCS2D-ÜbersichtForenübersicht