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
RandInt ?!
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#15
RE: RandInt ?!

Name all your ScriptAreas where the parts could potentially spawn Area_ followed by 1 to 6 (Area_1, Area_2, Area_3 ... Area_6).

Then try this:
PHP Code: (Select All)
void OnStart()
{
CreateEntityAtArea("<name_of_part_1>""entity.ent""Area_"+RandInt(12), false);
CreateEntityAtArea("<name_of_part_2>""entity.ent""Area_"+RandInt(34), false);
CreateEntityAtArea("<name_of_part_3>""entity.ent""Area_"+RandInt(56), false);


However:
1. Don't have your parts already placed in the level. This will create them. If you have two doors both called "door" in game, the game crashes because it does not know which door is which. Make sure to rename the first string to suit your code as well.
2. "entity.ent" should be changed to whatever the entity is that your part will be using.

If the game crashes with an "Expected ;" error, place it after the RandInt() but before the comma in each routine. I keep forgetting if it is required when calling it within a line itself.

Furthermore, a simple way to test if all is working, is to move the ScriptAreas in front of where the player spawns. Note where each part drops and make sure that every now and then (since it's a 1/2 * 1/2 * 1/2) they alter. Then you can move your ScriptAreas around.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 07-08-2015, 10:34 PM by Romulator.)
07-08-2015, 10:25 PM
Find


Messages In This Thread
RandInt ?! - by Amnesiaplayer - 07-05-2015, 08:01 PM
RE: MudBox Export Issue - by Traggey - 07-05-2015, 09:35 PM
RE: MudBox Export Issue - by Amnesiaplayer - 07-05-2015, 09:46 PM
RE: MudBox Export Issue - by Traggey - 07-05-2015, 10:00 PM
RE: MudBox Export Issue - by Amnesiaplayer - 07-05-2015, 10:04 PM
RE: MudBox Export Issue - by Traggey - 07-05-2015, 10:06 PM
RE: MudBox Export Issue - by Amnesiaplayer - 07-05-2015, 10:15 PM
RE: MudBox Export Issue - by Daemian - 07-06-2015, 01:38 PM
RE: MudBox Export Issue - by Amnesiaplayer - 07-06-2015, 01:59 PM
RE: RandInt ?! - by Daemian - 07-07-2015, 08:29 PM
RE: RandInt ?! - by Amnesiaplayer - 07-08-2015, 09:14 PM
RE: RandInt ?! - by Rahmerh - 07-08-2015, 09:16 PM
RE: RandInt ?! - by DnALANGE - 07-08-2015, 09:17 PM
RE: RandInt ?! - by Amnesiaplayer - 07-08-2015, 09:42 PM
RE: RandInt ?! - by Romulator - 07-08-2015, 10:25 PM
RE: RandInt ?! - by Amnesiaplayer - 07-08-2015, 10:33 PM
RE: RandInt ?! - by Romulator - 07-08-2015, 10:39 PM
RE: RandInt ?! - by Amnesiaplayer - 07-08-2015, 10:44 PM
RE: RandInt ?! - by Mudbill - 07-09-2015, 12:54 PM



Users browsing this thread: 1 Guest(s)