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 / Monster Random runs through the area

Author
Message
KajoCat
FPSC Reloaded TGC Backer
9
Years of Service
User Offline
Joined: 5th Jul 2013
Location:
Posted: 15th Feb 2015 21:50
someone knows a script where a monster appears random and runs through the area, and eventually just go away? and it does not go into the light does not go on it from the light range.

so if someone knows a script that has or can write, would be great. but must be usable for commercial Porjekte.
Thx

https://www.facebook.com/RPGMVXA?ref=hl
Sinister Spoon
14
Years of Service
User Offline
Joined: 9th Sep 2008
Location:
Posted: 22nd Feb 2015 14:18
Im not sure that a single script is capable of doing that, you would need someway of designating spawn points for the monster and telling the fpi of its AI which areas it can and cant do into using zones or waypoints.

I agree with you that its probably possible but im guessing not as easy as you might like it to be.

Im guessing first off you'd need a script to randomize which spawn point the monster appears at. So you set a number of spawn points such as spawn1, spawn2, spawn3 etc, then maybe code a script that generates and random number and depending on that number selects and spawns a monster at one of the spawn points, making it despawn after a set limited time can be achieved by having an etimer in the monsters script set to destroy after a certain time.

To get it to avoid certain areas? I dont know, maybe have waypoints around the map that are all in areas of light and
numbered or named (not sure if this is actually possibe?) and through use of coding, have the monster always go to the nearest waypoint then from one to the other in such a way as to appear random and avoiding light.

A lot of coding tricks can be achieved by making it APPEAR as though an entity is doing something like avoiding light, but creating the illusion however you can, eg not trying to code for a specific 'avoid light command' but using the available commands to give the illusion that the enemy doesnt like light, when in reality its AI is actually looking at different things like way points, or specifically named entities.

In theory you could set a series of waypoints through named entites, such as doorway1, table2, etc, then having a script that
makes the entity target the named entity and move towards or away from it

THERE! make a large invisible entity with nocollide in its script and a specific name, make it as large as the area thats lit, have the monster look for that entity and always move away from it!

There, thats how you have it avoid light! literally came to me as i was typing this!

smoke em if you got em
KajoCat
FPSC Reloaded TGC Backer
9
Years of Service
User Offline
Joined: 5th Jul 2013
Location:
Posted: 23rd Feb 2015 13:33
Thanks anyway,
if you have anything useful can find ichdir would be greatly appreciated . I search and search , but somehow it 's not really what but more eyes see better than 2

https://www.facebook.com/RPGMVXA?ref=hl
Sinister Spoon
14
Years of Service
User Offline
Joined: 9th Sep 2008
Location:
Posted: 9th Mar 2015 17:45
Basically as far as I can tell something like this might work for you

To Spawn the Monster at a random location

Place a monster in the level. Call it monster 1

Set it up so Spawn at start is set to No
Immobile is set to No
Always Active is Yes
Give it the Monster fpi in its main (Il discuss this later)

Place it at one of the places you would like the monster to spawn

Do this as many times as you like (8 for example) each time changing the number at the end of the monsters name so you end up with something like

Monster 1 in one place
Monster 2 somewhere else
Monster 3 somewhere else else. etc etc

so you have your 8 monsters on the map, none of which are set to spawn at the start, they are all waiting to be told to spawn at a specific point

So what you need is a 'control script'. This is a script that is used to control which monster spawns and when.

This is usually placed in either a trigger zone (if you want control over the spawning based on location) but I usually put it in the main of a Dynamic entity, which i set to immobile with no physics but always active, and place outside of the level.

Now to control which monster spawns randomly you can use the random=x command.

This is true when a random number is equal to x

So somewhere in the control script will be something like this

:state=10,random=1:setifused=Monster 1, activateifused=1,state=20
:state=10,random=2:setifused=Monster 2, activateifused=1,state=20

etc etc all the way up to Monster 8

What happens then is that when you send the control script to state 10, it randomly selects a number, so when random=2 it sets the ifused field of the control script to the name of the corresponding monster, it then activates the ifused field spawning that monster into the level and then takes itself out of state 10 so it doesnt repeat this process making sure only 1 monster is spawned.

As I mentioned in a different thread its a good idea to have a variable going along with this like globalvar=Monster, then everytime it spawns a monster, set the variable to the corresponding monsters name, so the game knows theres already a monster spawned in and prior to attempting to spawn a monster have a check to make sure this variable is at 0

Then code the Monsters AI script however you want, but when its destroyed have its script set that global Monster variable back to 0 to allow the control script to spawn another monster elsewhere.

As for avoiding the light. Depends largely how you want it to 'look'.

I would probably place an invisible entity with collision off at the center of the light source (or thinking about it modify the lights fpi, or make the light dynamic, name it something unique light 'Lightavoid1', then in the monsters fpi, have it perform a check based on targetname=, by setting the targets name and using AItargetdistfurther=x, where in this case x would be the light range defined in the editor.)

Not sure if any of this would work, but sitting here going through it in a logical progression with Ched's complete syntax guide next to me there seems to be no reason why this effect cant be achieved provided your willing to put the effort into coding all the fpis

smoke em if you got em

Login to post a reply

Server time is: 2022-10-06 04:56:15
Your offset time is: 2022-10-06 04:56:15