Scripts / Multiple answer questions (AI Text)

Author
Message
TodaysKiller
8
Years of Service
User Offline
Joined: 28th May 2015
Location: Arkansas, U.S.A.
Posted: 23rd Jun 2015 02:05
Greetings everyone,

I'm actually starting my Programming degree tomorrow (woot woot). So I'm really new to Scripting/Programming/etc.

I was wondering (if it's not too hard of a task) if someone could perhaps give me an example script regarding when you Talk (or walk up to) an AI Character they offer different questions and if they ask you a question you can answer multiple answers.

EXAMPLE: Like in Fallout 3, when asked to do a quest you can deny it or accept it.

Could someone perhaps provide just a "starting script" Or an example of maybe 2 questions (or more haha) with 2 or more answers on one or more of the questions? So I could use it as my base script to work off of?


Thank you, I'm not sure if this has been made already for me to purchase or use, or if it's even possible at all.

-TodaysKiller
TodaysKiller
PM
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 23rd Jun 2015 06:17
I'd be very curious about this too. Currently with text all I know how to do is a single line using the prompt command.
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 23rd Jun 2015 07:28 Edited at: 28th Jun 2015 08:44
EDIT: Reworked to random Q and A

Create file qanda.lua (corrected) - paste code. Attach qanda.lua to character. You should only need to modify the questions, answers and correct answers.

Walk toward character, question is asked. Walk away, come back and a new random question is asked. (may be the same question however)

Possible additions?
- Close out questions from being asked twice.
- Change quantity of answers per question

1 hour coded and tested. You owe me a beer.

AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
TodaysKiller
8
Years of Service
User Offline
Joined: 28th May 2015
Location: Arkansas, U.S.A.
Posted: 23rd Jun 2015 14:38
Thank you so much! I'll have to try it after work! And heck, I'll buy you a whole case or two of beer!
TodaysKiller
PM
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 23rd Jun 2015 22:22
haha, it's all good, no beer necessary. I prefer a good wine anyway.

Just note that the code was written specifically to show how it could be done and it is certainly not the only way either. In a "proper" scenario the Q & A should come from a text file because this allows translation without modification to the code. (In fact that's good practise for any dialogue really.)

Meant to also say, good luck with your programming studies. We can look forward to some nice script at a later date perhaps
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
TodaysKiller
8
Years of Service
User Offline
Joined: 28th May 2015
Location: Arkansas, U.S.A.
Posted: 23rd Jun 2015 22:32
Awesome, I'm still stuck at work so I'll try it out later tonight.

And thanks! I'll be sure to write up some scripts later on in the year into next year a bit when I actually learn the basics and what not.

Thanks for all the help, this'll make a lot of things better for my game/s.

-TodaysKiller

P.S. And hey, if international shipping wasn't insane i'd send you a bottle that's made here in my hometown.
TodaysKiller
PM
Stefos
GameGuru TGC Backer
13
Years of Service
User Offline
Joined: 31st Oct 2010
Location:
Posted: 28th Jun 2015 08:29
Don't work for me I get errors, I know nothing about coding...however I am at a loss to this statement "Create file quanda.lu - paste code. Attach qanda.lua to character. You should only need to modify the questions, answers and correct answers."

And I do not understand these statements in the code:

function qanda_init(e)
plyrAnswer = 0
pressed = 0
msg = "Get the answer right and ye shall be rewarded, Make your choice."
qAsked = 0
end

function qanda_main(e)
if qAsked == 0 then
qNum = math.random(1,5)
aIndex = qNum *5
qAsked = 1
end

Am I to create a file called qanda or quanda or am I to create 2 files and if so were does the second file go.

Am I the only one who gets the errors?
http://soul-reflection.com/images/master1_0001.jpg
Stefos
GameGuru TGC Backer
13
Years of Service
User Offline
Joined: 31st Oct 2010
Location:
Posted: 28th Jun 2015 08:35
OK, so I changed the code statements to match the file name and works great now....thanks for the script
http://soul-reflection.com/images/master1_0001.jpg
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 28th Jun 2015 08:43
Lol. My bad. I put a U next to the Q out of pure habit. Script must be called QANDA not QUANDA.

I fixed the original post.
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 30th Jun 2015 21:22
fantastic script !nullptr, thanks
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, AMD HD7870 gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit.
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 30th Jun 2015 22:53
Cheers tarkus. I might get around to making it work with a text file and an indexing system later. That way the answer count can be a variable, different Q&A attached to different characters - and editing will be easier.

(Quite often I do these scripts because I have a personal need and they evolve over time - there's ultimately always a "better way")
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 30th Jun 2015 23:14
Quote: "-- script by !nullptr
-- This script is made available for free use within non-commercial or commercial projects only.
-- It cannot be scraped, modified and resold without the authors express permission. "


Cool!!!, I've another script for selling in store.

Now seriously, have a question for you:
because my hight standford english level (LOL), ¿can I use your words for my scripts?

thanks in advance. (sorry no wine smyle here)

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 8.1 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 30th Jun 2015 23:33
lol. Yep, no problems 3com.

AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 30th Jun 2015 23:42
cool, tx mate.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 8.1 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM

Login to post a reply

Server time is: 2024-05-08 23:12:39
Your offset time is: 2024-05-08 23:12:39