Aller au contenu

Photo

A fixed player character?


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

#1
0x30A88

0x30A88
  • Members
  • 1 081 messages
I know that we can't change headmorphs by script, but I was wondering whether this approach works and how exactly to do it.

What if I add a follower and put it in the active party, and remove the Jaden. Then makes another character the party leader (i.e. what happens in the Redcliffe Fade part). The latter I know it's possible to do, but I can't find the way to do it -- I have looked page up and page down after the thread where someone got answers about setting the party leader.

Will this work, given the party is fixed and the partypicker is disable troughout? And will the set leader be returned when GetHero() is called, as well as be the PLAYER in the dialogues?

EDIT: Tried something myself, this is a spawn script. "..._ext_h" is just a rename of the long script in the advanced follower tutorial. Problem is, I can't get the Jaden to dissappear and nothing happens when I hit the levelup-button (+ beside portrait).
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "hirefollower_ext_h"

void main()
{
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    string sDebug;
    object oPC = GetHero();
    object oParty = GetParty(oPC);
    int nEventHandled = FALSE;

    switch(nEventType)
    {
        case EVENT_TYPE_SPAWN:
        {
            object oHero = GetHero();
            object oFollower = GetObjectByTag("gis_pl_1");
            hireCustomFollower(oFollower, class_WIZARD, "", 0, 0, 49310, TRUE, FOLLOWER_STATE_ACTIVE, "", 0, 0, FALSE, 3, 0);
            SetPartyLeader(oFollower);
            SetFollowerState(oPC, FOLLOWER_STATE_UNAVAILABLE);
            break;
        }
    }
    HandleEvent(ev, RESOURCE_SCRIPT_CREATURE_CORE);
}

Modifié par Gisle Aune, 09 mai 2011 - 06:51 .


#2
jackkel dragon

jackkel dragon
  • Members
  • 2 047 messages
I'm not sure if your method would work or not (I've tried other scripting methods, but not this one.) However, if you use a follower as the party leader the "Jaden" character will still be used for save game storage and merchant panels.

The way that seems to work (without the problems above) best requires a bit of work:
- Make a duplicate of the "default_player.utc" and name it whatever you need it to be for now.
- You can add facemorph, soundset, inventory, etc. here.
- When you are done (you have to do these next few steps every time you make a change to the character) export the .utc.
- Rename the file to "default_player.utc" and place it in the addins/<modulename>/module/override folder.
- Open up the exported .utc file in the toolset with ctrl-o (NOT the resource) and change the resref to "default_player" and make sure the tag is "player".
- On the module start script, set up the starting level, xp, gold, and class (class doesn't seem to work from the .utc). If you don't want the game to show a blank "background" you can also set the background/origin through script.

Let me know if I didn't make sense or skipped something!

#3
Challseus

Challseus
  • Members
  • 1 032 messages
So, I can't comment on what you're doing (except that you should call GetPartyLeader() instead of GetHero() in order to get the top person in the party), but I can tell you what I use in my mod, with no issues:

1) I create my PC as a normal creature in the toolset, custom headmorph and all. For this example's purposes, we'll just call them hero.utc.

2) In my custom module_core script, I have something like the following:

//skip character generation

//PreloadCharGen(); //preloads resources needed for character generation
//StartCharGen(GetHero(),0); //initiates 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);

3) Once I export all resources, I find hero.utc, which would be in the module toolsetexport directory. Then, I copy it to the module override directory, and rename it to default_player.utc (which is how the game references Jaden).

---------------------------------------------------------------------

I've had it like this for well over a year, have sent out b2b packages for people to test, and they have not had any issues either.

Anyway, just my way, sorry I can't comment on yours.

#4
jackkel dragon

jackkel dragon
  • Members
  • 2 047 messages
^ Thanks for showing the proper script Challseus, I couldn't find mine but it was more or less the same.

Important note: Make sure there isn't a "default_player.utc" in the core/override of any module or package, because that overrides ALL modules with a custom pregenerated PC. I learned this the hard way. >_<

#5
0x30A88

0x30A88
  • Members
  • 1 081 messages
Thank you, sadly I won't be able to test anything before the weekend. My laptop is broken and I leave tomorrow morning and won't return to a PC able to do anything more than schoolwork and internet browsing untill friday.

Modifié par Gisle Aune, 09 mai 2011 - 09:19 .


#6
Challseus

Challseus
  • Members
  • 1 032 messages
@ jackkel dragon

Wow, didn't realize I essentially duplicated what you posted... Must have been within minutes of each other.

#7
0x30A88

0x30A88
  • Members
  • 1 081 messages
I spent time I really didn't have this morning and it works. I had to change the tag and strref thing though, as Jakkal suggested.

Thank you.

#8
0x30A88

0x30A88
  • Members
  • 1 081 messages
How can I get it to auto level-up according to a ALTable and then turning it off as soon as the first level up have happened?

I tried to get auto-level-up working at least by setting it true before rewarding the 1XP from lvl0 to 1 and false in the before the case breaks. However, it did not work.

#9
jackkel dragon

jackkel dragon
  • Members
  • 2 047 messages
I'm not sure how the autolevel thing works in this case. You may have to manually autolevel through scripting.

