I am creating a mod that involves a character named Arthan who needs the player's help in clearing some demon-infested woods and taking out a rogue blood mage. If the player accepts the quest, Arthan is added to the party with this script:
#include "utility_h"
void main()
{
object oCompanion =GetObjectByTag("az_arthan",0);
UT_HireFollower(oCompanion,TRUE);
}
This causes problems later, but I don't know how else to make an NPC follow the player. Another solution is preferred; I simply don't have one.
After seeing his foes slain, Arthan offers to join the player as payment for the rendered assistance. If the player agrees, the following script runs (as shown on the Toolset Wiki):
#include "utility_h"
void main() {
object oFollower = GetObjectByTag("az_arthan");
UT_HireFollower(oFollower); //Hires the follower
SetPartyPickerGUIStatus(2);
ShowPartyPickerGUI(); //Shows the Party Picker
}
If the player chooses NOT to hire Arthan, he is removed from the party with this script:
#include "utility_h"
void main()
{
object oCompanion =GetObjectByTag("az_arthan",0);
UT_FireFollower(oCompanion,TRUE);
}
The dialogue and quest seem to work. I've even succeeded in placing Arthan on a custom char_stage (char_stage_arthan1) that places him in party selection with the other companions. However, despite my best efforts to not do anything crazy or stupid, some bizarre bugs have rendered the mod unfit for distribution.
1. With the Arthan mod active, the party selection screen upon leaving Camp reappears after you press Accept. This forces the player to choose his party twice. Very annoying. If the player cancels out of the ensuing map screen, it reappears also, along with an ambient pop-up message saying "You can't use that ability here."
2. If the player chooses to NOT hire Arthan after the quest, the UT_FireFollower script above executes, and Arthan loses his inventory. I suspect this might be due to him officially being a member of the party for quest purposes. When he is removed, his inventory remains with the player. I have no idea how to fix this, other than having him follow in some other way while the quest is active.
3. In an issue related to Arthan being "hired" for the quest, the party selection screen is overloaded. He has to be clicked and removed, but this can be confusing since he doesn't visibly occupy a slot. Again, I think this can be solved by having him follow during the quest without actually joining the party with UT_HireFollower. It's just my ignorance on how this might be done that stands in the way.
4. If the player returns to Camp with Arthan in the party, Arthan will stay with with the player and follow him/her around in the campsite. I don't know how to remove him when the player travels to Camp, nor do I know how to make Arthan stand around in Camp with the other companions.
5. The worst bug is something that completely baffles me. With the Arthan mod active, each spendable point earned during level-ups increases the target attribute by 2 instead of 1. I have never deliberately touched anything in the Toolset related to leveling, attributes, skills, spells or anything like that. Clearly, I've done something cataclysmic to this mod, but I'm at a loss as to what.
Here is the module script, which includes the EVENT_TYPE_MODULE_GETCHARSTAGE and EVENT_TYPE_PARTYMEMBER_ADDED cases.
#include "events_h"
#include "global_objects_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_GETCHARSTAGE:
{
SetPartyPickerStage("char_stage_arthan1", "partypicker");
break;
}
case EVENT_TYPE_PARTYMEMBER_ADDED:
{
object oFollower = GetEventObject(ev, 0);
SetLocalInt(oFollower, CREATURE_REWARD_FLAGS, 0);
AddCommand(oFollower, CommandJumpToLocation(GetLocation(GetHero())));
SetFollowerState(oFollower, FOLLOWER_STATE_ACTIVE);
break;
}
}
if (!nEventHandled) //If this event wasn't handled by this script, let the core script try
{
HandleEvent(ev, RESOURCE_SCRIPT_MODULE_CORE);
}
}
For completeness, here is a quest-related script, but I don't think there's anything wrong with it, and it has nothing to do with hiring/firing Arthan aside from moving the quest along.
#include "events_h"
#include "plt_az_weapons"
#include "wrappers_h"
#include "utility_h"
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
switch(nEventType)
{
case EVENT_TYPE_TEAM_DESTROYED:
{
if(GetEventInteger(ev,0) == 1)
{
WR_SetPlotFlag(PLT_AZ_WEAPONS, ENEMIES_DEAD, TRUE);
}
break;
}
}
HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);
}
I've obviously made a mess of things, and I don't expect any one person to address every single problem I have listed, but I'll be grateful for any help anyone can offer. My main concerns are #1 and #5, as well as finding another way to have Arthan follow prior to being hired.
Thanks for reading this.
Cheers.
Modifié par AlienZombie, 16 mars 2010 - 03:05 .





Retour en haut






