Aller au contenu

Photo

Custom Chanter's Board help


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
_Randy_

_Randy_
  • Members
  • 10 messages
I need help in creating a custom Chanters board.
Here is what i have sofar.

1. A chanters board placed
2. a copy of the script (den200ip_chanter_board)
3. the copy of the script placed in the chanters board placeable
Here is the part im stuck at. in the script where it says
ShowChantersGUI(5); the 5 is the number of the board to show.
but i cant figure out where the ShowChantersGUI(5); points to.
there has to be a script or something for that.
Any help would be great

#2
Sunjammer

Sunjammer
  • Members
  • 925 messages
The number, the nBoardID, points to a row in the JobBoards worksheet in JobBoards.xls (which configures the board) and to one or more rows in the JobBoardPlots worksheet (which configures the available plots).

You'll need to create you're own version of the chantry_board script and enter your own board and plot information into the MDA to get it to work.

Modifié par Sunjammer, 24 mars 2010 - 01:52 .


#3
Sunjammer

Sunjammer
  • Members
  • 925 messages
Just for fun I went ahead and tested putting a Chantry Board in a custom module. It's not too difficult but there are a number of steps involved. I plan to write it up as a tutorial along with a demo but I have to prepare the monthly Mage of the Blood snapshot so I can't really look at this again until next weekend. However if you have any questions in the meantime let me know.

Super quick guide (hopefully I haven't missed anything):
  • Open the module's Properties (from Manage Modules) and make a note of the module's UID.
  • Decide on a title for your job board, open the String Editor and add the title as an entry to the module's talk table. Note the new String ID.
  • Create one or more plots to display on your job board: each plot must have (at least) an "available" and an "accepted" flag. Make note of the resource name and those two flag numbers for each plot. You will to handle completing the plot and/or giving a reward in the normal way as these are not handled by the job board (i.e. you will have to use plot scripting or conversations).
  • Copy and rename JobBoard.xls, add a suffix to the name of each of the worksheets. You can use the existing data as a template before deleting it.
  • In JobBoards create an entry for your job board. Set the HeaderStrId to the String ID from the first step and set the ModuleRef to the UID of your module. Assign an incrementing ID and make a note of it.
  • In JobBoardPlots create an entry for each plot. Set the PlotRef to the resource name of the plot, the BoardId to the ID assigned in the previous step, the VisibleFlag and AcceptedFlag to the "available" and "accepted" flag numbers from the third step. Label and comment as appropriate. Assign an incrementing ID.
  • Save JobBoard.xls and convert it using ExcelProcessor.exe. Copy or move the .GDA files and place it in your module's data or override directory.
  • Create a new placeable resource. Set the Appearance to Chantry Board, set the Name to something similar to the title from the first step and set the Script to a New script resource (i.e. not placeable_core).
  • Copy the code below into the new script. Replace the number 40 in ShowChantersGUI(40); with ID you assigned to your job board in JobBoards.
  • Add your job board to an area in your module. Export the new/modified resources and test.
#include "placeable_h"

void main()
{
    int bEventHandled;

    event eCurrent  = GetCurrentEvent();
    int nType       = GetEventType(eCurrent);

    //------------------------------------------------------------------------------
    // Handle events
    //------------------------------------------------------------------------------

    switch(nType)
    {
        case EVENT_TYPE_USE:
        {
            //----------------------------------------------------------------------
            // Use Event: sent by engine when a creature uses the placeable.
            //----------------------------------------------------------------------

            int nAction     = GetPlaceableAction(OBJECT_SELF);
            int bVariation  = GetEventInteger(eCurrent, 0);

            switch(nAction)
            {
                case PLACEABLE_ACTION_EXAMINE:
                {
                    ShowChantersGUI(40);

                    SetPlaceableActionResult(OBJECT_SELF, nAction, TRUE, bVariation);

                    bEventHandled = TRUE;
                    break;
                }
            }

            break;
        }
    }

    //------------------------------------------------------------------------------
    //  Unhandled events drop through to core
    //------------------------------------------------------------------------------

    if(!bEventHandled)
    {
        HandleEvent(eCurrent, RESOURCE_SCRIPT_PLACEABLE_CORE);
    }
}

Modifié par Sunjammer, 27 mars 2010 - 11:30 .


#4
Sunjammer

Sunjammer
  • Members
  • 925 messages
Oops it seems I did something ...

I didn't cover the fact that you have to SET the "available" (aka "visible") flag by default (in the plot editor) and then use plot scripting to UNSET it when the "accepted" flag is SET. This needs to be done or the plot won't appear/disappear from the job board.

I'll post up an example of that tomorrow.

#5
Sunjammer

Sunjammer
  • Members
  • 925 messages
Here is the sample plot script from the job board demo module I created:

#include "utility_h"
#include "wrappers_h"
#include "plt_sj_job_board_rats"


void AddCreatureExperience(int nXp, object oCreature=OBJECT_SELF)
{
    // there is no modify for "base" values set to total of current + award 
    float fXp = IntToFloat(GetExperience(oCreature)+ nXp);
    SetCreatureProperty(oCreature, PROPERTY_SIMPLE_EXPERIENCE, fXp, PROPERTY_VALUE_BASE);
}


int StartingConditional()
{
    int bResult;

    // deconstruct event
    event eCurrent  = GetCurrentEvent();
    int nType       = GetEventType(eCurrent);
    int nFlag       = GetEventInteger(eCurrent, 1);
    string sPlot    = GetEventString(eCurrent, 0);

    //------------------------------------------------------------------------------
    // Handle Event
    //------------------------------------------------------------------------------

    switch(nType)
    {
        case EVENT_TYPE_SET_PLOT:
        {
            //----------------------------------------------------------------------
            // Set Event (main flags only)
            //----------------------------------------------------------------------
            // NOTE: The flag's value is only set AFTER this script finishes

            // the plot flag is the second value in the event's ints list
            int nNewValue = GetEventInteger(eCurrent, 2);
            int nOldValue = GetEventInteger(eCurrent, 3);

            switch(nFlag)
            {
                case SJ_JOB_BOARD_RATS_ACCEPTED:
                {
                    // drop the "available" flag to remove from job board
                    WR_SetPlotFlag(PLT_SJ_JOB_BOARD_RATS, SJ_JOB_BOARD_RATS_AVAILABLE, FALSE);

                    // activate the rats (Team=240)
                    UT_TeamAppears(240);

                    bResult = TRUE;
                    break;
                }
                case SJ_JOB_BOARD_RATS_REWARDED:
                {
                    object oHero = GetHero();

                    // reward: 200cp and 200xp
                    AddCreatureMoney(200, oHero);
                    AddCreatureExperience(200, oHero);

                    bResult = TRUE;
                    break;
                }
            }

            break;
        }
        case EVENT_TYPE_GET_PLOT:
        {
            //----------------------------------------------------------------------
            // Get Event (defined flags only)
            //----------------------------------------------------------------------

            switch(nFlag)
            {
                // no defined flags
            }
            break;
        }
    }

    return bResult;
}
Note that you don't have to generate the reward through scripting I just didn't like the options in the reward 2DA and couldn't be bothered creating a new one.

Modifié par Sunjammer, 28 mars 2010 - 10:42 .


#6
Sunjammer

Sunjammer
  • Members
  • 925 messages
I'm about half-way though writing this up unfortunately I'm having to juggle other (higher priority) demands so rather than delay this further I've uploaded the custom job board demo.

Hopefully I can finish the step-by-step in the next couple of weeks.