Aller au contenu

Photo

hired follower doesn´t gain xp (solved)


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

#1
Cador

Cador
  • Members
  • 52 messages
hi,
here is my easy script to add a follower

  object oFollower = GetObjectByTag("creature_tag");

  UT_HireFollower(oFollower,FALSE);  

  SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0);


so i set   bPreventLevelUp to FALSE
and i clear the CREATURE_REAWARD_FLAGS flag.

still my follower doesn´t gain xp.
what am i doing wrong?

edit:
hmm, clearing the CREATURE_REWARD_FLAGS in a separate script seems to work....
anyone knows why?

Modifié par Cador, 22 décembre 2009 - 05:55 .


#2
Magic

Magic
  • Members
  • 187 messages
In addition to hiring the follower, UT_HireFollower() sets the creature's event script to "player_core.nss" and sends an event of EVENT_TYPE_PARTY_MEMBER_HIRED to the follower. This event is processed after your current script, and there CREATURE_REWARD_FLAGS is set to TRUE again. As you did, you need to clear this flag after this event has been handled. Unfortunately at the moment, the second parameter for UT_HireFollower() does nothing, since it is always overwritten with TRUE. A similar thread and a wiki update has been made but this problem will be encountered often, I guess.

By the way, your separate script is also a good place to set a custom event script for the follower.

Edit: Oh wait, the custom event script can be set directly after UT_HireFollower(). It shouldn't prevent EVENT_TYPE_PARTY_MEMBER_HIRED from reaching player_core.nss though (alternatively the event can be handled in the custom script).

Modifié par Magic, 26 décembre 2009 - 10:55 .


#3
Xaltar81

Xaltar81
  • Members
  • 191 messages
I keep seeing reference to how to fix this but no actual example scripts. I have no scripting experience at all so could someone please help me out. I have figured out how to do a lot in the last few days, including writing my own join script combined with my plot script but this keeps evading me. So far I understand that I need to clear the flags in a separate script, which I have made as a new plot script as follows



#include "log_h"

#include "utility_h"

#include "wrappers_h"

#include "plot_h"



#include "plt_fun_party"



#include "fun_consts_h"



// Space for easy reading



int StartingConditional()

{

event eParms = GetCurrentEvent();

int nType = GetEventType(eParms);

string strPlot = GetEventString(eParms, 0);

int nFlag = GetEventInteger(eParms, 1);

object oParty = GetEventCreator(eParms);

object oConversationOwner = GetEventObject(eParms, 0);

int nResult = FALSE;

object oPC = GetHero();



plot_GlobalPlotHandler(eParms);



if(nType == EVENT_TYPE_SET_PLOT)

{

int nValue = GetEventInteger(eParms, 2);

int nOldValue = GetEventInteger(eParms, 3);

switch(nFlag)

{

case PARTY_JOINED:

{

object oFollower = GetObjectByTag("FUN_LYNDRA");

WR_SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE, TRUE, 0, FALSE);

SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0);

}

{

object oFollower = GetObjectByTag("FUN_SELENE");

WR_SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE, TRUE, 0, FALSE);

SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0);

}

break;

}

}

plot_OutputDefinedFlag(eParms, nResult);



return nResult;

}



It compiles but does not allow XP gain. I know its probably totally wrong but as I said, I am no scripter hehe. It would be great if someone could help out with a sample of how set the params and clear the CREATURE_REWARD_FLAGS.



Sorry about the n00b question :P