ItsMods

Full Version: What's wrong with this?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Lol. the Array with the Weapons dont makes sense. :O
U define the Array[priamrywepsize] 100 times. why?
So... what's the error?

(08-28-2011, 02:04)Tomsen1410 Wrote: [ -> ]Lol. the Array with the Weapons dont makes sense. :O
U define the Array[priamrywepsize] 100 times. why?

You mean the first bit? He's just adding new elements to the array.
line 359, replace
Code:
else
with
Code:
} else {
(08-28-2011, 05:57)Phl3x_ Wrote: [ -> ]So... what's the error?

(08-28-2011, 02:04)Tomsen1410 Wrote: [ -> ]Lol. the Array with the Weapons dont makes sense. :O
U define the Array[priamrywepsize] 100 times. why?

You mean the first bit? He's just adding new elements to the array.

I think the primarywepsize hs an entity for example 1. when he dfines the array[1] 100 tikes it dont makes ense? or did i miss something? :O
(08-28-2011, 19:55)Tomsen1410 Wrote: [ -> ]I think the primarywepsize hs an entity for example 1. when he dfines the array[1] 100 tikes it dont makes ense? or did i miss something? :O

When he creates the array, it has a size of 0, and after each element that's added, the size increases.

PHP Code:
level.PrimaryWeapon = [];
// PrimaryWeapon.size is 0
level.PrimaryWeapon[level.PrimaryWeapon.size] = "mp5k_mp";
// PrimaryWeapon.size is now 1
level.PrimaryWeapon[level.PrimaryWeapon.size] = "skorpion_mp";
// PrimaryWeapon.size is now 2 etc 
is:
Code:
Random( level.var[ level.var.size ] );

correct? o_O


isn't :
self.PrimaryToGive = random(level.mp5k_attach[level.mp5k_attach.size]);
supposed to be
self.PrimaryToGive = level.mp5k_attach[ RandomInt( level.mp5k_attach.size ) ];
i already fixed it for him over steam chat yesterday, he didn't update the post.

and @iAegle
Code:
self.PrimaryToGive = random(level.mp5k_attach);
works

AFAIK this is random (its already built-in):
Code:
random( array )
{
return array[randomInt(array.size)];
}
ok. didnt knew.