Aller au contenu

Photo

How do I hide the import Character option?


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

#1
stuntpope

stuntpope
  • Members
  • 112 messages
I am trying to set up my module to use my own backgrounds instead of the default ones.

I have had some success with this except that that I can't get my backgrounds to use my own strings. See this thread for a discussion on that topic: social.bioware.com/forum/1/topic/8/index/218226.

So anyway I have encountered another problem with this. Because I am using my own backgrounds I don't want someone to be able to load a pregenerated character. In the description of the StartCharGen() function I see that it takes three parameters.

oCreature - The creature to generate
nMode - 0 = char gen, 1 = level up
bImportEnabled - applicable to chargen only, allows importing a hero from an existing save file (in addition to

But I have tried StartCharGen(GetHero(),0,0)) and this does not work; the option is still there.
Selecting the import character option then causes the game to crash, presumably because the pregen characters are not compatible with the changes I have made.

Can someone explain to me how I can remove that option, and why setting the third parameter to 0 does not work?

Modifié par stuntpope, 19 novembre 2009 - 10:07 .


#2
EmsaFallkin

EmsaFallkin
  • Members
  • 74 messages
bImportEnabled is a boolean no? so instead of 0 you should put FALSE I think.

#3
stuntpope

stuntpope
  • Members
  • 112 messages
I tried that, no difference. Since both compile I assume that FALSE = 0 anyway and the two are interchangeable. Although the documentation says it is a bool the intellisense says it is an int. Bool would make more sense though.

#4
Erenz

Erenz
  • Members
  • 29 messages
There is no bool type in the DA script language. TRUE and FALSE are simply 2 int constants, where TRUE is mapped to 1 and FALSE is mapped to 0.

Modifié par Erenz, 19 novembre 2009 - 12:02 .


#5
weriKK

weriKK
  • Members
  • 106 messages
I don't think the DA scripting engine actually has a defined bool type. TRUE/FALSE is most probably just a const int set to 1/0.



Variables designated to be booleans are just integers with a slightly different semantics, referring to a logical state rather than an integer value.



--



I thought the bImportEnabled parameter defined whether the import is from savegames or the default way, from the character generator.

#6
stuntpope

stuntpope
  • Members
  • 112 messages
Ah yes, you are right weriKK. In that case, how do I prevent importing of characters altogether?

#7
weriKK

weriKK
  • Members
  • 106 messages
I 'guess' you could try skipping the StartCharGen() function alltogether?

#8
CID-78

CID-78
  • Members
  • 1 124 messages
there is a import character event. use that to make sure there is no importing and you are basically pressing the same as new character.

#9
EmsaFallkin

EmsaFallkin
  • Members
  • 74 messages
WeriKK@ I've tried that, and I can generate a character with script set race, class and gender, but Name and appearance I haven't been able to set. Tried some variations of SetName to set a name for the character but didn't want to work, Tried LoadFromTemplate but only gave the inventory that the template had.

Edit: Ignore that last one, the function is LoadItemsFromTemplate and was not meant to change appearance. Looking at so many new things that stuff get a bit confusing =]

Modifié par EmsaFallkin, 19 novembre 2009 - 01:23 .


#10
weriKK

weriKK
  • Members
  • 106 messages
You can set name with the SetName() function.

Similarily you can fiddle with appearance through SetAppearanceType(), but I'm not sure to what extent.




#11
EmsaFallkin

EmsaFallkin
  • Members
  • 74 messages
Tried both of those without any luck, couldn't get SetName to work for me, and SetAppearanceType I don't know how to use, it wants AppearanceID which I don't know where that is, I've tried with tags of resource creatures as well as my own created characters without luck.

Edit: nvm again, another try with SetName and it worked :)

This is how my Module_Start script looks atm.

case EVENT_TYPE_MODULE_START:
{
// skip character generation
object oHero = GetHero();
SetName(oHero, "Emsa");
Chargen_InitializeCharacter(oHero);
Chargen_SelectGender(oHero,GENDER_MALE);
Chargen_SelectRace(oHero,RACE_HUMAN);
Chargen_SelectCoreclass(oHero,class_ROGUE);
Chargen_SelectBackground(oHero,BACKGROUND_NOBLE);
LoadItemsFromTemplate(oHero, "main_hero.utc", 1);

break;
}


It does everything it should do now but I still need to figure out the SetAppearanceType. Well, he does start naked with the items in inventory, but shouldn't be to hard to get them equipped through scripting.

Modifié par EmsaFallkin, 19 novembre 2009 - 01:39 .


#12
weriKK

weriKK
  • Members
  • 106 messages
Take a look at _Systems\\sys_chargen.nss and _Systems\\_Includes\\sys_chargen_h.nss if you need examples.


#13
stuntpope

stuntpope
  • Members
  • 112 messages
I'd still like the option of not allowing import at all. Intercepting the event and cancelling it doesn't seem very satisfactory to me. It would make more sense if the option wasn't displayed at all.

#14
SilentCid

SilentCid
  • Members
  • 338 messages
 #include "events_h"
#include "global_objects_h"
#include "sys_chargen_h"
#include "utility_h"

void main()
{
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev); //extract event type from current event
    int nEventHandled = FALSE; //keep track of whether the event has been handled
    switch(nEventType)
    {
        case EVENT_TYPE_MODULE_START:
        {
 
            // skip character generation
            object oHero = GetHero();
            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
            object oItem = UT_AddItemToInventory(R"gen_im_arm_cht_lgt_rlr.uti");
            EquipItem(oHero,oItem);
            oItem = UT_AddItemToInventory(R"gen_im_arm_bot_lgt_rlr.uti");
            EquipItem(oHero,oItem);
            oItem = UT_AddItemToInventory(R"gen_im_arm_glv_lgt_rlr.uti");
            EquipItem(oHero,oItem);
            oItem = UT_AddItemToInventory(R"gen_im_arm_shd_sml_wdn.uti");
            EquipItem(oHero,oItem);
            oItem = UT_AddItemToInventory(R"gen_im_wep_mel_lsw_lsw.uti");
            EquipItem(oHero,oItem);
 
            break;
        }


   if (!nEventHandled) //If this event wasn't handled by this script, let the core script try
          {
        HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);
          }


    }
}

Modifié par SilentCid, 20 novembre 2009 - 02:17 .