There seemes to be a great demand for introductory conversations....so I scraped one from my big (but dead) fantasy project:
;Artificial Intelligence Script
by TheStoryteller01 2012
;Header
desc=
This script only works with FPSC 1.18 or later
Made for dynamic entities that talk to the player.
To start the script at any time, the player has to move the crosshair over the NPC and press <Enter>.
THIS SCRIPT IS DIFFERENT - IT STARTS WHEN THE PLAYER IS CLOSE ENOUGH TO THE NPC AND CAN BEE SEEN:
;Triggers
:state=0:state=1
:state=1,shotdamage=1:state=290
:state=1,plrcanbeseen,plrdistwithin=150:etimerstart,state=11
;//NPC
:state=11,shotdamage=1:state=290
:state=11:rotatetoplr
:state=11:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=11:fpgcrawtext=Don't Attack! I only want to get out!
:state=11,etimergreater=500,plrusingaction=1:plrdisable=0,state=15
:state=11,etimergreater=5000:plrdisable=0,state=12
;//NPC
:state=12,shotdamage=1:state=290
:state=12:rotatetoplr
:state=12:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=12:fpgcrawtext=
:state=12,pickobject=1,plrusingaction=1:plrdisable=0,state=15
:state=15,shotdamage=1:state=290
:state=15:etimerstart,plrdisable=100000,rotatetoplr,state=21
;//PLAYER
:state=21:fpgcrawtextsize=26,fpgcrawtextfont=verdana,fpgcrawtextr=000,fpgcrawtextg=000,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=80
:state=21:fpgcrawtext=What are you doing down here?
:state=21,etimergreater=500,plrusingaction=1:plrdisable=0,state=25
:state=21,etimergreater=5000:plrdisable=0,state=25
:state=25:etimerstart,plrdisable=100000,rotatetoplr,state=31
;//NPC
:state=31:rotatetoplr
:state=31:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=31:fpgcrawtext= Templar - I don't want to fight you. These spiders badly wounded me.
:state=31,etimergreater=500,pickobject=1,plrusingaction=1:plrdisable=0,state=35
:state=31,etimergreater=5000:plrdisable=0,state=35
:state=35:etimerstart,plrdisable=100000,state=41
;//PLAYER
:state=41:fpgcrawtextsize=26,fpgcrawtextfont=verdana,fpgcrawtextr=000,fpgcrawtextg=000,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=80
:state=41:fpgcrawtext=You are one of the Blood Queen's mercenaries. Why shall I spare you?
:state=41,etimergreater=500,plrusingaction=1:plrdisable=0,state=45
:state=41,etimergreater=5000:plrdisable=0,state=45
:state=45:etimerstart,plrdisable=100000,state=51
;//NPC
:state=51:rotateheadrandom=10
:state=51:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=51:fpgcrawtext=I am Dunir the Dwarf - not a mercenary.
:state=51,etimergreater=500,plrusingaction=1:plrdisable=0,state=55
:state=51,etimergreater=5000:plrdisable=0,state=55
:state=55:etimerstart,plrdisable=100000,state=61
;//NPC
:state=61:rotateheadrandom=20
:state=61:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=61:fpgcrawtext=I was only hired as a miner to find a way down to the tombs!
:state=61,etimergreater=500,plrusingaction=1:plrdisable=0,state=65
:state=61,etimergreater=6000:plrdisable=0,state=65
:state=65:etimerstart,plrdisable=100000,state=71
;//PLAYER-CHOICE OF 3
:state=71:fpgcrawtextsize=26,fpgcrawtextfont=verdana,fpgcrawtextr=000,fpgcrawtextg=000,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=80
:state=71:fpgcrawtext=<F1>I am listening. <F2>Just get out of my way. <F3>Fight!
:state=71,etimergreater=100000:state=71
:state=71,etimergreater=500,scancodekeypressed=59:etimerstart,state=81
:state=71,etimergreater=500,scancodekeypressed=60:plrdisable=0,state=125
:state=71,etimergreater=500,scancodekeypressed=61:plrdisable=0,state=290
;//NPC
:state=81:rotateheadrandom=20
:state=81:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=81:fpgcrawtext=Give me your word you let me go and I might have valuable information for you.
:state=81,etimergreater=500,plrusingaction=1:plrdisable=0,state=85
:state=81,etimergreater=5000:plrdisable=0,state=85
:state=85:etimerstart,plrdisable=100000,state=91
;//PLAYER
:state=91:fpgcrawtextsize=26,fpgcrawtextfont=verdana,fpgcrawtextr=000,fpgcrawtextg=000,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=80
:state=91:fpgcrawtext=Hm...Allright Dwarf. You have my word as a Templar.
:state=91,etimergreater=500,plrusingaction=1:plrdisable=0,state=95
:state=91,etimergreater=5000:plrdisable=0,state=95
:state=95:etimerstart,plrdisable=100000,state=100
;//NPC
:state=100:rotateheadrandom=20
:state=100:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=100:fpgcrawtext=This is a side entrance to the servant's quarters. We cleared the rubble to the next level...
:state=100,etimergreater=500,plrusingaction=1:state=101
:state=100,etimergreater=5000:state=101
:state=101:etimerstart,plrdisable=100000,state=102
;//NPC
:state=102:rotateheadrandom=20
:state=102:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=102:fpgcrawtext=...and set up camp in one of the larger rooms. All went well until we disturbed a swarm of spiders.
:state=102,etimergreater=500,plrusingaction=1:state=103
:state=102,etimergreater=5000:state=103
:state=103:etimerstart,plrdisable=100000,state=104
;//NPC
:state=104:rotateheadrandom=20
:state=104:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=104:fpgcrawtext=The Blood Queen sent her Captain to find their lair and destroy them - but he never came back.
:state=104,etimergreater=500,plrusingaction=1:state=105
:state=104,etimergreater=5000:state=105
:state=105:etimerstart,plrdisable=100000,state=108
;//NPC
:state=108:rotateheadrandom=20
:state=108:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=108:fpgcrawtext=Instead the spiders suddenly attacked us like crazy.
:state=108,etimergreater=500,plrusingaction=1:state=109
:state=108,etimergreater=5000:state=109
:state=109:etimerstart,plrdisable=100000,state=110
;//NPC
:state=110:rotateheadrandom=20
:state=110:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=110:fpgcrawtext=The Blood Queen fled with her personal guards down to the tombs and left the rest of us to die.
:state=110,etimergreater=500,plrusingaction=1:state=111
:state=110,etimergreater=5000:state=111
:state=111:etimerstart,plrdisable=100000,state=112
;//PLAYER
:state=112:fpgcrawtextsize=26,fpgcrawtextfont=verdana,fpgcrawtextr=000,fpgcrawtextg=000,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=80
:state=112:fpgcrawtext=And where is that 'valuable information' you talked about?
:state=112,etimergreater=500,plrusingaction=1:plrdisable=0,state=113
:state=112,etimergreater=5000:state=113
:state=113:etimerstart,plrdisable=100000,state=114
;//NPC
:state=114:rotateheadrandom=20
:state=114:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=114:fpgcrawtext=The Captain had fabricated some oil bombs before he left - and he didn't take all of them with him.
:state=114,etimergreater=500,plrusingaction=1:state=115
:state=114,etimergreater=5000:state=115
:state=115:etimerstart,plrdisable=100000,state=116
;//NPC
:state=116:rotateheadrandom=20
:state=116:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=116:fpgcrawtext=He left them in his chest along with some other equipment.
:state=116,etimergreater=500,plrusingaction=1:state=117
:state=116,etimergreater=4000:state=117
:state=117:etimerstart,plrdisable=100000,state=118
;//NPC
:state=118:rotateheadrandom=20
:state=118:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=118:fpgcrawtext=The chest is in a locked room on the first level. Find the Captain and you will probably find his key.
:state=118,etimergreater=500,plrusingaction=1:state=119
:state=118,etimergreater=4000:state=119
:state=119:etimerstart,plrdisable=100000,state=120
;//PLAYER
:state=120:fpgcrawtextsize=26,fpgcrawtextfont=verdana,fpgcrawtextr=000,fpgcrawtextg=000,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=80
:state=120:fpgcrawtext=Is that all?
:state=120,etimergreater=500,plrusingaction=1:plrdisable=0,state=121
:state=120,etimergreater=4000:state=121
:state=121:etimerstart,plrdisable=100000,state=122
;//NPC
:state=122:rotateheadrandom=20
:state=122:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=122:fpgcrawtext=Yes that is all. And now keep your word Templar.
:state=122,etimergreater=500,plrusingaction=1:state=123
:state=122,etimergreater=4000:state=123
:state=123:etimerstart,plrdisable=100000,state=124
;//PLAYER
:state=124:fpgcrawtextsize=26,fpgcrawtextfont=verdana,fpgcrawtextr=000,fpgcrawtextg=000,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=80
:state=124:fpgcrawtext=I trust you - for now. Safe travels Dwarf.
:state=124,etimergreater=500,plrusingaction=1:plrdisable=0,state=125
:state=124,etimergreater=4000:plrdisable=0,state=125
:state=125,shotdamage=1:state=290
:state=125:etimerstart,state=126
;//NPC
:state=126,shotdamage=1:state=290
:state=126:fpgcrawtextsize=24,fpgcrawtextfont=verdana,fpgcrawtextr=051,fpgcrawtextg=204,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=15
:state=126:fpgcrawtext=Good luck Templar.
:state=126,etimergreater=500,plrusingaction=1:plrdisable=0,state=127
:state=126,etimergreater=4000:state=127
:state=127:fpgcrawtextoff
:state=127,shotdamage=1:state=290
;//NPC WALKING WAYPOINTS AND VANISHING - You need to set up 4 waypoints for the script to work
:state=200,shotdamage=1:state=290
:state=200:waypointstart,animate=92,state=210
:state=210,shotdamage=1:state=290
:state=210,waypointstate=3:waypointnext,animate=92,state=220
:state=220,shotdamage=1:state=290
:state=220,waypointstate=3:waypointnext,animate=92,state=230
:state=230,shotdamage=1:state=290
:state=230,waypointstate=3:waypointnext,animate=92,state=240
:state=240,shotdamage=1:state=290
:state=240,waypointstate=5:destroy
;//NPC ATTACKS THE PLAYER
:state=290:runfpi=people\dwarfattack.fpi
;End of Script
In short this script does the following:
- when the player gets into range of the NPC, the conversation starts
- during the conversation the player cannot move.
- it is self-running until the player has at one point to decide how to answer (=which key to press)
- the player can speed up the the conversation in pressing <enter>
- player and NPC lines differ through colour and position
- the player gets a choice somewhere to keep talking, go his way, or fight
- at the end the NPC goes along waypoints to a door and vanishes
- the player can attack the NPC prior to the conversation, when he is offered the choice in between and after the conversation when the NPC walks away (the script then uses RUNFPI=).
I am not completely satisfied with the placement and the colour of the text lines (upper light blue for the NPC, down bright blue for the player) but it should provide a good start for everyone.
Here's how the setup looks like in the editor:
DOWNLOAD: Here is the download link for the ready .fpi AND a testgame to see the script in action-->
http://www.gamefront.com/files/22087259/ConversationDwarf02.rar
You can attach this script p.e. to a commanding officer, an ally, a help seeker, a computer terminal or an intercom. And you can do a lot more than just have the NPC walk away at the end, the possibilities to customize it are nearly endless.
In case you find my grammar and spelling weird ---> native German speaker ^^