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 / Character behavior questions

Author
Message
Soviet176
15
Years of Service
User Offline
Joined: 19th Sep 2009
Location: Volgograd
Posted: 4th Oct 2010 03:00
Heya comrades,

I have some questions that would help me out a lot. It's about character behaviors, I am doing some test maps and I wanted to know if there were any scripts out there that would allow for a scenario like this:

You walk up to a small desk center, there is a female at one end, when you reach the area, she will walk toward you and start to talk, when she is done talking, another character comes through a door (lets say a door behind you) and starts talking to you he asks you to follow him, once done, he turns around and starts walking, you follow him to yet another station where, this time, he talks to another person, while you stand there. Once done, he resumes his walk and you follow, until the last stop, when he goes to talk to someone, alarms go off (I already have the alarm thing figured out) He tells you to follow him to the armory, the guard, you and the man you are following runs to a room somewhere in the station, but the man has to open the armory doors (Which were once locked)

Basically, I am getting stuck on how you would have the way point system pause at times for the interval of a sound file (I want to take good use of the new Dark voice system) and then resume the way point. I also am confused on how to have the man stop, turn to a switch and activate it, and then move on. Could anyone walk me through how I could possibly do this I know its a lot? that would be much appreciated!

Putting fear back into sliced bread since 4th May 2010
zeza
16
Years of Service
User Offline
Joined: 27th Jun 2008
Location:
Posted: 4th Oct 2010 04:15
Dark AI has its own waypoint system that you can use with aiaddpoint=x, aigotopoint=x, and aionpoint=x, where x is the id number of the point.
When you are adding a point, the x and z coordinates for the point are the x and z coordinates of the entity whose script has aiaddpoint=x, so if you want the character to go to different spots, I'd use invisible entities to set the points, then have the entities destroy themselves. Then just check when the talk file has finished and have whatever character (the guard, the man, or the woman) go to the next point. Hope I explained this well enough.

I'd change the world, but I don't have the source code
R.I.P. heltor, we will miss you
Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 4th Oct 2010 13:39
Alright comrade,It seems I have to step in again .

The script is relatively easy.
Tell me which method should I use.

The simple one or the complex one?

Soviet176
15
Years of Service
User Offline
Joined: 19th Sep 2009
Location: Volgograd
Posted: 4th Oct 2010 22:21
Quote: "The simple one or the complex one?"


Lol >.> yup, If you could both would be nice

Putting fear back into sliced bread since 4th May 2010
Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 4th Oct 2010 22:47 Edited at: 4th Oct 2010 22:48
Alright,first let's start with the simple one.

Let's assume you are in a radius of 300 (3 segments) from the characters position.

Make a simple condition.

:plrdistwithin=300:state=1

Now we have to make the character follow the waypoints to the player after ofcourse the player is in that radius of 3 segments.

Create a waypoint from the characters position to the player.
Now you have to edit the characters main script so it behaves like you want it to.

Implement the condition and use waypointstart , waypointnext and waypoint stop

:state=1,waypointstate=0:animate=2,waypointstart
:state=1,waypointstate=3:animate=2,waypointnext
:state=1,waypointstate=5:animate=1,waypointstop,rotatetotarget,state=2


Now after the state is changed to 2 you can initialize a timer,which will help you with the second characters appearance timing.

The lines below will start a timer and add a global variable to guide the second character when to walk in.I'm a bit rusty at using stock variables so there might be some errors.X is equal to the amount of milliseconds the conversation will be long and the character will walk in.

:state=2:timerstart,globalvar=0,state=3
:state=3,timergreater=x:incvar=1,state=4


Now that this is done we move on to character number 2.

The technique is the same as the first one,but this time instead of plrdistwithin,we'll use the varequal condition.

so in the main script of the other character the first line should be :

:varequal=1,waypointstate=0:animate=2,waypointstart
:varequal=1,waypointstate=3:animate=2,waypointnext


Now this part is a bit tricky.Since you can asign only one line of waypoints per character (i think) , we have to determine when the character will stop.Here plrdistwithin will come in handy , however the player must be in a closed room or frozen.

:varequal=1,plrdistwithin=200:waypointstop,state=2

