ItsMods

Full Version: Random List Selector
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
For example

I have

weapons[] = [];
weapons[1]= "shit_sp"
weapons[2]= "poo_sp"

and

weapons2[] = [];
weapons2[1]= "test_sp"
weapons2[2]= "wazza_sp"

weapon = weapons[RandomInt(weapons.size)];
weapon2 = weapons2[RandomInt(weapons2.size)];

can I add another random that select one of those 2 list randomly?
Code:
derp[] = [];
derp[1]= "shit_sp"
derp[2]= "poo_sp"
derp[3]= "test_sp"
derp[4]= "wazza_sp"

derp1 = derp[RandomInt(derp.size)];



this?


OR

Code:
weapon[] = [];
weapon[1] = weapons[RandomInt(weapons.size)];
weapon[2] = weapons2[RandomInt(weapons2.size)];
weapon = weapon[RandomInt(weapon.size)];



Never needed to use rand ints, but by the look of how you done it they should work?
(08-05-2011, 20:11)koil Wrote: [ -> ]
Code:
derp[] = [];
derp[1]= "shit_sp"
derp[2]= "poo_sp"
derp[3]= "test_sp"
derp[4]= "wazza_sp"

derp1 = derp[RandomInt(derp.size)];



this?


OR

Code:
weapon[] = [];
weapon[1] = weapons[RandomInt(weapons.size)];
weapon[2] = weapons2[RandomInt(weapons2.size)];
weapon = weapon[RandomInt(weapon.size)];



Never needed to use rand ints, but by the look of how you done it they should work?

I will use 2nd thx (seems to be he best)

hum how I am gonna give me the weapon?
np, atleast i know how to make rand weapon selection now Big Grin
(08-05-2011, 20:24)koil Wrote: [ -> ]np, atleast i know how to make rand weapon selection now Big Grin

hum how am I gonna give myself the weapon with your code?
take all weapons - if u need to.. then just..

self giveweapon( weapon );

should work?
(08-05-2011, 20:27)koil Wrote: [ -> ]take all weapons - if u need to.. then just..

self giveweapon( weapon );

should work?

lol nvm your code doesnt work I get unitialised varaible for the weapons in
weapons[RandomInt(weapons.size)];
does ur original post work?
(08-05-2011, 20:40)koil Wrote: [ -> ]does ur original post work?

yep
weapons[] = [];
weapons[1]= "shit_sp"
weapons[2]= "poo_sp"

weapons2[] = [];
weapons2[1]= "test_sp"
weapons2[2]= "wazza_sp"

weapon[] = [];
weapon[1] = weapons[RandomInt(weapons.size)];
weapon[2] = weapons2[RandomInt(weapons2.size)];

endweapon = undefined;
endweapon = weapon[RandomInt(weapon.size)];

self giveweapon( endweapon );




Try that.
Pages: 1 2