RPG Dialog resource updated for T3D 3.8

Scripts and code that enhance the gameplay functionality of the engine.
4 posts Page 1 of 1
SqHd
Posts: 55
Joined: Tue Apr 14, 2015 5:02 am
by SqHd » Sun Jul 31, 2016 8:20 pm
RPG Dialog 1.4 to T3D 3.8
(*It also works in T3D 3.9)

Since I couldn’t get the Yack Pack working in T3D 3.8, I decided to check out an old GG resource called: RPG Dialog (v1.4). After some experimenting, I was able to get NPCs spawning with the dialog options. Only issue is the sound isn't working. See console errors:

scripts/client/RPGDialog.cs (190): Unable to find function alxIsPlaying
scripts/client/RPGDialog.cs (191): Unable to find function alxStop
scripts/client/RPGDialog.cs (194): Unable to find function alxPlay



DropBox link: https://www.dropbox.com/sh/gxfy58huq3hvrpl/AACefZCSBHwnU4JAftDhzv9Ga?dl=0

I used the following forum topics to get this working:
(Original Resource): http://www.garagegames.com/community/resources/view/3531
https://www.garagegames.com/community/forums/viewthread/93667
http://www.garagegames.com/community/forums/viewthread/75606
https://www.garagegames.com/community/forums/viewthread/137872
SqHd
Posts: 55
Joined: Tue Apr 14, 2015 5:02 am
by SqHd » Sun Jul 31, 2016 8:32 pm
game/core/scripts/client/core.cs

- After:
exec("~/scripts/client/scriptDoc.cs");

- Add:

Code: Select all

//----------------------------------------------------------------
//RPGDialog Code Begin
//----------------------------------------------------------------   
exec("~/scripts/RPGDialogEditor/ingameRPGDialogEditor.cs");   
//----------------------------------------------------------------
//RPGDialog Code End
//----------------------------------------------------------------



game/scripts/client/config.cs

- Add:

Code: Select all

moveMap.bind(keyboard, "q", TalkTo);



game/scripts/client/default.bind.cs

- Comment/remove the following line:
//moveMap.bindCmd(keyboard, "1", "commandToServer('use',\"Ryder\");", "");

- Add to the end of the file:

Code: Select all

// RPGdialog
moveMap.bind(keyboard, "q", TalkTo);

//----------------------------------------------------------------
//RPGDialog Code Begin
//----------------------------------------------------------------   
function TalkTo(%val)
{
   if(%val)
      commandToServer('RPGDialogRay');
}

moveMap.bind(keyboard, "q", TalkTo);
moveMap.bindCmd(keyboard, "1", "SelectAnswer(1);", "");
moveMap.bindCmd(keyboard, "2", "SelectAnswer(2);", "");
moveMap.bindCmd(keyboard, "3", "SelectAnswer(3);", "");
moveMap.bindCmd(keyboard, "4", "SelectAnswer(4);", "");
moveMap.bindCmd(keyboard, "5", "SelectAnswer(5);", "");
moveMap.bindCmd(keyboard, "6", "SelectAnswer(6);", "");
moveMap.bindCmd(keyboard, "7", "SelectAnswer(7);", "");
moveMap.bindCmd(keyboard, "8", "SelectAnswer(8);", "");
moveMap.bindCmd(keyboard, "9", "SelectAnswer(9);", "");
moveMap.bindCmd(keyboard, "0", "SelectAnswer(10);", "");

function OutOfRPGDialogFunction(%Number)
{
   switch(%Number)
   {
      case 1: commandToServer('use',"Ryder");
      case 2: %Number=0;//Does nothing... just a placeholder.
      case 3: %Number=0;//Does nothing... just a placeholder.
      case 4: %Number=0;//Does nothing... just a placeholder.
      case 5: %Number=0;//Does nothing... just a placeholder.
      case 6: %Number=0;//Does nothing... just a placeholder.
      case 7: %Number=0;//Does nothing... just a placeholder.
      case 8: %Number=0;//Does nothing... just a placeholder.
      case 9: %Number=0;//Does nothing... just a placeholder.
      case 0: %Number=0;//Does nothing... just a placeholder.
   }
}
//----------------------------------------------------------------
//RPGDialog Code End
//----------------------------------------------------------------



game/scripts/gui/optionsDlg.cs

- Right after:
$RemapName[$RemapCount] = "Fire Weapon";
$RemapCmd[$RemapCount] = "mouseFire";
$RemapCount++;

- Add:

Code: Select all

$RemapName[$RemapCount] = "Talk to NPC";
$RemapCmd[$RemapCount] = "TalkTo";
$RemapCount++;



game/scripts/client/defaults.cs

- Add to the end of the file:

Code: Select all

//----------------------------------------------------------------
//RPGDialog Code Begin
//----------------------------------------------------------------   
$Pref::RPGDialog::Client::QuestionPath="art/dialogs/dlq/";//RPGDialog Question Path.
$Pref::RPGDialog::MaxOptions = 100;//RPGDialog Max Options.
$Pref::RPGDialog::ChatHudQuestionColor="\c1";//Question text Color on the chat hud.
$Pref::RPGDialog::ChatHudAnswerColor="\c5";//Answer text Color on the chat hud.
//----------------------------------------------------------------
//RPGDialog Code End
//----------------------------------------------------------------



