I have this script:
void ST_GoAway(float x, float y, int bRunAway=TRUE);
void main() {
if (!GetLocalBoolean(OBJECT_SELF, 38) && (GetEnteringObject() == GetFirstPC())) {
SetLocalBoolean(OBJECT_SELF, 38, TRUE);
DestroyObject(GetObjectByTag("plc_elevbtn"));
DestroyObject(GetObjectByTag("Jawa01"));
RemoveAvailableNPC(6);
AddAvailableNPCByTemplate(6, "p_kreia");
SetNPCSelectability(6, FALSE);
AssignCommand(GetObjectByTag("Ex-partymember tag"), ST_GoAway(25.00, 60.47));
}
}
void ST_GoAway(float x, float y, int bRunAway=TRUE) {
location lExit=Location(Vector(x, y, 0.0), 0.0);
SetCommandable(TRUE);
ClearAllActions();
ActionForceMoveToLocation(lExit, bRunAway);
ActionDoCommand(DestroyObject(OBJECT_SELF));
SetCommandable(FALSE);
}
What I want to happen is for my temporary party member(replacing kreia) to leave the party, run to a point, and fadeaway, and return kreia to the party selection gui.
The run and disappear part of the script I got from the tutorials/scripting section.
Everything seems to work fine, the ex-party member runs away, kreia appears again on the party selection gui, but the ex-party member does not fade-away as he is supposed to. Can't figure out why.
Try changing this line ActionDoCommand(DestroyObject(OBJECT_SELF)); to ActionDoCommand(DestroyObject(GetObjectByTag("Ex-partymember tag")));
and see if that works.
DS, it didn't work. Is it the logic of the script or is it because the npc was a party member and can't be destroyed. I don't know.
What about the RemoveFromParty() command? Do I need to add that in the party section of the script?
Try this ,you may want to add a "DelayCommand" to sub1();
void sub1();
void sub1() {
object oTemp = GetObjectByTag("Ex-partymember tag");
float x=25.00f;
float y=60.47f;
float z=0.0f;
int bRun=TRUE;
vector myvec = Vector(x,y,z);
location myexit = Location(myvec,0.0f);
ClearAllActions();
ActionDoCommand(SetCommandable(TRUE,oTemp));
AssignCommand (oTemp,ActionForceMoveToLocation(myexit,bRun));
AssignCommand (oTemp,ActionDoCommand(DestroyObject(oTemp)));
ActionDoCommand(SetCommandable(FALSE,oTemp));
}
void main() {
if (!GetLocalBoolean(OBJECT_SELF, 38) && (GetEnteringObject() == GetFirstPC())) {
SetLocalBoolean(OBJECT_SELF, 38, TRUE);
DestroyObject(GetObjectByTag("plc_elevbtn"));
DestroyObject(GetObjectByTag("Jawa01"));
RemoveAvailableNPC(6);
AddAvailableNPCByTemplate(6, "p_kreia");
SetNPCSelectability(6, FALSE);
sub1();
}
}
I'll give it a try.......
EDIT: Didn't work...the npc didn't move, nor did the part selection gui change....
you did change "Ex-partymember tag" to match the npc tag correct? also did you try
DelayCommand(0.5, sub1());
Are you running this script off of a dialog? if you are it may be better to make it two seprate scripts.
I changed the tag.
I'll try the delay.
Yes, it is coming out of a dialog. Maybe I'll try to break it up then
EDIT:
got it to work. Broke it up to three scripts just to be sure. Used the generic, a_leaveparty, to remove party member, then script to reinstate kreia, and then run script from tutorials. Thanks for help.