Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Random positioning of an entity

Author
Message
Angiel
9
Years of Service
User Offline
Joined: 30th Jan 2015
Location: Italy
Posted: 30th Jan 2015 22:07
Hi,
Can you place an object / character in a random position on the map?
Something like:

:state=0: random=2, object X1 Z1, state=4
:state=0: random=5, object X2 Z2, state=4
:state=0: random=9, object X3 Z3, state=4

:state=4..........etc. etc.

Thanks for the tips.
ncmako
12
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 31st Jan 2015 14:37
Angiel Hi and welcome
No, it wont work that way. What you could do is to have
your objects/characters "spawn" or "hide & show" using the
"random" condition at preset locations of your choosing.
But to have an object spawn at "X & Y" wont work.
Here's a link to the complete syntax list...
http://forum.thegamecreators.com/?m=forum_view&t=180924&b=23
best

My games never have bugs. They just develop random features..
Angiel
9
Years of Service
User Offline
Joined: 30th Jan 2015
Location: Italy
Posted: 1st Feb 2015 11:40
Thanks for the info.
Sinister Spoon
16
Years of Service
User Offline
Joined: 9th Sep 2008
Location:
Posted: 9th Mar 2015 15:28 Edited at: 9th Mar 2015 15:30
Yeah Mako's Right although the resulting effect is very very good if coded properly

Most people want to use a slenderman as an example so I'll do the same

Say have 8 or so randomly place around the level with unique names

Example

Slender1 at Spawn location 1
Slender2 at spawn location 2

Then using random=x set them to spawn or show based on the result if the randomizer.

Example
Random=1:setifused=slender1,activateifused=1
Random=2:setifused=slender2,activateifused=1
Random=3:setifused=slender3,activateifused=1

and so on and so forth, these actions Ideally should be placed in a script, given to an entity thats always active and placed outside the play area.

Then code the enemies fpi however you like and when its due to disappear either destroy it if you dont plan on calling it again or hide it and cull it if you are.

What I would do is have a variable like globalvar=ActiveSlender, to which you can set the value of the currently active enemy, so globalvar=slender 2, would do a check to see if slender 2 was active so you can always be checking to see if one enemy is active to prevent the script spawning a duplicate elsewhere

then when the slender disappears, reset that variable to 0 and in the main script that selects and spawns the enemy only allow it to do so if that variable is set to 0

smoke em if you got em

Login to post a reply

Server time is: 2024-11-21 12:31:40
Your offset time is: 2024-11-21 12:31:40