Hello all,
I am looking for some help to clean up some of the scripts In my mod. they all work, but what I’m looking for here is to combine these three scripts into one so its a bit less messy and more optimizes.
Please contact me if you are interested in helping out. I’m going to be releasing a new version of the mod soon on Steam, and would really like to get these cleaned up. I’m also looking for some help with making an end scene cut scene that we never got into the mod.
Thanks everyone, contact me through my gmail account please if you are interested. rickfranx@gmail.com
Script One
This one spawns in Dran and spawns in the walls that traps the player, would like to get these all combined into one script if possible. What this does is Dran spawns in from the script. this is part of a 3 part scripts that get triggered by the player walking into the area setting off the triggers. there are three triggers here. Honestly, it might be easier if someone who wants to help out just contacts me so we can go over it and let you play this area to see how this all unfolds.
/*
Scene where Dran spawns in Trapping the party.
*/
void main()
{
object oPC = GetEnteringObject();
if(!GetIsPC(oPC))
return;
if(GetLocalInt(GetModule(), "ApparitionMeetings"))
return;
//CreateObject(OBJECT_TYPE_CREATURE, "apparition", lApparition1Here, TRUE);
object oApparition = GetNearestObjectByTag("DranHere_cs9");
//effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
location lAppear = GetLocation(GetWaypointByTag("DranHere_cs9"));
//ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, lAppear);
object oApperition = CreateObject(OBJECT_TYPE_CREATURE, "Dran_at3_cs", lAppear);
SetPlotFlag(oApperition, TRUE);
AssignCommand(oApperition, ClearAllActions());
AddJournalQuestEntry("Dran", 40, oPC);
DelayCommand(0.1,ExecuteScript("at4_cwall_spwn", OBJECT_SELF));
DestroyObject(OBJECT_SELF, 0.2);
}
Script Two.
this script kicking off the cut Scene. Dran pretty much chastises the party and belittles them, then after the scene is over the pit trap is spawned in, the player has no choice but to walk over the pit because you are trapped in the Glass walls.
#include "x2_inc_cutscene"
#include "limbohenchmen"
//Scene where Dran talks to the trapped party.
void main()
{
//only trigger for players entering
object oPC = GetEnteringObject();
if(!GetIsPC(oPC))
return;
oPC = GetFirstPC();
//Check to see if this has been activated before
int iCScheck = GetLocalInt(OBJECT_SELF,"iCScheck");
if(iCScheck)
return; //quit out if it has been
//otherwise set that it has and continue
SetLocalInt(OBJECT_SELF,"iCScheck",1);
location lWP01 = GetLocation(GetWaypointByTag("OA_CS9_01"));
location lWP02 = GetLocation(GetWaypointByTag("OA_CS9_02"));
object oNPC = GetObjectByTag("Dran_at3_cs");
//loop through the pc's party members
while (oPC != OBJECT_INVALID)
{
SetCutsceneMode(oPC,TRUE);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectCutsceneGhost(),oPC,49.0);
DelayCommand(5.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY),oPC,49.0));
//PC Cam controls
FadeToBlack(oPC,FADE_SPEED_MEDIUM);
DelayCommand(5.0,CutSetCamera(0.0,oPC,CAMERA_MODE_CHASE_CAMERA,270.0,5.0,120.0,CAMERA_TRANSITION_TYPE_SNAP));
DelayCommand(43.0,CutSetCamera(0.0,oPC,CAMERA_MODE_CHASE_CAMERA,240.0,0.0,90.0,CAMERA_TRANSITION_TYPE_SLOW));
DelayCommand(4.3,AssignCommand(oPC,JumpToLocation(lWP01)));
DelayCommand(5.2,FadeFromBlack(oPC,FADE_SPEED_MEDIUM));
DelayCommand(47.5,FadeToBlack(oPC,FADE_SPEED_MEDIUM));
DelayCommand(54.0,FadeFromBlack(oPC,FADE_SPEED_MEDIUM));
DelayCommand(51.5,AssignCommand(oPC,JumpToLocation(lWP02)));
DelayCommand(49.5,SetCutsceneMode(oPC,FALSE));
location lLimbo = GetLocation(GetWaypointByTag("OA_CS9_LIMBO10S"));
LimboHenchmen(oPC, lLimbo, lWP02, 4.3, 51.6);
//oPC = GetNextFactionMember(oPC,TRUE); // Need this line for MP games so everyone sees the Cut Scene
oPC = GetNextPC(); // Need this line for MP games so everyone sees the Cut Scene
}
//npc commands
DelayCommand(6.5,AssignCommand(oNPC, ActionPlayAnimation(ANIMATION_LOOPING_TALK_NORMAL,1.0,3.0)));
DelayCommand(6.0,AssignCommand(oNPC,ActionSpeakString("You must be proud to have made it so far.")));
DelayCommand(10.5,AssignCommand(oNPC,ActionSpeakString("It's a shame that it has come to this. Look at you now.")));
DelayCommand(16.5,AssignCommand(oNPC, ActionPlayAnimation(ANIMATION_LOOPING_TALK_NORMAL,2.0,6.0)));
DelayCommand(16.0,AssignCommand(oNPC,ActionSpeakString("Trapped behind a transparent wall, on display for all the world to see, like an insect in a jar.")));
DelayCommand(25.1,AssignCommand(oNPC, ActionPlayAnimation(ANIMATION_LOOPING_TALK_LAUGHING,2.0,3.0)));
DelayCommand(25.5,AssignCommand(oNPC,ActionSpeakString("How humiliating.")));
//DelayCommand(23.5,SoundObjectPlay(UnlockedSound));
DelayCommand(28.0,AssignCommand(oNPC, ActionPlayAnimation(ANIMATION_LOOPING_TALK_NORMAL,2.0,3.0)));
DelayCommand(28.5,AssignCommand(oNPC,ActionSpeakString("I have treated you fairly and you have been barbaric in return.")));
DelayCommand(33.5,AssignCommand(oNPC, ActionPlayAnimation(ANIMATION_LOOPING_TALK_NORMAL,1.0,5.0)));
DelayCommand(33.8,AssignCommand(oNPC,ActionSpeakString("Have you no manners?")));
DelayCommand(37.0,AssignCommand(oNPC,ActionSpeakString("Now, what would you do if the situation was reversed.")));
DelayCommand(43.0,AssignCommand(oNPC,ActionSpeakString("Yes... yes. You must be punished... to the Highest Order you GO!")));
DelayCommand(43.5,AssignCommand(oNPC, ActionPlayAnimation(ANIMATION_LOOPING_TALK_LAUGHING,1.0,5.0)));
DelayCommand(50.0,AssignCommand(oNPC, ClearAllActions(TRUE)));
//DelayCommand(69.1,AssignCommand(oNPC, ClearAllActions(TRUE)));
DestroyObject(oNPC, 49.0 );
DelayCommand(52.5,ExecuteScript("at4_dranpit_42a", OBJECT_SELF));
DelayCommand(57.0,DestroyObject(OBJECT_SELF));
}
Script Three
This one after Dran threats you activates the pit and script trigger that drops the players through to the next level the Frost Giant Level. Pretty straight forward, this one after the scene is over activates the pit trigger. played walks over it and is dropped down to the Frost Giants.
/*
Level: Frost Giants
Takes care of the Pit trap for Frost Giants level.
*/
object oEnteree = GetEnteringObject();
object oPit_Lever_1 = GetNearestObjectByTag("Pit_Lever_42A");
location lFellDownPit = GetLocation(GetObjectByTag("FG_WP_1"));
object oPC = oEnteree;
object oHenchman = GetHenchman (oPC);
object oAssociate = GetAssociate (ASSOCIATE_TYPE_FAMILIAR, oPC);
object oSummoned = GetAssociate (ASSOCIATE_TYPE_SUMMONED, oPC);
object oAnimal = GetAssociate (ASSOCIATE_TYPE_ANIMALCOMPANION, oPC);
object oDominated = GetAssociate (ASSOCIATE_TYPE_DOMINATED, oPC);
void ApplyFallingDamage()
{
ApplyEffectToObject(1,EffectDamage(10, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_NORMAL),oDominated,0.0);
ApplyEffectToObject(1,EffectKnockdown(),oDominated,5.0);
FloatingTextStringOnCreature("Takes 10 falling damage", oDominated, FALSE);
ApplyEffectToObject(1,EffectDamage(10, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_NORMAL),oHenchman,0.0);
ApplyEffectToObject(1,EffectKnockdown(),oHenchman,5.0);
FloatingTextStringOnCreature("Takes 10 falling damage", oHenchman, FALSE);
ApplyEffectToObject(1,EffectDamage(10, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_NORMAL),oAnimal,0.0);
ApplyEffectToObject(1,EffectKnockdown(),oAnimal,5.0);
FloatingTextStringOnCreature("Takes 10 falling damage", oAnimal, FALSE);
ApplyEffectToObject(1,EffectDamage(10, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_NORMAL),oAssociate,0.0);
ApplyEffectToObject(1,EffectKnockdown(),oAssociate,5.0);
FloatingTextStringOnCreature("Takes 10 falling damage", oAssociate, FALSE);
ApplyEffectToObject(1,EffectDamage(10, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_NORMAL),oSummoned,0.0);
ApplyEffectToObject(1,EffectKnockdown(),oSummoned,5.0);
FloatingTextStringOnCreature("Takes 10 falling damage", oSummoned, FALSE);
ApplyEffectToObject(1,EffectDamage(10, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_NORMAL),oEnteree,0.0);
ApplyEffectToObject(1,EffectKnockdown(),oEnteree,5.0);
FloatingTextStringOnCreature("Takes 10 falling damage", oEnteree, FALSE);
}
void main()
{
object oPit = GetNearestObjectByTag("pit_42a");
if (GetIsPC(oEnteree) && GetIsObjectValid(oPit))
//if (GetIsPC(oEnteree) && GetLocalInt(oPit_Lever_1,"DisabledPit_42A")==1)
{
AssignCommand (oDominated, JumpToLocation (lFellDownPit));
AssignCommand (oHenchman, JumpToLocation (lFellDownPit));
AssignCommand (oAnimal, JumpToLocation (lFellDownPit));
AssignCommand (oAssociate, JumpToLocation (lFellDownPit));
AssignCommand (oSummoned, JumpToLocation (lFellDownPit));
AssignCommand (oEnteree, JumpToLocation (lFellDownPit));
DelayCommand(1.0, ApplyFallingDamage());
}
}
Sorry, here is the 4th script dealing with the Henchmen and other players that go into a cut scene and they are placed in limbo.
// LimboHenchmen helper function
// - oPC :The player whose associates are to be limboed
// - lLimbo :The location of limbo
// - lReturn :The location the henchmen will be teleported to after being in limbo
// - fExitTime :The delay until the henchmen are teleported to limbo
// - fReturnTime :The delay until the henchmen are teleported to the return location
void LimboHenchmen(object oPC, location lLimbo, location lReturn, float fExitTime, float fReturnTime);
void LimboHenchmen(object oPC, location lLimbo, location lReturn, float fExitTime, float fReturnTime)
{
int i=1;
object oHenchman = GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oPC,i);
while (oHenchman != OBJECT_INVALID)
{
DelayCommand(fExitTime,AssignCommand(oHenchman, JumpToLocation(lLimbo)));
DelayCommand(fReturnTime,AssignCommand(oHenchman, JumpToLocation(lReturn)));
i++;
oHenchman = GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oPC,i);
}
object oDominated = GetAssociate(ASSOCIATE_TYPE_DOMINATED,oPC);
object oFamiliar = GetAssociate(ASSOCIATE_TYPE_FAMILIAR,oPC);
object oCompanion = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION,oPC);
object oSummoned = GetAssociate(ASSOCIATE_TYPE_SUMMONED,oPC);
if (oDominated != OBJECT_INVALID)
{
DelayCommand(fExitTime,AssignCommand(oDominated, JumpToLocation(lLimbo)));
DelayCommand(fReturnTime,AssignCommand(oDominated, JumpToLocation(lReturn)));
}
if (oFamiliar != OBJECT_INVALID)
{
DelayCommand(fExitTime,AssignCommand(oFamiliar, JumpToLocation(lLimbo)));
DelayCommand(fReturnTime,AssignCommand(oFamiliar, JumpToLocation(lReturn)));
}
if (oCompanion != OBJECT_INVALID)
{
DelayCommand(fExitTime,AssignCommand(oCompanion, JumpToLocation(lLimbo)));
DelayCommand(fReturnTime,AssignCommand(oCompanion, JumpToLocation(lReturn)));
}
if (oSummoned != OBJECT_INVALID)
{
DelayCommand(fExitTime,AssignCommand(oSummoned, JumpToLocation(lLimbo)));
DelayCommand(fReturnTime,AssignCommand(oSummoned, JumpToLocation(lReturn)));
}
}
void DestroyHenchmen(object oPC)
{
int i=1;
object oHenchman = GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oPC,i);
while (oHenchman != OBJECT_INVALID)
{
AssignCommand(oHenchman,ClearAllActions(TRUE));
AssignCommand(oHenchman,SetIsDestroyable(TRUE));
DestroyObject(oHenchman);
i++;
oHenchman = GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oPC,i);
}
object oDominated = GetAssociate(ASSOCIATE_TYPE_DOMINATED,oPC);
object oFamiliar = GetAssociate(ASSOCIATE_TYPE_FAMILIAR,oPC);
object oCompanion = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION,oPC);
object oSummoned = GetAssociate(ASSOCIATE_TYPE_SUMMONED,oPC);
if (oDominated != OBJECT_INVALID)
{
AssignCommand(oDominated,ClearAllActions(TRUE));
AssignCommand(oDominated,SetIsDestroyable(TRUE));
DestroyObject(oDominated);
}
if (oFamiliar != OBJECT_INVALID)
{
AssignCommand(oFamiliar,ClearAllActions(TRUE));
AssignCommand(oFamiliar,SetIsDestroyable(TRUE));
DestroyObject(oFamiliar);
}
if (oCompanion != OBJECT_INVALID)
{
AssignCommand(oCompanion,ClearAllActions(TRUE));
AssignCommand(oCompanion,SetIsDestroyable(TRUE));
DestroyObject(oCompanion);
}
if (oSummoned != OBJECT_INVALID)
{
AssignCommand(oSummoned,ClearAllActions(TRUE));
AssignCommand(oSummoned,SetIsDestroyable(TRUE));
DestroyObject(oSummoned);
}
}
This is the script that gets executed to activate the trigger for the pit trap that the player would walk over to take them to the next level.
object oPC = GetEnteringObject();
object oPit_Plate_1 = OBJECT_SELF;
//object oPit_Plate_1_2 = GetObjectByTag("PillrSwPitH");
object spawnPoint;
location theLocation;
int localValue=GetLocalInt(OBJECT_SELF,"DisabledPit_42A");
object oPitTrap = GetNearestObjectByTag("PitH");
object oUser = GetPCSpeaker();
void main()
{
object oInvObj = GetNearestObjectByTag( "Pit_AT4_42A" );
AssignCommand( oInvObj, PlaySound("as_dr_stonvlgcl1") );
SetLocalInt(oPit_Plate_1,"DisabledPit_42A", 0);
AssignCommand(oPitTrap,SpeakString("Rumbling Noise..."));
FloatingTextStringOnCreature("The pit is open", oUser, FALSE);
spawnPoint = GetNearestObjectByTag("Pit_AT4_42A");
theLocation = GetLocation(spawnPoint);
CreateObject(OBJECT_TYPE_PLACEABLE, "pit_42a", theLocation, FALSE);
ExecuteScript("at4n_42a_tel", OBJECT_SELF);
}
This is the last part the execute script at4n_42a_tel that you see in the previous above script
void main()
{
object oPC = GetPCSpeaker();
object oTarget;
location lTarget;
oTarget = GetWaypointByTag("FG_WP_1");
lTarget = GetLocation(oTarget);
//only do the jump if the location is valid.
//though not flawless, we just check if it is in a valid area.
//the script will stop if the location isn't valid - meaning that
//nothing put after the teleport will fire either.
//the current location won't be stored, either
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
oTarget=GetFirstFactionMember(oPC, FALSE);
while (GetIsObjectValid(oTarget))
{
AssignCommand(oTarget, ClearAllActions());
AssignCommand(oTarget, ActionJumpToLocation(lTarget));
oTarget=GetNextFactionMember(oPC, FALSE);
}
}
Sorry this is a big set of scripts.