Aller au contenu

Photo

Missing character models with custom Background


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

#1
JnBaker

JnBaker
  • Members
  • 25 messages
 Followed the character background tutorial and got it up and running.  Now making my edits to fit my story.  I just need one race and two classes.  Made the edits to the background.xls, and did some hacky edits to the script files.  Now when I load up my module and get into creating my character, no model is there.  I can choose the race, class, and background but after that everything is blank.  Any clue as to where in the setup that may be failing?  Thanks.

#2
JnBaker

JnBaker
  • Members
  • 25 messages
Here are my edits

#include "jnb_sys_chargen_h"
#include "log_h"

const int CHARGEN_QUICKSTART_QUICK = 0;
const int CHARGEN_QUICKSTART_NORMAL = 1;
const int CHARGEN_QUICKSTART_ADVANCED = 2;

void _RunChargen(int nRace, int nclass, object oChar, int nBackground)
{

    Chargen_InitializeCharacter(oChar);
    Chargen_SelectGender(oChar,GENDER_MALE);
    Chargen_SelectRace(oChar,nRace);
    Chargen_SelectCoreclass(oChar,nclass);
    Chargen_SelectBackground(oChar, nBackground,FALSE);

    int nEquipIdx = Chargen_GetEquipIndex(nRace, nclass, nBackground);
    Chargen_InitInventory(oChar,0,nEquipIdx);
    Chargen_SpendAttributePoints(oChar,PROPERTY_ATTRIBUTE_STRENGTH, 3,FALSE);
    Chargen_SpendAttributePoints(oChar,PROPERTY_ATTRIBUTE_DEXTERITY, 2,FALSE);

}
/*
void main(){
    event   ev              =   GetCurrentEvent();
    int     nEventType      =   GetEventType(ev);
    object  oChar           =   GetEventObject(ev,0);

    int nMode;
    int nInt0 = GetEventInteger(ev,0);
    int nInt1 = GetEventInteger(ev,1);
    // -------------------------------------------------------------------------
    // Debug Data.
    // -------------------------------------------------------------------------
    Log_Trace(LOG_CHANNEL_EVENTS_CHARGEN,"jnb_sys_chargen","Chargen Event:" + Log_GetEventNameById (nEventType)
               + " " + ToString(nInt0) + "," + ToString(nInt1), oChar);

    int nEventHandled = FALSE;

    switch (nEventType)
    {
        // ----------------------------------------------------------------------
        // This fires when the player selects the icon corresponding to any of
        // the available backgrounds
        //
        // nInt0 - Constant BACKGROUND_* integer
        // ----------------------------------------------------------------------
        case EVENT_TYPE_CHARGEN_SELECT_BACKGROUND: {
            int nBackground = nInt0;
            // -----------------------------------------------------------------
            // Set the background on the player and reinitialize plot flags
            // for the background
            // -----------------------------------------------------------------
            Chargen_InitializeCharacter(oChar,TRUE);
            Chargen_SelectGender(oChar,GetCreatureGender(oChar));
            Chargen_SelectRace(oChar,GetCreatureRacialType(oChar));
            Chargen_SelectCoreclass(oChar,GetCreatureCoreclass(oChar));

            jnb_Chargen_SelectBackground(oChar, nBackground, FALSE);
            jnb_Chargen_SetupPlotFlags(oChar);

            // -----------------------------------------------------------------
            // Generate the index into the equipment template 2da and
            // then load the starting equipment based on the data returned.
            // -----------------------------------------------------------------
            int nclass = GetCreatureCoreclass(oChar);
            int nRace = GetCreatureRacialType(oChar);
            int nEquipIdx = Chargen_GetEquipIndex(nRace, nclass, nBackground);
           Chargen_InitInventory(oChar,0,nEquipIdx);
            nEventHandled = TRUE;
            break;
        }
        case EVENT_TYPE_CHARGEN_END: {
            nMode = nInt0;
            int nQuickStart = nInt1;
            // 0 - quickstart
            // 1 - normal    \\\\
            // 2 - advanced  / treat as the same
            Log_Trace(LOG_CHANNEL_CHARACTER,"jnb_sys_chargen","MODE: " + IntToString(nMode)
                       + ", Quick Start: " + IntToString(nQuickStart));
            if (nMode == CHARGEN_MODE_CREATE && nQuickStart == CHARGEN_QUICKSTART_QUICK){
                Log_Trace(LOG_CHANNEL_CHARACTER,"jnb_sys_chargen","Setting default values for player character");

                    int nRandclass = abs((GetLowResTimer()%3)+1);

                    if(nRandclass == class_ROGUE || nRandclass == class_WARRIOR)
                    {
                        _RunChargen(RACE_ELF, nRandclass, oChar, BACKGROUND_ELF_SCOUT );

                        WR_SetPlotFlag(PLT_JNB_000PT_BACKGROUNDS, JNB_GEN_BACK_ELF_SCOUT, TRUE);
                    }
                  else // mage
                   {
                      _RunChargen(RACE_HUMAN, nRandclass, oChar, BACKGROUND_APPRENTICE );
                       WR_SetPlotFlag(PLT_JNB_000PT_BACKGROUNDS, JNB_GEN_BACK_APPRENTICE, TRUE);
                    }
                    Chargen_SetNumTactics(oChar);
                    SetCanLevelUp(oChar,Chargen_HasPointsToSpend(oChar));
                    SendEventModuleChargenDone("", "");
                    nEventHandled = TRUE;
            }
            break;
        }
    }    //end switch

    if (!nEventHandled){
        HandleEvent(ev, R"sys_chargen.ncs");
    }


}
*/