game/scripts/client/init.cs

- After:
exec("art/gui/remapDlg.gui");

- Add:

Code: Select all

//----------------------------------------------------------------
//RPGDialog Code Begin
//----------------------------------------------------------------   
exec("art/gui/RPGDialog.gui");
//----------------------------------------------------------------
//RPGDialog Code End
//----------------------------------------------------------------


- After:
exec("scripts/gui/optionsDlg.cs");

- Add:

Code: Select all

//----------------------------------------------------------------
//RPGDialog Code Begin
//----------------------------------------------------------------     
exec("./RPGDialog.cs");
exec("./RPGDialogAudioProfiles.cs");   
//----------------------------------------------------------------
//RPGDialog Code End
//----------------------------------------------------------------


- After:
Canvas.setCursor("DefaultCursor");

- Add

Code: Select all

//----------------------------------------------------------------
//RPGDialog Code Begin
//----------------------------------------------------------------       
initRPGDialogEditor();     
//----------------------------------------------------------------
//RPGDialog Code End
//----------------------------------------------------------------



game/scripts/client/pref.cs

- Add to the end of the file:

Code: Select all

$Pref::RPGDialog::ChatHudAnswerColor = "\c5";
$Pref::RPGDialog::ChatHudQuestionColor = "\c1";
$Pref::RPGDialog::Client::QuestionPath = "art/dialogs/dlq/";
$Pref::RPGDialog::MaxOptions = 100;
$Pref::Server::RPGDialog::ActionPath = "art/dialogs/dla/";



game/scripts/server/scriptExec.cs


- After:
exec("./aiPlayer.cs");

- Add:

Code: Select all

//----------------------------------------------------------------
//RPGDialog Code Begin
//----------------------------------------------------------------     
exec("./RPGDialog.cs");
//----------------------------------------------------------------
//RPGDialog Code End
//----------------------------------------------------------------



game/scripts/server/defaults.cs

- After:
// Now add your own game specific server preferences as
// well as any overloaded core defaults here.

- Add:

Code: Select all

//----------------------------------------------------------------
//RPGDialog Code Begin
//----------------------------------------------------------------   
$Pref::Server::RPGDialog::ActionPath="art/dialogs/dla/"; //RPGDialog Action Path.
//----------------------------------------------------------------
//RPGDialog Code End
//----------------------------------------------------------------



game/scripts/server/pref.cs

- Add to the end of the file:

Code: Select all

$Pref::Server::RPGDialog::ActionPath = "art/dialogs/dla/";



game/scripts/server/aiPlayer.cs

- Change this function:

Code: Select all

//-----------------------------------------------------------------------------
// AIPlayer static functions
//----------------------------------------------------------------------------

function AIPlayer::spawnAtLocation()

- To the following:
function AIPlayer::spawnAtLocation(%name, %data, %spawnPoint, %Script, %Portrait, %startQuestion)
{
   // Create the demo player object
   %player = new AiPlayer()
   {
      //dataBlock = DemoPlayer;
      dataBlock = %data;
      path = "";
   };
   MissionCleanup.add(%player);
   %player.setShapeName(%name);
   %player.setTransform(%spawnPoint.getTransform());
   %player.RPGDialogScript = %Script; 
   %player.RPGDialogPortrait = %Portrait; 
   %player.RPGDialogStartQuestion = %startQuestion; 
   %player.RPGDialogBusy = false; 
   %player.RPGDialogBusyText = 'Sorry but I\'m busy talking to %1 right now.'; 
   %player.RPGDialogTalkingTo = 0;
   return %player;
}



game/scripts/server/gameCore.cs

- In this function:
function GameCore::startGame(%game)

- After:
// // Start the AI on the specified path
// AIPlayer::spawn("Path1");

- Add:

Code: Select all

AIPlayer::spawnAtLocation(Kaneda, DemoPlayer, spawn1, "Test", "test.png", 1);


*Note: This is how you spawn the NPCs
- First is the NPC name: Kaneda
- Second is the datablock used for the NPC: DemoPlayer (derived from game/art/datablocks/aiPlayer.cs)
- Next is the new spawn point: spawn1
- Then the RPG Dialog script: Test (found in the dialogs folder)
- Next the RPG Dialog portrait: test.png (found in the dialogs folder)
- Finally, the RPG Dialog start question: 1

Create a spawnsphere in the world editor and name it "spawn1". Place it where ever you like. Also, if you don't want the player to use this as a spawn point, make sure it's NOT in the playerDropPoints simset.
JeffR
Steering Committee
Steering Committee
Posts: 755
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Mon Feb 20, 2017 7:23 am
@
User avatar
SqHd

Hey dude, the dropbox link looks dead. Any chance of a reupload?
SqHd
Posts: 55
Joined: Tue Apr 14, 2015 5:02 am
by SqHd » Mon Feb 20, 2017 4:03 pm
Hi. Link is back and working. Sorry about that. I didn't think anyone was interested.
On a separate note, thanks for all your hard work on 3.10! And I enjoy your work blog. Later.
4 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest