Is it possible to make a script that makes a npc move to another module?
Etc "Meet me at the valley of the sith" "Okey". Then he will spawn somewhere in the valley of the sith and how to make the npc dont spawn in the module he was in?
What is the script that makes somebody freeze your party members ? Like Jhuani or Malak?
Is it possible to make a script that makes a npc move to another module?
Etc "Meet me at the valley of the sith" "Okey". Then he will spawn somewhere in the valley of the sith and how to make the npc dont spawn in the module he was in?
You can't move an existing NPC between modules, only party members (and puppets in TSL) are global and able to move between modules. All other creatures are stuck in the area they were created.
You can fake it though by making the NPC leave and be destroyed from the first area and set a global variable that you then check for in the OnModuleLoad event of the second module, or the OnEnter event of the area in the second module, and if set spawn a new instance of the NPC in that area.
The script to make them leave could look like:
void ST_LeaveAreaDestroy(int bRun = FALSE, string sTag = "SW_EXIT", object oNPC = OBJECT_SELF);
// ST: Main function...
void main() {
SetGlobalBoolean("MEET_ME_LATER", TRUE);
ST_LeaveAreaDestroy();
}
// ST: Utility function, move to the specified waypoint and get removed from the game
void ST_LeaveAreaDestroy(int bRun = FALSE, string sTag = "SW_EXIT", object oNPC = OBJECT_SELF) {
object oExit = GetWaypointByTag(sTag);
AssignCommand(oNPC, SetCommandable(TRUE));
AssignCommand(oNPC, ClearAllActions());
AssignCommand(oNPC, ActionForceMoveToObject(oExit, bRun));
AssignCommand(oNPC, ActionDoCommand(SetCommandable(TRUE)));
AssignCommand(oNPC, ActionDoCommand(DestroyObject(oNPC)));
AssignCommand(oNPC, SetCommandable(FALSE) );
}
This script would be run from a dialog by the NPC who should leave. Replace MEET_ME_LATER with the name of a Global Boolean variable that must be added to the globalcat.2da file.
In the OnLoad or OnEnter scripts you then do something like:
void main() {
if (GetGlobalBoolean("MEET_ME_LATER")) {
SetGlobalBoolean("MEET_ME_LATER", FALSE);
vector vPos;
float fAngle;
vPos.x = 0.0; // X-coordinate in world where NPC should appear
vPos.y = 0.0; // Y-coordinate in world where NPC should appear
fAngle = 0.0; // Direction angle (0-360) the NPC should be facing when spawned.
CreateObject(OBJECT_TYPE_CREATURE, "NameOfUTCfile", Location(vPos, fAngle));
}
}
Set the X and Y coordinates where the NPC should appear, along with the direction they should face, as indicated in the script above, and change NameOfUTCfile to the name of the UTC file to spawn the NPC from.
Keep in mind that if the module in question already has an OnModuleLoad or area OnEnter script set you'll need to merge your script with the existing one.
* * *
Alternatively, if this is part of a quest you can use the quest stage to keep track of if the NPC should be spawned instead of using a Global Boolean:
void ST_LeaveAreaDestroy(int bRun = FALSE, string sTag = "SW_EXIT", object oNPC = OBJECT_SELF);
// ST: Main function...
void main() {
AddJournalQuestEntry("MEET_ME_LATER", 10);
ST_LeaveAreaDestroy();
}
// ST: Utility function, move to the specified waypoint and get removed from the game
void ST_LeaveAreaDestroy(int bRun = FALSE, string sTag = "SW_EXIT", object oNPC = OBJECT_SELF) {
object oExit = GetWaypointByTag(sTag);
AssignCommand(oNPC, SetCommandable(TRUE));
AssignCommand(oNPC, ClearAllActions());
AssignCommand(oNPC, ActionForceMoveToObject(oExit, bRun));
AssignCommand(oNPC, ActionDoCommand(SetCommandable(TRUE)));
AssignCommand(oNPC, ActionDoCommand(DestroyObject(oNPC)));
AssignCommand(oNPC, SetCommandable(FALSE) );
}
And the OnEnter/OnModuleLoad script:
void main() {
if (GetJournalEntry("MEET_ME_LATER") == 10) {
AddJournalQuestEntry("MEET_ME_LATER", 20);
vector vPos;
float fAngle;
vPos.x = 0.0; // X-coordinate in world where NPC should appear
vPos.y = 0.0; // Y-coordinate in world where NPC should appear
fAngle = 0.0; // Direction angle (0-360) the NPC should be facing when spawned.
CreateObject(OBJECT_TYPE_CREATURE, "NameOfUTCfile", Location(vPos, fAngle));
}
}
Here MEET_ME_LATER should be set to the name Tag of the quest you are using, and you'd need at least two quest stages specified in global.jrl, like:
Stage 10: Some Random Mook has asked to meet me in the Valley of the Sith. I should make my way there soon.
Stage 20: I've arrived in the Valley of the Sith. I should find the random mook who's waiting for me here...
What is the script that makes somebody freeze your party members ? Like Jhuani or Malak?
You mean like the Fake Stasis plot device they use to force you to duel with someone? A script like this should work:
void ST_Freeze_Hands_Up(object oVictim, float fDur = -1.0);
// ST: Main function...
void main() {
// Plot Device freeze party members (POWER! UNLIMITED POWER!)
ST_Freeze_Hands_Up(GetPartyMemberByIndex(1));
ST_Freeze_Hands_Up(GetPartyMemberByIndex(2));
}
// ST: Utility function, put victim in stasis that is impossible to resist or save against
void ST_Freeze_Hands_Up(object oVictim, float fDur = -1.0) {
effect eFreeze = EffectCutSceneParalyze();
eFreeze = EffectLinkEffects(eFreeze, EffectVisualEffect(VFX_DUR_HOLD));
eFreeze = SetEffectIcon(eFreeze, 15);
ApplyEffectToObject((fDur < 0.0 ? DURATION_TYPE_PERMANENT : DURATION_TYPE_TEMPORARY), eFreeze, oVictim, fDur);
}
This would put your party members in permanent stasis that bypasses immunities and is impossible to resist or save against. To release them you'd use a script like:
void main() {
AssignCommand(GetPartyMemberByIndex(1), ClearAllEffects());
AssignCommand(GetPartyMemberByIndex(2), ClearAllEffects());
}