dialogue for a game

hi. i know that many of you wold say, there’s another thread for this. but can anyone link me a good ai script. and a how-to on using it. and a dialogue script? the dialogue scripts here is broken. please. just some quick answers. :frowning: help.

AI is a really general term. You need to specify what you want.

HMM. I need an some simple AI logic in which, if my character comes close, he will follow him, and if he gets close, he will use an animation, therefore a collision, which brings down the hp bar. Speech and dialogue is also a problem for me. I know how to make realtime text. But what comes after that. Please help? :frowning:

comes close = near (sensor)
who is him?
follow = trackto + motion forward

near sensor + action actuator

collision sensor + property actuator (or Python controller)

transfer the information to hp bar via property or messages. Both methods need a Python controller.

Fill the Text property with the data you want to display (again Python controller to set the value).

You can use a delay sensor or timer property + proeprty sensor to let the text disappear after a while (or replace it with other text).

I think the resources forum contains some dialog systems.

selectable text = multiple text object + invisible planes that can be detected by mouse ray.

I hope that helps you to get the idea

Thanks alot man. But I don’t get the speech and dialog part. :frowning: a link perhaps?

This is one simple script using the BLF module, that i made for my intro scene
here it is, i hope it helps:


import bge
import blf
import bgl#### -------------------- bgl.... blender's openGL Functions


c = bge.logic.getCurrentController()
o = c.owner
###-------------------- space
space = bge.logic.keyboard.events[bge.events.SPACEKEY]
###------------------- font path
##path = bge.logic.expandPath('//sanko.ttf') # Expand the path out to the font file.
##font = blf.load(path)

####----------------------actuator
#play = c.actuators["Scene"]

####-----------------------------------------vars
string = o['string']
string2 = "Press Space To continue.|.|.|."
int = o['int']
scale = 0.0025

if space == 1:
    o['int'] += 1

###--------------------------------------- Position of the owner
posX, posY, posZ = o.position

def textSpace():
    bgl.glColor4f(0.0, 0.0, 0.0, 0.7)### sets the colour and transparency of the text (r, g, b, a)
    bgl.glScalef(scale, scale, scale)
    text = string2
    blf.position(0 , posX, posY, posZ) 
    blf.size(0, 130, 72)
    blf.blur(0, 80)
    blf.draw(0, text)

def text():
    bgl.glColor4f(0.0, 0.0, 0.0, 0.7)### sets the colour and transparency of the text (r, g, b, a)    
    bgl.glScalef(scale, scale, scale)
    text = string
    blf.position(0, posX, posY, posZ) 
    blf.size(0, 130, 72)
    blf.blur(0, 80)
    blf.draw(0, text)
    
if int < 18:
    bge.logic.getCurrentScene().post_draw = [text]
else:
    bge.logic.getCurrentScene().post_draw = [textSpace]

if int == 1:
    o['string'] = "Welcome! Press Space to continue!"
    
if int == 2:
    o['string'] = "I am Helper, Sanko's Helper"
    
if int == 3:
    o['string'] = "You see in this universe..."    
    
if int == 4:
    o['string'] = "Every     Agent     has     one."   
    
if int == 5:
    o['string'] = "They are our masters and we help"   
    
if int == 6:
    o['string'] = "with anything... as long as they agree."   
    
if int == 7:
    o['string'] = "..."                   
    
if int == 8:
    o['string'] = "Dont tell ANYone. Sanko is ..."                       
    
if int == 9:
    o['string'] = "... a stubborn bastard."
    
if int == 10:
    o['string'] = "Yes I said it."    
    
if int == 11:
    o['string'] = "He rebelled and still made me"
    
if int == 12:
    o['string'] = "follow him. That is the story..."        
    
if int == 13:
    o['string'] = "...which I am going to show YOU"            
    
if int == 14:
    o['string'] = "Enjoy the ride."    
    
if int == 15:
    o['string'] = "Dont tell anyone."     
    
if int == 16:
    o['string'] = "He is a douche. Bag."    
       
if int == 17:
    o['string'] = "Enjoy the ride"            

###if space has been pressed 19 times, do whatever necessary
##if int >= 19:
    ##c.activate(play)
    

Hope this helps, mind you, im learning myself and there may be a more efficient way of doing this.

well that… goes beyond me, sorry mate. However here’s a simple blend file with the version of dialogue i provided above, i know it’s a bit of a mess, but i’m certain you can expand on it. good luck :smiley:

Attachments

basic_dialogue.blend (1.46 MB)

Thanks alot man. I appreciate it. :slight_smile: I’ll try and learn more.