sekan Posted June 29, 2007 Share Posted June 29, 2007 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? Link to comment Share on other sites More sharing options...
stoffe Posted June 29, 2007 Share Posted June 29, 2007 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); [color=PaleGreen]// ST: Main function...[/color] void main() { SetGlobalBoolean("[color=Yellow]MEET_ME_LATER[/color]", TRUE); ST_LeaveAreaDestroy(); } [color=PaleGreen]// ST: Utility function, move to the specified waypoint and get removed from the game[/color] 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("[color=Yellow]MEET_ME_LATER[/color]")) { SetGlobalBoolean("[color=Yellow]MEET_ME_LATER[/color]", FALSE); vector vPos; float fAngle; vPos.x = 0.0; [color=PaleGreen]// X-coordinate in world where NPC should appear[/color] vPos.y = 0.0; [color=PaleGreen]// Y-coordinate in world where NPC should appear[/color] fAngle = 0.0; [color=PaleGreen]// Direction angle (0-360) the NPC should be facing when spawned.[/color] CreateObject(OBJECT_TYPE_CREATURE, "[color=Red]NameOfUTCfile[/color]", 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); [color=PaleGreen]// ST: Main function...[/color] void main() { AddJournalQuestEntry("[color=Yellow]MEET_ME_LATER[/color]", [color=SkyBlue]10[/color]); ST_LeaveAreaDestroy(); } [color=PaleGreen]// ST: Utility function, move to the specified waypoint and get removed from the game[/color] 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("[color=Yellow]MEET_ME_LATER[/color]") == [color=SkyBlue]10[/color]) { AddJournalQuestEntry("[color=Yellow]MEET_ME_LATER[/color]", [color=Pink]20[/color]); vector vPos; float fAngle; vPos.x = 0.0; [color=PaleGreen]// X-coordinate in world where NPC should appear[/color] vPos.y = 0.0; [color=PaleGreen]// Y-coordinate in world where NPC should appear[/color] fAngle = 0.0; [color=PaleGreen]// Direction angle (0-360) the NPC should be facing when spawned.[/color] CreateObject(OBJECT_TYPE_CREATURE, "[color=Red]NameOfUTCfile[/color]", 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); [color=PaleGreen]// ST: Main function...[/color] void main() { [color=PaleGreen]// Plot Device freeze party members (POWER! UNLIMITED POWER!)[/color] ST_Freeze_Hands_Up(GetPartyMemberByIndex(1)); ST_Freeze_Hands_Up(GetPartyMemberByIndex(2)); } [color=PaleGreen]// ST: Utility function, put victim in stasis that is impossible to resist or save against[/color] 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()); } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.