Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with script (SOLVED)
mzx987 Offline
Junior Member

Posts: 9
Threads: 3
Joined: Feb 2011
Reputation: 0
#1
Need help with script (SOLVED)

Just wanted to ask this question about scripting:

What did I do wrong with this string of 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.
(This post was last modified: 07-15-2011, 02:37 AM by mzx987.)
07-14-2011, 10:11 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#2
RE: Need help with script

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
Find
mzx987 Offline
Junior Member

Posts: 9
Threads: 3
Joined: Feb 2011
Reputation: 0
#3
RE: Need help with script

(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.
07-14-2011, 10:18 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#4
RE: Need help with script

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 Smile
07-14-2011, 10:21 PM
Find
mzx987 Offline
Junior Member

Posts: 9
Threads: 3
Joined: Feb 2011
Reputation: 0
#5
RE: Need help with script

(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 Smile

Undecided

Darn... I wish someone can help...
07-15-2011, 12:26 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#6
RE: Need help with script

There is a way, but it is complicated and will involve many values.

07-15-2011, 12:33 AM
Find
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#7
RE: Need help with script

its easy!
int x == RandInt(1 , 50);
SetEntityActive("c_" +x, true);

Try that :p

07-15-2011, 12:48 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#8
RE: Need help with script

(07-15-2011, 12:48 AM)DRedshot Wrote: its easy!
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:49 AM
Find
mzx987 Offline
Junior Member

Posts: 9
Threads: 3
Joined: Feb 2011
Reputation: 0
#9
RE: Need help with script

(07-15-2011, 12:48 AM)DRedshot Wrote: its easy!
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. Smile


For people who are interested,
SetEntityActive("c_"+GetLocalVarInt("RandomNumber"), true);
(This post was last modified: 07-15-2011, 02:35 AM by mzx987.)
07-15-2011, 01:00 AM
Find




Users browsing this thread: 1 Guest(s)