Aller au contenu

Photo

character creation, removeability


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

#1
norrinorri

norrinorri
  • Members
  • 7 messages
 Hey folks.. I'm reaching out here, probably in vain but, it's worth a shot I suppose..

I've got a uni project where we have to do a mod for this game, due in tomorrow and yeah I absolutely suck with all this scripting business. I wanted to create a custom class but gave up on that, now I've just been struggling to get my main character loaded the way I want.. For the record, tried my hand at making a custom spell too, and that just made me sad.

Basically, I want to be able to pick and choose what spells I give him.. I've made him a blood mage because I want access to those spells, but when I run my script it automatically loads him with every other spell under the sun.. I've tried to make use of the removeability() function, but to no avail.

I'll copy my script here and hey, if anyone can point me in the right direction, it would be greatly appreciated, if not then, hmmm, such is life I suppose.. Anyway, whoever you are that was kind enough to at least read and get to this sentence, thank you for your time, and all the best in life. Peace.

**************************************************
#include "events_h"
#include "global_objects_h"
#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_BLOOD_MAGE);
            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"));


            //give him blood magic
            //AddAbility(oHero, 10700, FALSE);
            // level the bastard up.
            RewardXP(oHero, RW_GetXPNeededForLevel(12), FALSE, FALSE);
            SetAutoLevelUp(oHero, FORCE_AUTOLEVEL);

            RemoveAbility(oHero, 13001); // Winter's Grasp
            RemoveAbility(oHero, 11001); // Glyph of paralysis
            break;
        }
    }
    // if this event wasn't handled by this script fall through to the core script
    if(!nEventHandled)
    {
        HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);
    }
}

Modifié par norrinorri, 29 mai 2011 - 06:45 .


#2
norrinorri

norrinorri
  • Members
  • 7 messages
Okay so, I thought you had to be a certain level to use certain spells, but.. is that not the case? Seems like it's not, all the same, through that process of leveling up my character, he's still coming packed with a whole bunch of spells I don't want.. If anyone knows how to avoid that, that'd be great..

Also, I'm sure there's a way to, once you've given an ability to have it automatically equipped in one of those quick slots down the bottom.. I saw it talked about in another post, but then chrome crashed on me, and didn't restore and so, I've lost track of it.. If anyone could point me in the right direction.. Thank you.

#3
Craig Graff

Craig Graff
  • Members
  • 608 messages
 The problem you are running into with RemoveAbility is that the script that actually adds the abilities (in response to RewardXP) is actually running after your script finishes. So you are removing the abilities before they are there.
If you want to remove the abilities reliably you will have to find an event that fires a bit later. I'd suggest something like AREA_LOAD_PRELOADEXIT as a likely bet (or perhaps AREA_LOAD_POSTLOADEXIT if that doesn't work).

Try SetQuickslot  for adding the abilities to the bar.

#4
norrinorri

norrinorri
  • Members
  • 7 messages
Wow, I'm not sure how I'll go with this whole AREA_LOAD_PRELOADEXIT business, but thanks so much for the response. Honestly, very kind of you.. And yeah, SetQuickslot was definitely the function I was after. You're a champion Craig.