And

#include "sys_chargen_h"
#include "jnb_2da_constants_h"
#include "wrappers_h"
#include "plt_jnb_000pt_backgrounds"

void jnb_Chargen_SelectBackground(object oChar, int nBackground, int bUnApply = FALSE)
{
     Log_Chargen("jnb_Chargen_SelectBackground","-- " + (bUnApply?"Un":"") +"Selecting BG: " + ToString(nBackground),oChar);
    // -------------------------------------------------------------------------
    // 1. Set the background variable
    //          - Create creature property (or check what we used so far
    //          - We don't set backgrounds on non player generated chars.
    // -------------------------------------------------------------------------
    if (bUnApply)
    {
        SetCreatureProperty(oChar, PROPERTY_SIMPLE_BACKGROUND, 0.0, PROPERTY_VALUE_BASE);
    }
    else
    {
       SetCreatureProperty(oChar, PROPERTY_SIMPLE_BACKGROUND, IntToFloat(nBackground), PROPERTY_VALUE_BASE);
    }
    // -------------------------------------------------------------------------
    // 2. Give one skill
    //    - retrieve the skill that is granted by the background from backgrounds.xls
    //    - give it to the player.
    // -------------------------------------------------------------------------
    int nAbility = ChargenGetBackgroundSkill(GetCreatureRacialType(oChar), nBackground);
    if (nAbility)
    {
        _AddAbility (oChar, nAbility, bUnApply);
    }
}
/*
void jnb_Chargen_SetupPlotFlags(object oChar)
{
    int nRace       =  GetCreatureRacialType(oChar);
    int nBackground = GetPlayerBackground(oChar);

    Log_Trace(LOG_CHANNEL_CHARACTER,"jnb_sys_chargen_h","Setting plot flags, race: "
               + IntToString(nRace) + ", background: " + IntToString(nBackground));

    // First, init all flags (debug setup)
    WR_SetPlotFlag(PLT_JNB_000PT_BACKGROUNDS, JNB_GEN_BACK_ELF_SCOUT,FALSE);
    WR_SetPlotFlag(PLT_JNB_000PT_BACKGROUNDS, JNB_GEN_BACK_APPRENTICE,FALSE);
    WR_SetPlotFlag(PLT_JNB_000PT_BACKGROUNDS, JNB_GEN_BACK_DWARF_TRAVELLER,FALSE);
    WR_SetPlotFlag(PLT_JNB_000PT_BACKGROUNDS, JNB_GEN_BACK_ELF_TRAVELLER,FALSE);

    switch (nBackground)
    {
        case BACKGROUND_ELF_SCOUT:
        {
            WR_SetPlotFlag(PLT_JNB_000PT_BACKGROUNDS, JNB_GEN_BACK_ELF_SCOUT,TRUE); break;
            break;
        }
       case BACKGROUND_APPRENTICE:
       {
            WR_SetPlotFlag(PLT_JNB_000PT_BACKGROUNDS, JNB_GEN_BACK_APPRENTICE,TRUE); break;
            break;
        }
        case BACKGROUND_TRAVELLER:
       {
            switch(nRace)
           {
                case RACE_DWARF: WR_SetPlotFlag(PLT_JNB_000PT_BACKGROUNDS, JNB_GEN_BACK_DWARF_TRAVELLER,TRUE); break;
                case RACE_ELF: WR_SetPlotFlag(PLT_JNB_000PT_BACKGROUNDS, JNB_GEN_BACK_ELF_TRAVELLER,TRUE); break;
            }
            break;
        }
    }
}
*/

Let me know if there are any details I'm leaving out. Thanks.

Modifié par JnBaker, 05 janvier 2011 - 03:41 .


#3
JnBaker

JnBaker
  • Members
  • 25 messages
Here is where things stand. I knew it probably wouldn't work the way I did it. Just commenting out those sections, but I gave it a go :)



Currently I've paired it down to having two backgrounds. While this isn't my initial goal, it has spurred some more thought on my story and I may go with it. Give two backgrounds/perspectives on the same plot. Should be pretty fun and a great writing exercise. If anyone comes up with a way to have just one background though, I'm all ears.