I forget the names of the variables, but there are specific variables for talent points, skill points, etc. You can set all of these to "0" and add points directly to the attributes you want. I'll see if I can get some relevant code...

Edit:

#include "sys_chargen_h"


You'll need to include this file in your module script to use some of these functions.

Chargen_SpendAttributePoints(oChar,PROPERTY_ATTRIBUTE_STRENGTH, 2,FALSE);


This doesn't actually spend the points, but it does increase the attribute.

_AddAbility(GetHero(), ABILITY_TALENT_SHIELD_BASH);


Skills, talents, and spells can be added this way. There is also a function to remove them.

SetCreatureProperty(oChar,PROPERTY_SIMPLE_ATTRIBUTE_POINTS,  5.0, PROPERTY_VALUE_BASE);


Use this funcation AFTER calling the "Chargen_InitializeCharacter()" function. The above is straight from that function, where it sets five spendable points for attributes. Set them to zero instead. There are also the properties "PROPERTY_SIMPLE_SKILL_POINTS" and "PROPERTY_SIMPLE_TALENT_POINTS" to set to zero.

----------------

I think that's it, but I can't be sure.

Modifié par jackkel dragon, 14 mai 2011 - 12:47 .


#10
Proleric

Proleric
  • Members
  • 2 346 messages
If I've understood the question correctly, what I have for the initial level up in EVENT_TYPE_MODULE_START is

object oHero = GetHero();
int nTargetLevel = 1;

RewardXP(oHero, RW_GetXPNeededForLevel(nTargetLevel), FALSE, FALSE);
SetAutoLevelUp(oHero, FORCE_AUTOLEVEL);

The constant definition is

const int FORCE_AUTOLEVEL = 2;

I haven't tried reverting to manual subsequently. In theory, the syntax is

object oHero = GetHero();
int nTargetLevel = 1;

RewardXP(oHero, RW_GetXPNeededForLevel(nTargetLevel), FALSE, FALSE);
SetAutoLevelUp(oHero, FORCE_AUTOLEVEL);
SetAutoLevelUp(oHero, 0);


If that doesn't work, I'd try delaying the final statement (either by using DelayEvent or by intercepting EVENT_TYPE_PLAYER_LEVELUP in the player script).

#11
0x30A88

0x30A88
  • Members
  • 1 081 messages
jackkel dragon, I did what you said and the skills and attributes are added properly. However, the (+) in the portrait still persists, even though the level-up button inside where the C-key brings you is grayed out. Clicking on the (+) does absolutely nothing.

This is the code inside the EVENT_TYPE_MODULE_START event in module_core, it executes.

object oHero = GetHero();
           
            Chargen_InitializeCharacter(oHero);
            Chargen_SelectGender(oHero, GENDER_FEMALE);
            Chargen_SelectRace(oHero, RACE_ELF);
            Chargen_SelectCoreclass(oHero, class_WIZARD);
            RewardMoney(0,50,3);
            RewardXP(oHero, 1, FALSE, FALSE);
            
            //Nullify character's points.
            SetCreatureProperty(oHero, PROPERTY_SIMPLE_ATTRIBUTE_POINTS, 0.0, PROPERTY_VALUE_BASE);  
            SetCreatureProperty(oHero, PROPERTY_SIMPLE_SKILL_POINTS, 0.0, PROPERTY_VALUE_BASE);  
            SetCreatureProperty(oHero, PROPERTY_SIMPLE_TALENT_POINTS, 0.0, PROPERTY_VALUE_BASE);  
            
            //Choose talents
            _AddAbility(oHero, ABILITY_SPELL_ARCANE_BOLT); 
            _AddAbility(oHero, ABILITY_SPELL_FLAME_BLAST);
            _AddAbility(oHero, ABILITY_SPELL_DRAIN_LIFE);
            
            Chargen_SpendAttributePoints(oHero,PROPERTY_ATTRIBUTE_MAGIC, 2,FALSE); 
            Chargen_SpendAttributePoints(oHero,PROPERTY_ATTRIBUTE_WILLPOWER, 1,FALSE); 
            Chargen_SpendAttributePoints(oHero,PROPERTY_ATTRIBUTE_CONSTITUTION, 2,FALSE); 

Edit: I thought it solved but it wasn't it seems.

Modifié par Gisle Aune, 14 mai 2011 - 06:42 .


#12
0x30A88

0x30A88
  • Members
  • 1 081 messages
I feel that my question here has been forgotten as I earlier claimed it solved. Can anyone please help?

#13
jackkel dragon

jackkel dragon
  • Members
  • 2 047 messages
I'm not sure, but you can try this to remove the + sign:

SetCanLevelUp(GetHero(), 0);


It claims it only sets whether the character shows a levelup on the GUI, but I'm not sure as I haven't tested it much.

#14
0x30A88

0x30A88
  • Members
  • 1 081 messages

jackkel dragon wrote...

I'm not sure, but you can try this to remove the + sign:

SetCanLevelUp(GetHero(), 0);

It claims it only sets whether the character shows a levelup on the GUI, but I'm not sure as I haven't tested it much.

Thank you, setting it to 0, then back to 1 after giving the atributes and skills fixed it.