So now the second character has stopped , and we have to asign a timer and a sound file naturally for the conversation.Which is pretty easy...
After the convo is finished,the character continues on his other waypoints. (x is the length of the sound file in milliseconds)

:state=2:timerstart,sound=x,state=3
:state=3,timergreater=x:waypointnext


By the way,I'm not sure whether you should put here waypointstart first or just next.

This is a very complex script,forget what I said...

I'll finish it up tomorrow.

-Gencheff

Soviet176
15
Years of Service
User Offline
Joined: 19th Sep 2009
Location: Volgograd
Posted: 5th Oct 2010 00:05
As always, you have an awesome way of explaining things, I found a video of which I am basing this all off of, hopefully it will give you a better understanding of my explanation.

http://www.youtube.com/watch?v=pum6smZPVak

Putting fear back into sliced bread since 4th May 2010
Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 5th Oct 2010 20:23 Edited at: 5th Oct 2010 20:26
Hmm.Alright.This is going to be hard to do , because I don't have time to test it,so it's all theory,but...

Lets divide this into a few parts :

Read carefully!

1.Main script for AIKO - character at desk
2.Waypoints for AIKO
3.Main script for Colonel X - character to follow
4.Waypoints for Colonel X

################# AIKO PREPERATION #################
1.Make a small waypoint from one end of the desk to the other.
2.Assign the script below as it's main script and remove all shooting scripts.



This code will do the following :
1.Check if the player has entered the room and is visible by human eye
2.If so the character will move to the player and start talking
3.A timer will start to monitor when to change a variable from 0 to 1.This is important because in the Colonel X character we'll do a check to see if variable is 1 to make him start walking.Also the player will freeze.

What is important is you must make plrfreeze=x (x=30000 (30 secs.)) for example is equal to the amount of timergreater=x.

sound=x is the file you want your character to play,where x is the fullpath

Next part coming up soon

Soviet176
15
Years of Service
User Offline
Joined: 19th Sep 2009
Location: Volgograd
Posted: 5th Oct 2010 22:54 Edited at: 5th Oct 2010 22:58
That small bit worked amazingly, looks perfect, I even tried modifying it to fit Dark voices "Greet player" FPI and I am so close lol!

I am getting a logic error though

This is my logic



When the player is within 300 she moves to the waypoint, if the player is within 90 she will talk, and if you cant be seen she will rotate her head, and look at 80

Then to finish your state she will stop and rotate to her target then freeze player

The error is, as soon at the player steps through the door she walls to the desk, instead of waiting till you were at the desk (3 segments) She does move her head to follow you, but she does not talk until you back up a good way (Which is odd lol) but she will still follow all the way points perfectly. I may have messed something up. But your script works as if you already done this before like a million times comrade!

**Edit**

Oh and she repeats what she says when you move back and forth, instead of going through the file and stoping, but I think to stop you need something like

:state=2,soundfinished=1:state=3

but that breaks into your states which will cause the script to fail.

Putting fear back into sliced bread since 4th May 2010
Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 5th Oct 2010 23:13
crap! it repeats the sound because I forgot to add a state=0 condition in he first line.just add that in front of plrdistwithin.

Also use my script and replace sound=x with talk=x to make Aiko talk(or add it after the sound=x)

Soviet176
15
Years of Service
User Offline
Joined: 19th Sep 2009
Location: Volgograd
Posted: 6th Oct 2010 22:53
Heya gencheff, I made some more modifications to the .FPI script for the akio. I have perfected the use of Dark Voices, I also added some code to allow for her head rotation to work making the scene more realistic.

Here is the code


Everything works for the most part. The only thing I see is as soon as she becomes in eye view she starts to walk instead of at the desk or (3) segments. I may have messed something up.

Putting fear back into sliced bread since 4th May 2010
Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 6th Oct 2010 23:05
First of all add a state=0 condition so that the female doesn't talk the same stuff over and over.

If you want more precission with her movement , change the plrdistwithin from 300 to around 200 or something.

I see a very unlogical row in the script.Why would the aiko rotate to the player,when he is NOT visible?! Doesn't quite seem logical to me.

Overall it should look a bit like this :



Login to post a reply

Server time is: 2024-11-24 19:30:50
Your offset time is: 2024-11-24 19:30:50