Aller au contenu

Photo

How do I level up the PC after CharGen at EVENT_START_MODULE?


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

#1
PavelNovotny

PavelNovotny
  • Members
  • 344 messages
I have been trying the scripts in the wiki, and the chargen script works fine, but I can't get the level up part to work. I am trying to get the PC to have enough XP to level up to 10 after CharGen.

Whate happens is CharGen launches, you set up the char as a level 1, it puts you in the module, there is a tutorial popu about specializations, but the PC has no exp and is only level 1.

This is the code I was using (from the wiki)

case EVENT_TYPE_MODULE_START:
{
object oHero = GetHero();
 
// [chargen code goes here]
// preloads resources needed for character generation
PreloadCharGen();
 
// initiates character generation
StartCharGen(GetHero(),0);
 
// auto-level the player to level 10
RewardXP(oHero, RW_GetXPNeededForLevel(10), FALSE, FALSE);
SetAutoLevelUp(oHero, FORCE_AUTOLEVEL);
 
break;
I tried changing the RewardXP to TRUE, TRUE but that didn't help.
Also tried removing the SetAutoLevelUp to see if it would just give the XP, but that didn't do anything either?

Anybody have any other suggestions?

Thanks!

#2
Proleric

Proleric
  • Members
  • 2 357 messages
Level up works fine when everything is scripted, so I guess you're hitting a timing problem with manual character generation. You could try moving the level up script to the CHARGEN_END event.

#3
Mengtzu

Mengtzu
  • Members
  • 258 messages

Level up works fine when everything is scripted, so I guess you're hitting a timing problem with manual character generation. You could try moving the level up script to the CHARGEN_END event.


This will work, but you need to put in a flag or something to make sure it only applies that XP once.  CHARGEN_END also fires whenever you finish the levelling up dialogue.  I once hilariously had the main character stripped naked and the inventory emptied on every level-up, good times :whistle:

#4
Proleric

Proleric
  • Members
  • 2 357 messages
Apologies, I now see there is an integer parameter 0 with this event. You need to check that it's set to CHARGEN_MODE_CREATE. Alternatively, other threads have suggested using PRCSCR for things that might be disrupted by character generation.