/* //Script By: Patrick Lobre Copyright (c) 2008 Bioware Corp. Put this script OnUsed on the item you wish to start the Jousting You Need 6 waypoints: Waypoint Called "RedStart" - Put this at the BEGGINNING (where the player will start) od Red Side's end of the Jousting Area Waypoint Called "RedDecide" - Put this in the MIDDLE of the Red Side's end of the Jousting Area Waypoint Called "RedEnd" - Put this at the END of the Red Side's end of the Jousting Area Waypoint Called "BlueStart" - Put this at the BEGGINNING (where the player will start) of Blue Side's end of the Jousting Area Waypoint Called "BlueDecide" - Put this in the MIDDLE of the Blue Side's end of the Jousting Area Waypoint Called "BlueEnd" - Put this at the END of the Blue Side's end of the Jousting Area This should be your setup: -.- = 1 section of the Jousting List RS = Red Start BS = Blue Start RD = Red Decide BD = Blue Decide RE = Red End BE = Blue End RE RD RS .--.--.--.--.--.--.--.--.--.--. BS BD BE Visual 620 = Lance Snap 1 Visual 621 = Lance Snap 2 Visual 622 = Lance Snap 3 Visual 671 = Heavy Hit Visual 672 = Light hit / Scrape Sheild */ #include "x3_inc_horse" //////////////////////////////////////////////////////////////////////////////// int GOLD_REWARD_AMOUNT = 100; int XP_REWARD_AMMOUNT = 0; //////////////////////////////////////////////////////////////////////////////// object oPC1 = GetLocalObject(GetModule(),"Player1" ); object oPC2 = GetLocalObject(GetModule(),"Player2" ); void EndCutscene(object oPlayer) { DelayCommand(9.0 , FadeToBlack(oPlayer , FADE_SPEED_FAST)); DelayCommand(12.0 , StopFade(oPlayer)); DelayCommand(12.0 , SetCutsceneMode(oPlayer, FALSE)); DelayCommand(12.0 , SetLocalObject(GetModule(), "Player1" , OBJECT_INVALID)); DelayCommand(12.0 , SetLocalObject(GetModule(), "Player2" , OBJECT_INVALID)); DelayCommand(12.0 , HorseSetPhenotype(oPlayer, FALSE)); } void BreakWeapon(object oPlayer) { int BreakRoll = d3(1); if (BreakRoll == 3) { string LanceTag = GetTag(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND ,oPC1)); object MyLance = GetItemInSlot( INVENTORY_SLOT_RIGHTHAND, oPC1); object oItem = CopyItemAndModify( MyLance ,ITEM_APPR_TYPE_WEAPON_MODEL, ITEM_APPR_WEAPON_MODEL_TOP, 2); AssignCommand(oPlayer , ActionEquipItem(oItem , INVENTORY_SLOT_RIGHTHAND)); DestroyObject(MyLance); ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(621), oPlayer); FloatingTextStringOnCreature("Your Lance Shattered!",oPlayer); } } void main() { object LastUser = GetLastUsedBy(); //Make sure the joust dosent start without logical items equpped if (HorseGetIsMounted(LastUser)!= TRUE) {FloatingTextStringOnCreature("You Must Be Mounted To Joust!", LastUser); return;} if (GetBaseItemType(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, LastUser)) != 92) {FloatingTextStringOnCreature("You Must Have A Lance Equipped To Joust!", LastUser); return;} if (GetItemAppearance(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, LastUser), ITEM_APPR_TYPE_WEAPON_MODEL, ITEM_APPR_WEAPON_MODEL_TOP) == 2) {FloatingTextStringOnCreature("You Cannot Joust With A Broken Lance!", LastUser); return;} //Make sure we have jousting in this area before jousting. if (GetObjectByTag("RedStart") == OBJECT_INVALID) {FloatingTextStringOnCreature("There is no Jousting in this Area", LastUser); return;} else if (GetObjectByTag("RedDecide") == OBJECT_INVALID) {FloatingTextStringOnCreature("There is no Jousting in this Area", LastUser); return;} else if (GetObjectByTag("RedEnd") == OBJECT_INVALID) {FloatingTextStringOnCreature("There is no Jousting in this Area", LastUser); return;} else if (GetObjectByTag("BlueStart") == OBJECT_INVALID) {FloatingTextStringOnCreature("There is no Jousting in this Area", LastUser); return;} else if (GetObjectByTag("BlueDecide") == OBJECT_INVALID) {FloatingTextStringOnCreature("There is no Jousting in this Area", LastUser); return;} else if (GetObjectByTag("BlueEnd") == OBJECT_INVALID) {FloatingTextStringOnCreature("There is no Jousting in this Area", LastUser); return;} //If The Player Wants To Resign, Simply Use The Object Again. else if (GetLocalObject(GetModule(),"Player1" ) == LastUser) {//The Player is already entered in Slot 1. Resign him FloatingTextStringOnCreature("You Resigned From The Joust", oPC1); FloatingTextStringOnCreature("The Joust Has Been Canceled", oPC2); SetLocalObject(GetModule(), "Player1" , OBJECT_INVALID); SetLocalObject(GetModule(), "Player2" , OBJECT_INVALID); return; } else if(GetLocalObject(GetModule(),"Player2" ) == LastUser) {//The Player is already entered in Slot 2. Resign him FloatingTextStringOnCreature("You Resigned From The Joust", oPC2); FloatingTextStringOnCreature("The Joust Has Been Canceled", oPC1); SetLocalObject(GetModule(), "Player1" , OBJECT_INVALID); SetLocalObject(GetModule(), "Player2" , OBJECT_INVALID); return; } // Assign the player a Slot... since he isnt already signed up else if (GetLocalObject(GetModule(),"Player1" ) == OBJECT_INVALID &&GetLocalObject(GetModule(),"Player1") != LastUser) {SetLocalObject(GetModule(), "Player1" , LastUser); FloatingTextStringOnCreature("You Have Applied To Joust On The Red Team!", LastUser);} else if (GetLocalObject(GetModule(),"Player2" ) == OBJECT_INVALID &&GetLocalObject(GetModule(),"Player2" ) != LastUser) {SetLocalObject(GetModule(), "Player2" , LastUser); FloatingTextStringOnCreature("You Have Applied To Joust On The Blue Team!", LastUser);} //The Player Isnt Registered And The Slots Are Occupied: else FloatingTextStringOnCreature("There Is Already A Challenge In Progress! Come Back Later.", LastUser); //If this is Player 2 using the item, Make sure Player 1 is around: if (GetLocalObject(GetModule(),"Player1" ) != OBJECT_INVALID && GetDistanceToObject(GetLocalObject(GetModule(),"Player1" )) >= 5.0) {FloatingTextStringOnCreature("The Other Challenger Is No Longer In The Area.", LastUser); DelayCommand(0.5,FloatingTextStringOnCreature("Match Canceled Due To Forfeit.", LastUser)); SetLocalObject(GetModule(), "Player1" , OBJECT_INVALID); SetLocalObject(GetModule(), "Player2" , OBJECT_INVALID); return;} if (GetLocalObject(GetModule(), "Player1") != OBJECT_INVALID) {if (GetLocalObject(GetModule(), "Player2") != OBJECT_INVALID) { //Refresh the Variables... or the PLAYERS in this matter. object oPC1 = GetLocalObject(GetModule(),"Player1" ); object oPC2 = GetLocalObject(GetModule(),"Player2" ); //Start The Cutscene: int PC1Ride = GetSkillRank(SKILL_RIDE, oPC1); int PC1Roll = d20() + PC1Ride; int PC2Ride = GetSkillRank(SKILL_RIDE, oPC2); int PC2Roll = d20() + PC2Ride; //Set the Jousting Position HorseSetPhenotype(oPC2, TRUE); HorseSetPhenotype(oPC1, TRUE); //Set the players up for the Joust AssignCommand(oPC1, JumpToObject(GetObjectByTag("RedStart"))); AssignCommand(oPC1, SetFacingPoint(GetPosition(GetObjectByTag("RedDecide")))); AssignCommand(oPC2, JumpToObject(GetObjectByTag("BlueStart"))); AssignCommand(oPC2, SetFacingPoint(GetPosition(GetObjectByTag("BlueDecide")))); //Take a random "Shatter" effect for the Lance: //Handle The Red Player's Animations //Script By: Patrick Lobre //PC 1 FadeFromBlack(oPC1); SetCutsceneMode(oPC1, TRUE); AssignCommand(oPC1, ActionWait(4.0f)); AssignCommand(oPC1, ActionMoveToObject(GetObjectByTag("RedDecide"),TRUE)); if (PC1Roll <= PC2Roll) { if (PC2Roll - PC1Roll >= 10) //Loose by 10 or more {AssignCommand(oPC1, ActionPlayAnimation(HORSE_ANIMATION_LOOPING_JOUST_VIOLENT_FALL, 1.0f, 3.0f)); DelayCommand(8.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(671), oPC1));} else if (PC2Roll - PC1Roll <= 5) //Loose by 5 or less {AssignCommand(oPC1, ActionPlayAnimation(HORSE_ANIMATION_LOOPING_JOUST_GLANCE, 1.0f, 3.0f)); DelayCommand(8.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(672), oPC1));} else if (PC2Roll - PC1Roll <= 9) //Loose by 9 or less {AssignCommand(oPC1, ActionPlayAnimation(HORSE_ANIMATION_LOOPING_JOUST_HELMOFF, 1.0f, 3.0f)); DelayCommand(8.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(671), oPC1));} } else { AssignCommand(oPC1, ActionMoveToObject(GetObjectByTag("RedEnd"),TRUE)); //Only break the lance on a heavy hit: if (PC1Roll - PC2Roll > 5) DelayCommand(8.0, BreakWeapon(oPC1)); GiveXPToCreature(oPC1 , XP_REWARD_AMMOUNT); GiveGoldToCreature(oPC1 , GOLD_REWARD_AMOUNT); } SendMessageToPC(oPC1, "Your Roll was " + IntToString(PC1Roll)+ ". Your Opponent's Roll was " + IntToString(PC2Roll)); EndCutscene(oPC1); DelayCommand(11.0 , AssignCommand(oPC1, JumpToObject(GetObjectByTag("RedEnd")))); //Handle The Blue Player's Animations //Script By: Patrick Lobre //PC 2 FadeFromBlack(oPC2); SetCutsceneMode(oPC2, TRUE); AssignCommand(oPC2, ActionWait(4.0f)); AssignCommand(oPC2, ActionMoveToObject(GetObjectByTag("BlueDecide"),TRUE)); if (PC2Roll <= PC1Roll) { if (PC1Roll - PC2Roll >= 10) //Loose by 10 or more {AssignCommand(oPC2, ActionPlayAnimation(HORSE_ANIMATION_LOOPING_JOUST_VIOLENT_FALL, 1.0f, 3.0f)); DelayCommand(8.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(671), oPC2));} else if (PC1Roll - PC2Roll <= 5) //Loose by 5 or less {AssignCommand(oPC2, ActionPlayAnimation(HORSE_ANIMATION_LOOPING_JOUST_GLANCE, 1.0f, 3.0f)); DelayCommand(8.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(672), oPC2));} else if (PC1Roll - PC2Roll <= 9) //Loose by 9 or less {AssignCommand(oPC2, ActionPlayAnimation(HORSE_ANIMATION_LOOPING_JOUST_HELMOFF, 1.0f, 3.0f)); DelayCommand(8.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(671), oPC2));} } else { AssignCommand(oPC2, ActionMoveToObject(GetObjectByTag("BlueEnd"),TRUE)); //Only break the lance on a heavy hit: if (PC2Roll - PC1Roll > 5) DelayCommand(8.0, BreakWeapon(oPC2)); GiveXPToCreature(oPC2 , GOLD_REWARD_AMOUNT); GiveGoldToCreature(oPC2 , GOLD_REWARD_AMOUNT); } EndCutscene(oPC2); SendMessageToPC(oPC2, "Your Roll was " + IntToString(PC2Roll)+ ". Your Opponent's Roll was " + IntToString(PC1Roll)); DelayCommand(11.0 , AssignCommand(oPC2, JumpToObject(GetObjectByTag("BlueEnd")))); } } }