Initial Commit
Initial Commit
This commit is contained in:
288
_module/nss/ss_joust2.nss
Normal file
288
_module/nss/ss_joust2.nss
Normal file
@@ -0,0 +1,288 @@
|
||||
/* //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 = 0;
|
||||
int XP_REWARD_AMMOUNT = 0;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
object oPC1 = GetLocalObject(GetModule(),"Player1" );
|
||||
object oPC2 = GetLocalObject(GetModule(),"Player2" );
|
||||
int GetArmorType(object oItem)
|
||||
{
|
||||
// Make sure the item is valid and is an armor.
|
||||
if (!GetIsObjectValid(oItem))
|
||||
return -1;
|
||||
if (GetBaseItemType(oItem) != BASE_ITEM_ARMOR)
|
||||
return -1;
|
||||
|
||||
// Get the identified flag for safe keeping.
|
||||
int bIdentified = GetIdentified(oItem);
|
||||
SetIdentified(oItem,FALSE);
|
||||
|
||||
int nType = -1;
|
||||
switch (GetGoldPieceValue(oItem))
|
||||
{
|
||||
case 1: nType = 0; break; // None
|
||||
case 5: nType = 1; break; // Padded
|
||||
case 10: nType = 2; break; // Leather
|
||||
case 15: nType = 3; break; // Studded Leather / Hide
|
||||
case 100: nType = 4; break; // Chain Shirt / Scale Mail
|
||||
case 150: nType = 5; break; // Chainmail / Breastplate
|
||||
case 200: nType = 6; break; // Splint Mail / Banded Mail
|
||||
case 600: nType = 7; break; // Half-Plate
|
||||
case 1500: nType = 8; break; // Full Plate
|
||||
}
|
||||
// Restore the identified flag, and return armor type.
|
||||
SetIdentified(oItem,bIdentified);
|
||||
return nType;
|
||||
}
|
||||
|
||||
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 ,oPlayer));
|
||||
object MyLance = GetItemInSlot( INVENTORY_SLOT_RIGHTHAND, oPlayer);
|
||||
DestroyObject(MyLance);
|
||||
CreateItemOnObject("brokenlance", oPlayer);
|
||||
AssignCommand(oPlayer, ActionEquipItem(GetItemPossessedBy(OBJECT_SELF, "brokenlance"), INVENTORY_SLOT_RIGHTHAND));
|
||||
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 have 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 have resigned from the joust", oPC2);
|
||||
FloatingTextStringOnCreature("The joust has neen 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" );
|
||||
|
||||
//Make sure the joust dosent start without logical items equpped
|
||||
if (HorseGetIsMounted(oPC1)!= TRUE)
|
||||
{FloatingTextStringOnCreature("You must be mounted to joust!", oPC1);
|
||||
return;}
|
||||
if (GetBaseItemType(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC1)) != 92)
|
||||
{FloatingTextStringOnCreature("You must have a lance equipped to joust!", oPC1);
|
||||
return;}
|
||||
if (GetItemAppearance(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC1), ITEM_APPR_TYPE_WEAPON_MODEL, ITEM_APPR_WEAPON_MODEL_TOP) == 2)
|
||||
{FloatingTextStringOnCreature("You cannot joust with a broken lance!", oPC1);
|
||||
return;}
|
||||
if (HorseGetIsMounted(oPC2)!= TRUE)
|
||||
{FloatingTextStringOnCreature("You must be mounted to joust!", oPC2);
|
||||
return;}
|
||||
if (GetBaseItemType(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC2)) != 92)
|
||||
{FloatingTextStringOnCreature("You must have a lance equipped to joust!", oPC2);
|
||||
return;}
|
||||
if (GetItemAppearance(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC2), ITEM_APPR_TYPE_WEAPON_MODEL, ITEM_APPR_WEAPON_MODEL_TOP) == 2)
|
||||
{FloatingTextStringOnCreature("You cannot joust with a broken lance!", oPC2);
|
||||
return;}
|
||||
|
||||
//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"))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user