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 / WayPoint Script to analyze

Author
Message
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 20th Sep 2017 22:52 Edited at: 20th Sep 2017 23:57
This is a customized script that is not a script to use out of the box. I provide it for those interested in creating waypoint scripts to analyze. If anyone is interested I will give them a while to look over the scripts. The first script is obviously the main script that the npc has. The next three scripts are used by the entities at the end of the waypoint and the last script is the script for the collision on/off for the glass walls. This allows the entity to go through but not the player. The attached image shows at which point the waypoint state changes. The npc starts with waypointstate 0 and then it will be waypointstate 5 for the rest of his progress. WPS indicates the waypointstate.









THEORY - you know everything but nothing works. PRACTICE - when everything works but don't know why.
For me, theory and practice are combined: nothing works and I don't know why.

Attachments

Login to view attachments
ncmako
12
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 21st Sep 2017 01:09
FlatLander Very nice script. I'm looking for each state and getting the gist of it. Your "activating" a lot of stuff in the main script, wow.
The "plrfreeze & freeze" commands are giving you problems? Mine do....
You alone know what's going on, it's sometimes hard to wrap ones head around these scripts I did a lot of waypoint scripts and know
it's not easy. I did get one working good where the character "stops & pauses" at each waypoint state.
My games never have bugs. They just develop random features..
Lots and lots of random features...
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 21st Sep 2017 07:22 Edited at: 22nd Sep 2017 07:56
Thanks ncmako. I just love a challenge. :SMILE:
THEORY - you know everything but nothing works. PRACTICE - when everything works but don't know why.
For me, theory and practice are combined: nothing works and I don't know why.
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 22nd Sep 2017 07:42 Edited at: 22nd Sep 2017 07:56
Here I break down some of the more important states. States 5-10 I will explain in another post as these will interact with other scripts. Red is the condition and blue is the action.

:state=0:animate=25,state=1
Animation 25 is the npc standing and typing. So I start out the script with him standing.

:state=1:animate=25
:state=1,activated=2:state=2,etimerstart
I'm not sure if I needed to have another animate=25 at state 1, however the npc is waiting until there is a activation code of two.

:state=2,etimergreater=2000:animate=25,state=3
When the npc gets it we proceed to state 2. I just found it better to have a short delay before proceeding and the animate=25 makes sure the npc is still standing and typing.

:state=3:activate=0,randomize,state=4
Here we begin the serious stuff. We reset activation to zero and reseed the timer. The randomize is not necessary actually but I wanted to make things look more random. Now we go to the first part of the waypoint sequence to get the npc to start moving and perform the necessary commands when he reaches each node.

:state=4,waypointstate=0:animate=2,waypointstart
NPC starts his journey.

:state=4,waypointstate=2,plrdistwithin=75:animate=2,plrfreeze=3000
:state=4,waypointstate=2,plrdistfurther=75:animate=2,plrfreeze=0
NPC is following the waypoint to the next node. During this time if the player gets too close the player will freeze. When the NPC moves further away from player player will "unfreeze." I was going to have the player freeze for an enormous amount of time because I figured that the NPC would go further and release the player. However, in dozens of test, one time the NPC was at one of the end nodes and we were at a stalemate. NPC would not move because it was stuck on the waypointstate #2.

:state=4,waypointstate=3:animate=2,waypointnext
There are a couple of nodes where the waypoint just needs to keep going to the next.

:state=4,waypointstate=4:animate=2,waypointrandom
NPC is at a node where he can go one of two ways. The waypointrandom sets the NPC to go either direction.

:state=4,waypointstate=5:animate=1,state=5
NPC reaches the final node of that path and will need to have more instructions. These instruction are determined by the script of the dynamic entity he has reached. So we go to state #5.

:state=5:activateifused=1,state=6,etimerstart
:state=6,etimergreater=250:state=7

:state=7,activated=1:etimerstart,state=10,animate=1,freeze
:state=7,activated=2:animate=31,freeze,etimerstart,state=9
:state=7,activated=3:state=8,randomize

:state=8,random=7:animate=31,state=9,etimerstart,freeze
:state=8,random=12:animate=1,state=10,etimerstart,freeze

:state=9,etimergreater=150:animate=31,state=10,etimerstart
:state=10,etimergreater=5000:animate=2,waypointreverse,state=104,activate=0

The following state #104 is the same waypoint code as in state #4 This is when the npc is coming back to the original start. It is the reverse.
:state=104,waypointstate=0:animate=2,waypointstart
:state=104,waypointstate=2,plrdistwithin=75:animate=2,plrfreeze=3000
:state=104,waypointstate=2,plrdistfurther=75:animate=2,plrfreeze=0
:state=104,waypointstate=3:animate=2,waypointnext
:state=104,waypointstate=4:animate=2,waypointrandom
:state=104,waypointstate=5:etimerstart,state=105,animate=25,randomize

:state=105,random=25:state=106
:state=105,random=15:state=107
:state=105,random=35:state=108
State 105 determines which state will follow.

:state=106,etimergreater=2000:animate=2,waypointreverse,state=3
:state=107,etimergreater=5000:animate=2,waypointreverse,state=3
:state=108,etimergreater=10000:animate=2,waypointreverse,state=3
Each of these states makes the npc stay at its position before returning to original starting point. It then goes to state #3 and basically resets the npc to start all over again.
THEORY - you know everything but nothing works. PRACTICE - when everything works but don't know why.
For me, theory and practice are combined: nothing works and I don't know why.
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 22nd Sep 2017 14:37
WOW! This is awesome stuff, and it goes right into my examples collection for future use. And thanks for the explanations.
Characters. You build them a world and what do they do? They moonwalk, get stuck in the walls and fall through the floors!
ncmako
12
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 22nd Sep 2017 21:47
Double Wow! I'm still amazed that stuff like this can be done with fpsc. I'm looking over it "slowly" Trying to take it all in, Lol
I just viewed the video you posted in the WIP thread, Is this the script you used in that ?
I am very impressed, Great work
Also, speaking of "waypoints" have you ever used "waypointstate=1 or waypointstate=999"
They both seem to have potential for use?
My games never have bugs. They just develop random features..
Lots and lots of random features...

Login to post a reply

Server time is: 2024-03-28 23:52:11
Your offset time is: 2024-03-28 23:52:11