N-DReW25

Creating a Pazaak NPC [TSL]

Recommended Posts

I am attempting to create a new NPC into the game that you can play Pazaak with and I want to know what exactly I'd have to do to make this NPC work (such as the actual Pazaak script and the scripts for the dialogue conditionals for when you win/lose etc)

 

Would someone be willing to show me what I am supposed to do?

Share this post


Link to post
Share on other sites

As far as starting the game of pazaak during a dialog, you want to have a blank Entry line after the Player reply or NPC response to starting a game. For that blank Entry, you'll want to put "a_playpazaak" (without the quotes) in the Script that fires #1" slot.

 

This script uses TSL's Script Parameter slots in the DLG file. In DLG Editor, the slots for this script have the following use:

 

P1 - Which row from "pazaakdecks.2da" will be used to form the opponent's side deck.

P2 - The wager amount

P3 - Whether or not to play the tutorial

P4 - The delay (in seconds) before starting the game

String Param - The name, minus the extension, of the script to run after the game is over. This is typically used to set a global variable or whatever and then start either the original dialogue or a new one.

 

There is a function called "GetLastPazaakResult();" that needs to be used before you reload the save, since the result isn't saved. I'm assuming you'll have the dialog file itself figured out. The actual scripts you would use could be as follows:

 

Script to run after the game is over:

 

 

void main()
{
    AssignCommand(GetFirstPC(), ActionStartConversation(GetObjectByTag("tag of the npc"), "name of dialogue, or blank for the NPC's default"));
}

 

 

Script to check if the Player won the game:

 

 

int startingconditional()
{
    // Returns 0 if the NPC won, 1 if the Player won.
    return GetLastPazaakResult();
}

 

 

If that last one doesn't work, then you'll need to edit the script that runs after the game is over to include the following BEFORE you start the conversation:

 

SetGlobalBoolean("G_Paz_JustPlayed", GetLastPazaakResult());

 

And instead of the script above that checks if you won, you'd use the "c_glob_bool_set" (minus the quotes) script as the conditional script. You'd enter "G_Paz_JustPlayed" (minus the quotes) as the String Param for that script.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.