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 / Using waypoint a second time for character

Author
Message
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 24th Jan 2013 23:39 Edited at: 25th Jan 2013 00:26
I'm at a loss for this one. I'm pretty good at using waypoints but it seems that one can only use them once per character -- or so it seems. Here is the code:

;first time when game starts do following
:state=0:rotatetoplr,animate=1,rpg_setifused=iw1
:state=0,plrdistwithin=70:rpg_pointplayeratobject=12,rpg_wait4time=150,rpg_talkbox=40,rpg_entitytimerstart,state=1
:state=1,rpg_entitytimergreater=150:state=2

the first waypoint I use

:state=2,waypointstate=0:animate=2,waypointstart
;:state=2,waypointstate=3:animate=2,waypointnext
:state=2,waypointstate=3:animate=2,waypointnext
:state=2,waypointstate=5:rotatey=105,movefore=7,state=3,rpg_entitytimerstart,animate=1,activateifused=1



Now, I know that if you implement the command, "waypointstop" this will disable the character from using waypoints. So, I don't use that command.

I do move the character manually through scripting a couple of times as shown in the following:




After the last manual move, this places the character in the position where there is a waypoint. However, I can't seem to code it to get him to follow the waypoint at this point. I set up a scancodekey so that I can get the player into a position to see if the character will follow the waypoint or not.

:state=20,scancodekeypressed=69:state=21

You will notice I started out with a waypoint state condition of the character, however, I am sure that this is not his current state for waypoints. First of all it didn't work.

;:state=21,waypointstate=0:animate=2,waypointstart

So, I didn't use a condition at all. This is allowed and I used the waypointstart which finds the closest waypoint to the character and then uses that one.

:state=21:animate=2,waypointstart,state=22
:state=22:animate=2,waypointnext


This didn't work. I tried a few more command variations but to no avail. If nobody has used more than one different waypoint for the same character, then this is a question that will go unanswered for now. No need to bother responding with a suggestion unless you have made it work yourself.



Well, it does work. So what wasn't working? The condition scancodekeypressed=69 wasn't working for some reason. I haven't checked that out but I'm sure the key # is 69. F10 is 68 and it works as I have it in a constant loop checking when it is pressed. I used the "plrdistwithin" condition and it works just fine now. Go figure.

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.
BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 25th Jan 2013 01:18
I too have had similar issues and find the "waypoint system" to not work as I would like to in situations like this. What I have had to do was use waypoints like you have at start, and then instead of getting the character to try and use the waypoints a second time, switched to the "rotatetotarget=x" and "movetotarget=x". In the level I have invisible arrow markers on the "path" where the character is to move. So after the waypoint end is reached, it stops and then I switch to my method and after some interaction, etc the character is now following my arrow markers rather than the waypoints. Extra work I know, but that was the best solution we had at the time.

Quote: "Well, it does work. So what wasn't working? The condition scancodekeypressed=69 wasn't working for some reason. I haven't checked that out but I'm sure the key # is 69. F10 is 68 and it works as I have it in a constant loop checking when it is pressed. I used the "plrdistwithin" condition and it works just fine now. Go figure."


FPSC is like that some days. Works fine one minute, then something not working the next. I end up saving and closing, then open the book we are writing to change the scenery. Returning to FPSC the next day and everything works as it should.


There's no problem that can't be solved without applying a little scripting.
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 25th Jan 2013 01:47
Thanks, Blackfox, for another solution. That's what I love about programming. Usually more than one way to skin a fox, I mean, cat. Whoops. Me bad.

Oh, no. I think I might have just offended Meows.

I'm not ahead but I better quit now!

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.
s4real
VIP Member
18
Years of Service
User Offline
Joined: 22nd Jul 2006
Location:
Posted: 25th Jan 2013 01:58
@ Flatlander :- well you could always add this to your script so the player would go back to the waypoint after its done its job.


:plrcannotbeseen,plrdistfurther=200:state=0,waypointstart,animate=2

also add the waypoints with out any states :-

:waypointstate=0:animate=2,waypointstart
:waypointstate=3:animate=2,waypointnext
:waypointstate=4:animate=2,waypointrandom
:waypointstate=5:animate=2,waypointreverse

then add your code.

just an idea

@blackfox :- Nice workaround

best s4real

Pack ya games with vishnu packer its free. Vishnu game launcher is now released.
Help keep vishnu free by pledging now :- http://vishnu.chipin.com/vishnu
BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 25th Jan 2013 03:28
Quote: "Thanks, Blackfox, for another solution. That's what I love about programming. Usually more than one way to skin a fox, I mean, cat. Whoops. Me bad.

Oh, no. I think I might have just offended Meows."


LOL. Too many "animal" names. But it helps when those of us that have programmed for a long time and know this engine well bounce ideas off one another. Your method is good and helped me to create a new method on my character scripts, but my is an easy work-around in case it does not do quite what I need. Sometimes another programmer's perspective is all that is needed- each of us see the "box" at different levels.

Quote: "@blackfox :- Nice workaround "


We are good at that- creating work-arounds.


There's no problem that can't be solved without applying a little scripting.
bruce3371
14
Years of Service
User Offline
Joined: 4th Aug 2010
Location: Englishland
Posted: 25th Jan 2013 13:35 Edited at: 25th Jan 2013 13:39
Meanwhile, us non programmers like to sit back and let you programmers do all the work, then enjoy the fruits of your labours lol

BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 26th Jan 2013 01:06
Quote: "Meanwhile, us non programmers like to sit back and let you programmers do all the work, then enjoy the fruits of your labours "


As it should be. We would worry if no one used our ideas.


There's no problem that can't be solved without applying a little scripting.
Meows
13
Years of Service
User Offline
Joined: 12th Oct 2011
Location: Totally over the Rainbow
Posted: 30th Jan 2013 15:58
F l a t l a n d e r, BlackFox,
Now how did you 2 know just last night, I was working on way-points?
Quote: "Quote: "Thanks, Blackfox, for another solution. That's what I love about programming. Usually more than one way to skin a fox, I mean, cat. Whoops. Me bad.

Oh, no. I think I might have just offended Meows.""



My fix was to add a Enter key press that seems to restart the way-point script and the character doing the following repositions it self and resumes following the player.
:state=10,plrdistwithin=80:rotatetoplr,waypointstop
:state=10,plrdistwithin=80,plrusingaction=1:activate=2
:state=10,activated=2:state=2
:state=2:activate=0,state=3
:state=3,activated=0,plrdistfurther=100:animate=2,waypointstart,state=10

My problem was the character has to follow the player through a level. Help with quests and at the end of the level the Player gets a key that opens a door where the player started at so they have to backtrack through the level to the start and continue through 3 more floors.
My issue was the character would "hang" at doors. Or if the Player out ran the character the character would freeze or start walking back to the start of the way-points. Using the Enter key seems to correct this behavior.

Many thanks for the new fixes for this behavior.

Login to post a reply

Server time is: 2024-11-23 17:14:33
Your offset time is: 2024-11-23 17:14:33