#4
jackkel dragon

jackkel dragon
  • Members
  • 2 047 messages
For the model problem, I'm assuming you have the chargen preloads all set up properly and the right creature files in the background defaults? (2das) Even a minor slip seems to kill the model. Also, make sure you export the creature files.



Otherwise, I'm pretty sure there was an error I had once that wasn't related to 2da, but I can't remember how I fixed it.

#5
Proleric

Proleric
  • Members
  • 2 350 messages
The engine is also very picky about internal consistency in background.xls.

Ensure that the legal background-race-class combinations and creature templates are exactly the same on every sheet that refers to them.

As always, try removing all other mods if you have any installed.

#6
JnBaker

JnBaker
  • Members
  • 25 messages

Proleric1 wrote...

The engine is also very picky about internal consistency in background.xls.

Ensure that the legal background-race-class combinations and creature templates are exactly the same on every sheet that refers to them.

As always, try removing all other mods if you have any installed.


Hrm, well I don't have to worry about any other mods as this is the first thing I've attempted.  Going over the  the background.xls information I have a simple setup of of only one background (Scout).  That background can be an Elf only.  Then, the Elf can be either Warrior or Rogue using the default_elf_city_w.utc and default_elf_city_r.utc respectively. 

What is funny is that everything can be picked and and you can move onto the next page.  Its just there it stops because, obviously, there is no model to manipulate.  Oh well.  I think I'll go with my new plan of having two backgrounds.  It will require more writing and work over all, but I think the end product will be better for it.

#7
Proleric

Proleric
  • Members
  • 2 350 messages
I've worked with one background successfully, so that isn't the problem.

Also, the .utc files only affect initial kit, not appearance, so if you can't see an elf on the second screen, something else is broken.

Have you tried to do chargen using the standard script in the wiki? If that works, the problem lies in your custom script. What are you trying to do there?

As you've just started, I assume you haven't tried to modify the partypicker stage for custom followers yet? If you have, that could explain the problem.

#8
JnBaker

JnBaker
  • Members
  • 25 messages

Proleric1 wrote...

I've worked with one background successfully, so that isn't the problem.

Also, the .utc files only affect initial kit, not appearance, so if you can't see an elf on the second screen, something else is broken.

Have you tried to do chargen using the standard script in the wiki? If that works, the problem lies in your custom script. What are you trying to do there?

As you've just started, I assume you haven't tried to modify the partypicker stage for custom followers yet? If you have, that could explain the problem.


Yeah, I was able to follow and setup the custom scripts from the wiki and everything worked great.  It was when pairing down to just one race pick, two classes, and one background that I started getting into problems. 

So at this point I've been trying to trouble shoot where it was breaking down.  Either in the 2DA's or the script.  My hunch is the script as the only way I really could figure what to do was to start commenting out sections I wouldn't need.  This is where my lack of scripting knowledge comes in, as I don't know what parts I should keep, and others remove :- /

#9
Proleric

Proleric
  • Members
  • 2 350 messages
What are you trying to do with the script? I don't recognise it from any of the wiki tutorials.

The first script on this page would allow you to test your 2DA files with vanilla character generation.

#10
JnBaker

JnBaker
  • Members
  • 25 messages

Proleric1 wrote...

What are you trying to do with the script? I don't recognise it from any of the wiki tutorials.

The first script on this page would allow you to test your 2DA files with vanilla character generation.


I'm changing the background names and descriptions, while limiting the race selection.  Those scripts are edited versions of the ones from the Backgrounds tutorial.  My original, overall goal was to just have the Elf race selectable, with the choice between warrior and rogue, and only one background.  Scout.

#11
Proleric

Proleric
  • Members
  • 2 350 messages
Try taking commenting this out from your module event script:

[dascript]
default:
{
// -----------------------------------------------------------------
// Handle character generation events sent by the engine.
// -----------------------------------------------------------------
if ((nEvent >= EVENT_TYPE_CHARGEN_START && nEvent <= EVENT_TYPE_CHARGEN_END)
|| nEvent == EVENT_TYPE_PLAYERLEVELUP )
{
HandleEvent(ev, R"bdm_sys_chargen.ncs");
nEventHandled = TRUE;
}
break;
}
[/dascript]


To comment out, put /* before the section and */ after it.

That will by-pass the custom chargen script, demonstrating whether your 2DA files are set up correctly when used with the vanilla process.

I'm not using the custom chargen script myself. My custom background seems to work without it.

The tutorial doesn't explain what that customisation aims to achieve, nor does it tell us which lines are different from the vanilla script, so debugging it could be a long job.

I notice that the script contains various constants BACKGROUND_* etc. If you do need to use that script for some reason, you'd need to change all such references to match the race-class-background combinations you have defined in the 2DA files.

Modifié par Proleric1, 07 janvier 2011 - 09:35 .