Aller au contenu

Set starting character for module


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

#1
Guest_dewkl_*

Guest_dewkl_*
  • Guests
I can't seem to find any tutorials on this. How do I set a module to start with a specific character I have created? Right now it's just using Jaden as I'm finishing the levels. I need to set a character with gear, skills and stats that I can use to test the areas. 

#2
PavelNovotny

PavelNovotny
  • Members
  • 344 messages
There are instructions on the wiki - look under Character Generation.

#3
Guest_dewkl_*

Guest_dewkl_*
  • Guests
Edit: Solved temporarily by switching out the default character.

For some reason the character is locked in tutorial mode when it starts (level up tutorial), the background music from the character creation doesn't go away and tutorial acts stuck. Here's a screenshot.

#include "sys_chargen_h"
#include "utility_h"
#include "sys_rewards_h"

const int FORCE_AUTOLEVEL = 2;

void main()
{
    // keep track of whether the event has been handled
    int nEventHandled = FALSE;

    event ev = GetCurrentEvent();
    switch(GetEventType(ev))
    {
        case EVENT_TYPE_MODULE_START:
        {
            object oHero = GetHero();

            // skip character generation
            Chargen_InitializeCharacter(oHero);
            Chargen_SelectGender(oHero, GENDER_MALE);
            Chargen_SelectRace(oHero, RACE_HUMAN);
            Chargen_SelectCoreclass(oHero, class_WARRIOR);
            Chargen_SelectBackground(oHero, BACKGROUND_NOBLE);

            // give the player some equipment
            EquipItem(oHero, UT_AddItemToInventory(R"gen_im_arm_cht_lgt_rlr.uti"));
            EquipItem(oHero, UT_AddItemToInventory(R"gen_im_arm_bot_lgt_rlr.uti"));
            EquipItem(oHero, UT_AddItemToInventory(R"gen_im_arm_glv_lgt_rlr.uti"));
            EquipItem(oHero, UT_AddItemToInventory(R"gen_im_arm_shd_sml_wdn.uti"));
            EquipItem(oHero, UT_AddItemToInventory(R"gen_im_wep_mel_lsw_lsw.uti"));

            // autolevel
            RewardXP(oHero, RW_GetXPNeededForLevel(10), FALSE, FALSE);
            SetAutoLevelUp(oHero, FORCE_AUTOLEVEL);

            break;
        }
    }

    // if this event wasn't handled by this script fall through to the core script
    if(!nEventHandled)
    {
        HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);
    }
}

I'd just create a character in character creation and use that one if it was possible (just save and load it between testing), but it doesn't seem like areas update (placeables etc) if you are playing with a save from an older area.are-version. Levels do though, but that makes sense.

Modifié par dewkl, 29 mars 2010 - 06:53 .


#4
Proleric

Proleric
  • Members
  • 2 346 messages
You could try unchecking Tutorials on the in-game Options screen. At first glance, I can't see anything wrong with your script.

#5
Guest_dewkl_*

Guest_dewkl_*
  • Guests
Seems it was that easy. It solved everything and for some strange reason the background music disappeared (as it should). Thanks.

Now I just have to find out how to set a talent/skill build the character loads with. Make a custom autolevel set or make a script that distributes the skills (if that is even possible without getting into too much)?

Modifié par dewkl, 29 mars 2010 - 07:46 .


#6
Pompeii69

Pompeii69
  • Members
  • 153 messages
I know it's bad form to necro a post, but this one is so pertinent. I've used a startup screipt from the wiki to either generate or import a character, which works. But I'm also trying to give him a staff, which is not working. ANy pointers for me?

#include "events_h"
#include "global_objects_h"
#include "sys_chargen_h"
#include "utility_h"

void main()
{
// keep track of whether the event has been handled
int nEventHandled = FALSE;
int nImportHero = TRUE;

event ev = GetCurrentEvent();
switch(GetEventType(ev))
{
case EVENT_TYPE_MODULE_START:
{
// preloads resources needed for character generation
PreloadCharGen();

object oHero = GetHero();

// initiates character generation
StartCharGen(oHero, 0, nImportHero);
EquipItem(oHero, UT_AddItemToInventory(R"gen_im_wep_mag_sta_mgc.uti"));

break;
}
}

// if this event wasn't handled by this script fall through to the core script
if(!nEventHandled)
{
HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);
}
}

#7
Proleric

Proleric
  • Members
  • 2 346 messages
The StartCharGen command triggers a new event (CHARGEN_START) which occurs after your script finishes.

Your script probably equips the character, but then CharGen replaces the inventory.

My solution is to place a one-shot trigger around the start waypoint which equips the player. This works because the trigger entry event happens after module load and character generation.

I imagine you can also do this in EVENT_TYPE_CHARGEN_END, checking for CHARGEN_MODE_CREATE to ensure that it doesn't happen on every level up.

With 20:20 hindsight, I wish Bioware had given self-documenting names to functions which wrap event triggers (e.g. EventWR_StartCharGen), but we are where we are.