SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Releases > Miscellaneous

Reply
 
Thread Tools
Dialog system Details »»
Dialog system
Version: 1.2.0, by Monster psychic cat Monster psychic cat is online now
Developer Last Online: Mar 2017

Category: Version: SRB2 Rating: (1 votes - 3.20 average)
Released: 01-16-2017 Last Update: Never Installs: 0
SOCs Scripts Re-Useable Content Sprites/Graphics



The dialog system backported from a certain mod.
While questions are not needed to start a dialog, a certain amount of questions can be provided to execute another function (that can be ending the conversation, or even starting another dialog!)

The lua lumps have some comments to make you understand (probably) what's going on.

Download Now

File Type: zip dialogsystem.zip (38.4 KB, 88 views)

Screenshots

Click image for larger version

Name:	kuchiyama_dialog1.png
Views:	217
Size:	38.0 KB
ID:	9480   Click image for larger version

Name:	robohood-1.png
Views:	213
Size:	17.5 KB
ID:	9481   Click image for larger version

Name:	ThoroughRegalLcont.gif
Views:	114
Size:	183.0 KB
ID:	9538  

Show Your Support

  • The author of this addon has given explicit permission for its content to be re-used and/or reproduced.

Comments
Old 01-21-2017   #2
FuriousFox
AKA FuriousFox
Developer
 
FuriousFox's Avatar
Default

Welcome to Releases!
FuriousFox is offline   Reply With Quote
Old 01-22-2017   #3
GreenKnight9000
Default

it would be cool to add your own dialog so that when people go up to you, your own little dialog would come up
GreenKnight9000 is offline   Reply With Quote
Old 01-22-2017   #4
Boo
The Guy that Destroys stuff
 
Boo's Avatar
Default

Wow, pretty nice it seems simple, Welcome to Miscellaneous Releases.
__________________
I am also on super mario boards https://www.marioboards.com/ as Kirby
Boo is offline   Reply With Quote
Old 01-22-2017   #5
ManimiFire
Meow Motherfuckers.
 
ManimiFire's Avatar
Default

https://gfycat.com/ThatBabyishArthropods I'm actually enjoying messing with this system... Nice job MPC!
__________________
Check out my youtube channel: https://www.youtube.com/channel/UCd1...hUkNvNA93RPI8g
ManimiFire is offline   Reply With Quote
Old 01-23-2017   #6
Messias the Werehog
I don't killed nobody...
 
Messias the Werehog's Avatar
Default

Now Die! X_X
__________________
My Site: SRB2 Retro
My Steam
Messias the Werehog is offline   Reply With Quote
Old 01-30-2017   #7
GreenKnight9000
Default

tutorial on how to use?
GreenKnight9000 is offline   Reply With Quote
Old 01-30-2017   #8
Monster psychic cat
 
Monster psychic cat's Avatar
Default

Quote:
Originally Posted by GreenKnight9000 View Post
tutorial on how to use?
Spoiler: I don't know how to explain things
First, make a copy of MT_NPC's mobjinfo (in LUA_SOC) and rename it to something else, also changing its thing type.

PHP Code:
mobjinfo[MT_JIM] = {
    
doomednum 2009,
    
spawnstate S_NPCSPAWN,
    
spawnhealth 1,
    
seestate S_NPCSTAND,
    
seesound sfx_None,
    
reactiontime 0,
    
attacksound sfx_thok,
    
painstate S_NPCSTAND,
    
painchance 0,
    
painsound sfx_None,
    
meleestate S_NPCSTAND,
    
missilestate S_NPCSTAND,
    
deathstate S_NULL,
    
xdeathstate S_NULL,
    
deathsound sfx_None,
    
raisestate S_NPCSTAND,
    
speed 1,
    
radius 32*FRACUNIT,
    
height 48*FRACUNIT,
    
dispoffset 0,
    
mass 1000,
    
damage 5,
    
activesound sfx_None,
    
flags MF_RUNSPAWNFUNC|MF_SOLID|MF_SPECIAL

On LUA_MAIN, add the mobj name you allocated before to the global npclist table.

PHP Code:
// npcs
rawset(_G"npclist", {
MT_NPCMT_DBGNPCMT_JIM}) 
At LUA_NPC, hook a new dialog function with that mobj name.

PHP Code:
NPC_HookDialog(
    
MT_JIM,                    // npc type
    
function(npctoucher)
        
local player toucher.player
        
(do things)
    
end

P_InitiateDialog is the function that starts a new cutscene.

PHP Code:
P_InitiateDialog(
      
player,            // The player.
      
"Jim",            // The talking character. Can be nil.
      
npc,            // The object the dialog was triggered from.
      
false,            // Is this a question?
      
dialogues,
      
questions

Now, assume dialogues and questions are local variables defined before the InitiateDialog function.

dialogues is an table containing all text lines.

PHP Code:
local dialogues = {
    
"This is a line",
    
"This is another line"

choices is an table that uses tables as their entries. Each of these entries have "choice" and "code" entries that define what that answer does. Obviously, nly used if current dialog is a question.

PHP Code:
NPC_HookDialog(
    
MT_JIM,                    // npc type
    
function(npctoucher)
        
local player toucher.player
local choices 
= {
   {
      
choice "A choice",
      
code = function(playernpc)
           (do 
stuff)
      
end
   
},
   {
      
choice "Choice that ends dialog",
      
code = function(player)
          
P_ForceDialogEnd(player)
      
end
   
}

The end result would be this:

Spoiler:

PHP Code:
NPC_HookDialog(
    
MT_JIM,                    // npc type
    
function(npctoucher)
        
local player toucher.player
        local dialogues 
= {
            
"This is a line",
            
"This is another line"
        
}
        
local choices = {
           {
              
choice "A choice",
              
code = function(playernpc)
                   (do 
stuff)
              
end
           
},
           {
              
choice "Choice that ends dialog",
              
code = function(player)
                  
P_ForceDialogEnd(player)
              
end
           
}
        }
        
P_InitiateDialog(
              
player,            // The player.
              
"Jim",            // The talking character. Can be nil.
              
npc,            // The object the dialog was triggered from.
              
false,            // Is this a question?
              
dialogues,
              
questions
        
)
    
end



Or, without using local variables:
Spoiler:

PHP Code:
NPC_HookDialog(
    
MT_JIM,                    // npc type
    
function(npctoucher)
        
local player toucher.player
        local dialogues 

        
local choices 
        
P_InitiateDialog(
              
player,            // The player.
              
"Jim",            // The talking character. Can be nil.
              
npc,            // The object the dialog was triggered from.
              
false,            // Is this a question?
              
{
                
"This is a line",
                
"This is another line"
                  
},
              {
                   {
                      
choice "A choice",
                      
code = function(playernpc)
                       (do 
stuff)
                    
end
                 
},
                   {
                   
choice "Choice that ends dialog",
                    
code = function(player)
                      
P_ForceDialogEnd(player)
                    
end
                   
}
              }
        )
    
end



Last edited by Monster psychic cat; 01-30-2017 at 09:05 PM.
Monster psychic cat is online now   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:50 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.