Page 1 of 1

RPG dialog

Posted: August 21st, 2011, 5:36 am
by wildflower
I'm working on a simple rpg, and so far I have a nice map and some quests, but I'm kind'a stuck on the whole dialog, and I'd like to have my npc's to have different dialog depending on quest-status.

I was thinking something like this:

Code: Select all

queststatus = 0

npcscript = (r_script_dup $genericnpcscript)
r_script_signal interact [
	if (= ($queststatus) 0) [
		r_script_say "You do NOT have a quest" [
		r_response "OK" -1
	]
	if (= ($queststatus) 1) [
		r_script_say "You have a quest" [
		r_response "OK" -1
	]
]
The above doesn't work, but is it possible to do something like this?

EDIT: forgot to mention that I use 2.6.1

Re: RPG dialog

Posted: August 21st, 2011, 6:42 am
by Hirato
wildflower wrote:I'm working on a simple rpg, and so far I have a nice map and some quests, but I'm kind'a stuck on the whole dialog, and I'd like to have my npc's to have different dialog depending on quest-status.

I was thinking something like this:

Code: Select all

queststatus = 0

npcscript = (r_script_dup $genericnpcscript)
r_script_signal interact [
	if (= ($queststatus) 0) [
		r_script_say "You do NOT have a quest" [
		r_response "OK" -1
	]
	if (= ($queststatus) 1) [
		r_script_say "You have a quest" [
		r_response "OK" -1
	]
]
The above doesn't work, but is it possible to do something like this?

EDIT: forgot to mention that I use 2.6.1
Dialogue is defined separately, and not as part of any of the signals
You start dialogue by using r_chat.
There are significant changes to the current development version so I can't really help you much more

Re: RPG dialog

Posted: August 21st, 2011, 7:07 am
by wildflower
Hirato wrote:Dialogue is defined separately, and not as part of any of the signals
You start dialogue by using r_chat.
There are significant changes to the current development version so I can't really help you much more
Thanks for answering, but I'm not sure I understand, so please bear with me :oops:

I have seen that some use newgui-guitext ect. to make dialogs, and it confuses me a bit.
The default example (that I based my scripts on) use r_script_say like this:

Code: Select all

npc2script = (r_script_dup $genericnpcscript)
r_script_say "This is the npc speaking" [
	r_response "This is the player answering" -1
]
Is this a deprecated way of doing i ?

Re: RPG dialog

Posted: August 21st, 2011, 10:24 pm
by Hirato
that is more or less still the syntax for the development version

Re: RPG dialog

Posted: August 23rd, 2011, 4:39 am
by wildflower
Hirato wrote:that is more or less still the syntax for the development version
I just checked out the svn version, and I can see that there are a lot of nice things on the way :D

I know it might be a bit early to predict how the final 2.7 will behave, but are you going to stick with the file-structure as it is in the svn (0.cfg, 1.cfg etc.)?
It seams a bit less intuitive not to have filenames that reflect their content, but I can see that MasterChefOgro and Rosestorm both use that format, and I just wanted to make sure that my code will work in 2.7 without to many changes.

Re: RPG dialog

Posted: August 23rd, 2011, 8:15 am
by Hirato
After 2.7 is released I would advertise the RPG to be of Alpha quality, as opposed to the Pre-Alpha/Tech Demo status it had before now.

I intend to stick with that file structure for now, though I may change it a bit in the future to allow named scripts.
Using such numbers make it much much easier to guarantee a constant order among sessions, provide editmode helpers and other editmode facilities.
Such as a menu of critters than contains every defined critter, or that definitions menu where you can tweak the variables in real time.

In any case, conversion wise most of it will work after being reorganised and tweaked to comply with the new structure.
The exceptions are the scripts and cutscene subsystems as they have literally been rewritten. Scripts now use a reference table, implemented to be used upon cubescript and the cutscenes now consist of movement primitives, graphical primitives and transformations as well as several interpolation modes. This also brings us to the HUD, two read-only variables, hud_bottom and hud_right have been exposed, these are constant with the cutscenes and should be used to define things to draw upon the HUD so it scales across resolutions (you read that right, the HUD is 100% scriptable from 2.7.0 onwards) and they attempt to fit a resized 1600x1200 screen within your resolution.

Script wise, you have significant changes to make, for starters the predefined slots no longer exist and have been replaced with a signal based approach, there are a few hard coded signals, such as update, hit and interact, everything else is defined by you, you can name them what you want, you can send a signal from whenever and have things react by receiving the signal. (look at some of the example scripts in data/rpg/games/base for samples).
The other significant change I mentioned is the introduction of references, this requires significant changes to the script, as old and now selection facilities were removed or modified. There's a few examples below, I don't actually remember the old commands at all, so I don't guarantee factual accuracy :P

Code: Select all

//old script definition
r_script_interact [
    r_select_actor [
        r_kill
    ]
]

//old means to kill everything on the current map
r_select_curmap [
    r_loop_ents [
        r_kill
    ]
]

//new means to define scripts
r_script_signal "interact" [
    r_kill actor
]

//new means for killing everything on curmap
r_loop_ents curmap ent [
    r_kill ent
]

Re: RPG dialog

Posted: August 23rd, 2011, 11:54 am
by wildflower
A 100% skin-able hud would be a nice touch, and I'm really looking forward to the "critters" menu :-)

I have managed to get through most of my code, but the inventory is giving me some trouble.
In "item-colection-qusts" (find five barrels etc.) I could check the inventory amount with :

Code: Select all

r_inv_getamnt $barrel
But I can see that menus.cfg have changed a lot, and now uses r_get_amount instead, and I can't wrap my head around the syntax.
Is there a easy way of checking the amount of specific items in the inventory?

EDIT:
Sorry to bother everyone again, but I figured it out :D

If I want to see how many barrels I have in my inventory I can do:

Code: Select all

r_get_amount player 4
Where 4 is a reference to _/items/4.cfg (my barrel configuration)

Re: RPG dialog

Posted: August 23rd, 2011, 8:08 pm
by Hirato
as I mentioned, everything is reference based now and I've been trying to get rid of most of the "dummies" I made in rpggui.cpp to implement the guis.

I'm glad you figured it out, but if you get stuck (which you will), feel free to ask me over IRC or check src/rpggame/rpgscript.cpp for some guidance, you can even use some examples from the default game to help you.
I'll write up some proper documentation after 2.7.0 has been released :)

Re: RPG dialog

Posted: August 24th, 2011, 6:20 am
by wildflower
The two games (Rosestorem and MasterChefOgro) have been very helpful, and the base folder is also a nice touch.

Looking forward to the 2.7.0 release and documentation :D