I've created three different talking npc / conversation scripts. I'm guessing I'm not the only one who could use such scripts.
You can use them to have characters display messages or have a conversation and such. Whenever you walk up to the player he will first rotate towards you. When coming closer he will start talking to you.
All of the scripts are suitable for audio speech + text subtitles situations, except script 3.
For all scripts: You can add more messages if you want to and take out the sounds if not needed. All of the message loop, if you walk up to the character again, the message will display again. To stop the looping, just take out
:state=2,plrdistfurther=60:state=10 at the end of the script. You can change the
hudx=50,hudy=50 for a different position of the text displayed, at the moment there centered.
IMPORTANT NOTE: If you're going to use more then one character to have a conversation with, then make sure you create a seperate script for each character and change the
hudname=talk1 hudname=talk2 hudname=talk3 to something else in each script, otherwise the correct texts will not display! If you use 3 characters for example change it into
hudname=p1talk1 hudname=p1talk2 hudname=p1talk3 for the first character,
hudname=p2talk1 hudname=p2talk2 hudname=p2talk3 for the second character and
hudname=p3talk1 hudname=p3talk2 hudname=p3talk3 for the last one.
Have fun with them!
1. Walk up to an character and he will display three messages in a row. Change the time to slow down or quicken the message appearance.
You can use it like this for example:
Message 1: Hi, I'm Benjamin, I'm not supposed to tell this....
Message 2: .....but, there's a key hidden in the blue room.....
Message 3: .....that will open the red room.
or
Message 1: Benjamin: Hi, I'm Benjamin, how are you doing today?
Message 2: Player: I'm fine thank you, how about you?
Message 3: Benjamin: Great, I've just created 3 cool scripts for you!
;Created by Benjamin Aeilkema
;Header
desc = game conversation
;walk up to an character and he will display three messages in a row.
;Triggers
:state=0:hudreset,hudx=50,hudy=50,hudimagefine= [path to your image with text1] ,hudname=talk1,hudhide=1,hudmake=display
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=[path to your image with text2],hudname=talk2,hudhide=1,hudmake=display
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=[path to your image with text3],hudname=talk3,hudhide=1,hudmake=display,state=10
:state=10,plrdistwithin=160:rotatetoplr
:state=10,plrdistwithin=60:rotatetoplr,sound=[path to a sound] ,timerstart,state=20
:state=20,plrdistwithin=60:rotatetoplr,hudshow=talk1,hudfadeout=talk1
:state=20,timergreater=7500:state=20,rotatetoplr,sound=[path to a sound],timerstart,state=30
:state=30,plrdistwithin=60:rotatetoplr,hudshow=talk2,hudfadeout=talk2
:state=30,timergreater=7500:state=30,rotatetoplr,sound=[path to a sound],timerstart,state=40
:state=40,plrdistwithin=60:rotatetoplr,hudshow=talk3,hudfadeout=talk3
:state=40,timergreater=7500:timerstart,state=2
:state=2,plrdistfurther=60:state=10
;End of Script
2. Walk up to an character and he will display a message. Walk away and the message will dissappear. Walk up to the character again and a different message will appear. Walk away and the message will dissappear. Walk up to the character once more and a different message will appear. Walk away and the message will dissappear.
You could use it like this for example:
Message 1: Hi, I'm Benjamin, I love FPSC
Message 2: Oh, it's you again. I've got nothing more to say to you.
Message 3: What you again? Stop bothering me!
;Created by Benjamin Aeilkema
;Header
desc = game conversation
;walk up to an character and he will display a message. Walk away and the message will dissappear.
;walk up to the character again and a different message will appear. Walk away and the message will dissappear.
;walk up to the character once more and a different message will appear. Walk away and the message will dissappear.
;Triggers
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=[path to your image with text1],hudhide=1,hudmake=display
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=[path to your image with text2],hudname=talk2,hudhide=1,hudmake=display
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=[path to your image with text3],hudname=talk3,hudhide=1,hudmake=display,state=10
:state=10,plrdistwithin=160:rotatetoplr
:state=10,plrdistwithin=60:rotatetoplr,sound=[path to a sound],state=20
:state=20,plrdistwithin=60:rotatetoplr,hudshow=talk1,hudfadeout=talk1,timerstart
:state=20,timergreater=100:state=30
:state=30,plrdistwithin=160:rotatetoplr
:state=30,plrdistwithin=60:rotatetoplr,sound=[path to a sound],state=40
:state=40,plrdistwithin=60:rotatetoplr,hudshow=talk2,hudfadeout=talk2,timerstart
:state=40,timergreater=100:state=50
:state=50,plrdistwithin=160:rotatetoplr
:state=50,plrdistwithin=60:rotatetoplr,sound=[path to a sound],state=60
:state=60,plrdistwithin=60:rotatetoplr,hudshow=talk3,hudfadeout=talk3,timerstart
:state=60,timergreater=100:state=2
:state=2,plrdistfurther=60:state=10
;End of Script
3. Basically the same as 1, but instead of the messages appearing automatically, the player has to press enter after each message. Once the player presses enter, a sound is heard to afirm the enter being pressed.
;Created by Benjamin Aeilkema
;Header
desc = game conversation
;walk up to an character and he will display a messages. when the user presses enter the next message will be shown
;when the user presses enter once more, the last message will display.
;sounds come after pressing enter
;Triggers
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=[path to your image with text1],hudname=talk1,hudhide=1,hudmake=display
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=[path to your image with text2],hudname=talk2,hudhide=1,hudmake=display
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=[path to your image with text3],hudname=talk3,hudhide=1,hudmake=display,state=10
:state=10,plrdistwithin=160:rotatetoplr
:state=10,plrdistwithin=60:rotatetoplr,hudshow=talk1,hudfadeout=talk1
:state=10,plrusingaction=1:timerstart,state=15,sound=[path to a sound]
:state=15,timergreater=500:state=20
:state=20,plrdistwithin=60:rotatetoplr,hudshow=talk2,hudfadeout=talk2
:state=20,plrusingaction=1:timerstart,state=25,sound=[path to a sound]
:state=25,timergreater=500:state=30
:state=30,plrdistwithin=60:rotatetoplr,hudshow=talk3,hudfadeout=talk3
:state=30,plrusingaction=1:timerstart,state=35,sound=[path to a sound]
:state=35,timergreater=500:state=2
:state=2,plrdistfurther=60:state=10
;End of Script
4. Basically the same as 3, but the sound comes as soon as the text appears too. 4 can be used for audio-speach characters, 3 can't.
;Created by Benjamin Aeilkema
;Header
desc = game conversation
;walk up to an character and he will display a messages. when the user presses enter the next message will be shown
;when the user presses enter once more, the last message will display.
;can be used for talking characters
;Triggers
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=[path to your image with text1],hudname=talk1,hudhide=1,hudmake=display
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=[path to your image with text2],hudname=talk2,hudhide=1,hudmake=display
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=[path to your image with text3],hudname=talk3,hudhide=1,hudmake=display,state=9
:state=9,plrdistwithin=160:rotatetoplr
:state=9,plrdistwithin=60:state=10,sound=[path to a sound]
:state=10,plrdistwithin=60:rotatetoplr,hudshow=talk1,hudfadeout=talk1
:state=10,plrusingaction=1:timerstart,state=15
:state=15,timergreater=500:state=19
:state=19,plrdistwithin=60:state=20,sound=[path to a sound]
:state=20,plrdistwithin=60:rotatetoplr,hudshow=talk2,hudfadeout=talk2
:state=20,plrusingaction=1:timerstart,state=25
:state=25,timergreater=500:state=29
:state=29,plrdistwithin=60:state=30,sound=[path to a sound]
:state=30,plrdistwithin=60:rotatetoplr,hudshow=talk3,hudfadeout=talk3
:state=30,plrusingaction=1:timerstart,state=35
:state=35,timergreater=500:state=2
:state=2,plrdistfurther=60:state=9
;End of Script
As suggested I'll add variations to this original thread, makes it easier to find everything.
Variation 1:
When the player walks up to the character the message will show. When the player presses Enter or walks away, the message will dissappear and never come back!
;Header
desc = game conversation show one screen once only no sound
;Triggers
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=[point to the image],hudname=img1,hudhide=1,h
udmake=display,state=10
:state=10,plrdistwithin=160:rotatetoplr
:state=10,plrdistwithin=60:rotatetoplr,state=20
:state=20,plrdistwithin=60:rotatetoplr,hudshow=img1,hudfadeout=img1
:state=20,plrdistwithin=60,plrusingaction=1:state=40
:state=20,plrdistfurther=60:state=40
;End of Script
Variation 2 (modified by Trotter):
Walk up to an character and...nothing happens. You have to use the "action" button to make him speak. When the user presses enter once more, the last message will display. Sounds come after pressing enter.
;Original created by Benjamin Aeilkema
;modified by trotter
;Header
desc = game conversation
;Walk up to an character and...nothing happens. You have to use the "action" button to make him speak.
;When the user presses enter once more, the last message will display.
;Sounds come after pressing enter.
;Triggers
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=H:\Program Files\The Game Creators\FPS Creator Demo\Files\texturebank\user\heouimerdier.png,hudname=talk1,hudhide=1,hudmake=display
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=H:\Program Files\The Game Creators\FPS Creator Demo\Files\texturebank\user\jevoispas.png,hudname=talk2,hudhide=1,hudmake=display
:state=0:hudreset,hudx=50,hudy=50,hudimagefine=H:\Program Files\The Game Creators\FPS Creator Demo\Files\texturebank\user\toddetbill.png,hudname=talk3,hudhide=1,hudmake=display,state=10
:state=10,plrdistwithin=160:rotatetoplr
:state=10,,plrusingaction=1:rotatetoplr,hudshow=talk1,timerstart,state=12
:state=12,timergreater=500:hudfadeout=talk1,state=14
:state=14,ALWAYS:timerstart,state=15,sound=[path to a sound]
:state=15,timergreater=500:state=20
:state=20,plrdistwithin=160:rotatetoplr
:state=20,,plrusingaction=1:rotatetoplr,hudshow=talk2,timerstart,state=22
:state=22,timergreater=500:hudfadeout=talk2,state=24
:state=24,ALWAYS:timerstart,state=25,sound=[path to a sound]
:state=25,timergreater=500:state=30
:state=30,plrdistwithin=160:rotatetoplr
:state=30,,plrusingaction=1:rotatetoplr,hudshow=talk3,timerstart,state=32
:state=32,timergreater=500:hudfadeout=talk3,state=34
:state=34,ALWAYS:timerstart,state=35,sound=[path to a sound]
:state=35,timergreater=500:state=10
:state=2,plrdistfurther=60:state=10
;End of Script