Just wanted to ask this question about scripting:
What did I do wrong with this string of code?
Code:
SetEntityActive("c_" RandInt(1, 50), true);
I wanna make it so it makes a random entity with the numbers 1-50 to activate in the room at random with "c_" as the prefix.
That command doesn't spawn entities, it activates already spawned ones. As for the functionality, I'm not sure how you'd do it.
(07-14-2011, 10:17 PM)Roenlond Wrote: [ -> ]That command doesn't spawn entities, it activates already spawned ones. As for the functionality, I'm not sure how you'd do it.
Sry. I wuz trying to say I want them to spawn the de-activated ones.
Oh, so you've spawned 50 entities and want them to be activated at random? There's probably a way to do it, but someone else will have to chip in on that
(07-14-2011, 10:21 PM)Roenlond Wrote: [ -> ]Oh, so you've spawned 50 entities and want them to be activated at random? There's probably a way to do it, but someone else will have to chip in on that 
Darn... I wish someone can help...
There is a way, but it is complicated and will involve many values.
(07-15-2011, 12:48 AM)DRedshot Wrote: [ -> ]its easy!
Code:
int x == RandInt(1 , 50);
SetEntityActive("c_" +x, true);
Try that :p
It also depends on what the computer does when it sets an entity that has already been set active. Thus meaning that it is more complicated. :3
(07-15-2011, 12:48 AM)DRedshot Wrote: [ -> ]its easy!
Code:
int x == RandInt(1 , 50);
SetEntityActive("c_" +x, true);
Try that :p
EDIT: After a series of trial and error, I mutated your code to something different. Although, the items don't seem to spawn for some reason...
EDIT 2: I finally fixed it. Thanks for the help.
For people who are interested,
Code:
SetEntityActive("c_"+GetLocalVarInt("RandomNumber"), true);