Frictional Games Forum (read-only)
Need help with script (SOLVED) - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Need help with script (SOLVED) (/thread-9149.html)



Need help with script (SOLVED) - mzx987 - 07-14-2011

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.


RE: Need help with script - Roenlond - 07-14-2011

That command doesn't spawn entities, it activates already spawned ones. As for the functionality, I'm not sure how you'd do it.


RE: Need help with script - mzx987 - 07-14-2011

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



RE: Need help with script - Roenlond - 07-14-2011

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


RE: Need help with script - mzx987 - 07-15-2011

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


RE: Need help with script - Kyle - 07-15-2011

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


RE: Need help with script - DRedshot - 07-15-2011

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

Try that :p


RE: Need help with script - Kyle - 07-15-2011

(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


RE: Need help with script - mzx987 - 07-15-2011

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


For people who are interested,
Code:
SetEntityActive("c_"+GetLocalVarInt("RandomNumber"), true);