I'm at a complete loss here I'm trying to make it so when the player dies all the henchmen get removed from his party. I'm running these sripts in the user defined event handle for the module. At this time when the player dies and then respawns the henchmen travel with him. As the player is heading to the nether world it doesn't make much sense that the perfectly well and alive hencman travels with player.
Anyway, I've tried...
case 001:
object oPC = GetLastPlayerDied();
object oHench = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oPC);
RemoveHenchman(GetMaster(oPC), oHench);
break;
and this
case 001:
object oPC = GetLastPlayerDied();
RemoveHenchman(GetMaster(oPC), GetObjectByTag("HENCHTAG"));
break;
Neither work and I'm guessing I have it SOOOO wrong. Any help would be greatly appreciated.
Request - Remove Henchmen on Player Death
Débuté par
Grieyls
, juin 02 2011 08:13
#1
Posté 02 juin 2011 - 08:13
#2
Posté 02 juin 2011 - 11:14
I would use something like this, but I'm also set for max 8 henchmen.
object oPC = GetLastPlayerDied();
object oHench = GetFirstFactionMember (oPC, FALSE);
while (GetIsObjectValid (oHench))
{
if (GetAssociateType(oHench) == ASSOCIATE_TYPE_HENCHMAN && GetMaster(oHench) == oPC)
{
RemoveHenchman (oPC, oHench);
}
oHench = GetNextFactionMember (oPC, FALSE);
}
object oPC = GetLastPlayerDied();
object oHench = GetFirstFactionMember (oPC, FALSE);
while (GetIsObjectValid (oHench))
{
if (GetAssociateType(oHench) == ASSOCIATE_TYPE_HENCHMAN && GetMaster(oHench) == oPC)
{
RemoveHenchman (oPC, oHench);
}
oHench = GetNextFactionMember (oPC, FALSE);
}
Modifié par Failed.Bard, 02 juin 2011 - 11:15 .
#3
Posté 02 juin 2011 - 01:13
Grieyls wrote...
object oPC = GetLastPlayerDied();
RemoveHenchman(GetMaster(oPC), GetObjectByTag("HENCHTAG"));
Question: Who is the Master of the PC? I guess that would be the player!
case 001:
object oPC = GetLastPlayerDied();
object oHench = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oPC);
RemoveHenchman(oPC, oHench);
break;
#4
Posté 05 juin 2011 - 06:52
Failed.Bard, I can't get yours to work... It doesn't seem to do a thing so I'm not sure what is wrong there. Would be great if I could get it to work though as my module has a max of two henchmen so removing them both at once would be handy.
Lightfoot8, thanks for pointing my rather glaring error out.. I feel so silly now. Anyway your suggestion works fine. thing is though only one henchman is removed so still trying to figure out how to remove two of them.
Lightfoot8, thanks for pointing my rather glaring error out.. I feel so silly now. Anyway your suggestion works fine. thing is though only one henchman is removed so still trying to figure out how to remove two of them.
Modifié par Grieyls, 05 juin 2011 - 06:53 .
#5
Posté 05 juin 2011 - 07:51
I'd just compiled it to make sure there weren't any logic errors, and it looked right. I'm not actually sure why it doesn't work either, but now I'll have to play around with it for my own benefit to see what I did wrong.
In testing, adding a while loop to your initial (master fixed) script worked for me for multiple henchmen, though I didn't try it from within a case statement.
object oPC = GetLastPlayerDied();
object oHench = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oPC);
while (GetIsObjectValid (oHench))
{
RemoveHenchman (oPC, oHench);
oHench = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oPC);
}
Edit:
I figured out what was wrong with mine. A silly mistake on my part, really. Trying to remove the henchmen while it's still going through them doesn't work. Adding a delay to the remove henchman part worked for me.
In testing, adding a while loop to your initial (master fixed) script worked for me for multiple henchmen, though I didn't try it from within a case statement.
object oPC = GetLastPlayerDied();
object oHench = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oPC);
while (GetIsObjectValid (oHench))
{
RemoveHenchman (oPC, oHench);
oHench = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oPC);
}
Edit:
I figured out what was wrong with mine. A silly mistake on my part, really. Trying to remove the henchmen while it's still going through them doesn't work. Adding a delay to the remove henchman part worked for me.
Modifié par Failed.Bard, 05 juin 2011 - 08:13 .
#6
Posté 05 juin 2011 - 09:29
That did the trick Failed.Bard... Thank you so much
Modifié par Grieyls, 05 juin 2011 - 09:29 .





Retour en haut






