239 lines
7.2 KiB
Plaintext
239 lines
7.2 KiB
Plaintext
////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Olander's Siege System - Siege Equipment Creation
|
|
// os_mod_onunaqu
|
|
// by Don Anderson
|
|
// dandersonru@msn.com
|
|
//
|
|
// Place this in the Module Event - wrap_mod_onunaqu
|
|
//
|
|
// This creates the Siege Equipment when dropped on the ground by the Player
|
|
//
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "os_inc"
|
|
|
|
void main()
|
|
{
|
|
object oPC = GetModuleItemLostBy();
|
|
object oItem = GetModuleItemLost();
|
|
string sItem = GetTag(oItem);
|
|
object oArea = GetArea(oPC);
|
|
location lLoc = GetLocation(oItem);
|
|
int nPCFaction = GetLocalInt(oPC,"FACTION");
|
|
object oSiege;
|
|
object oTarget;
|
|
|
|
//Nothing can happen if the Player in in a conversation
|
|
int nConv = IsInConversation(oPC);
|
|
if(nConv == TRUE)return;
|
|
|
|
/******************************************************************************/
|
|
//::SIEGE CONTROL SWITCH
|
|
|
|
if(sItem == "ITSiegeSwitch")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"siegeswitch",lLoc);
|
|
oSiege = GetNearestObjectByTag("ITSiegeSwitch",oPC);
|
|
SetGroundingFacing(oSiege,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//::SIEGE CONTROL SWITCH
|
|
/******************************************************************************/
|
|
|
|
/******************************************************************************/
|
|
//::SIEGE KEG
|
|
|
|
//The Siege Keg in inventory that is dropped on the ground is converted to the Useable Siege Keg
|
|
if(sItem == "ITSiegeKeg")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"siegekeg",lLoc);
|
|
return;
|
|
}
|
|
|
|
//::SIEGE KEG
|
|
/******************************************************************************/
|
|
|
|
/******************************************************************************/
|
|
//::SIEGE WEAPONS
|
|
|
|
string sLeft = GetStringLeft(sItem,7);
|
|
if(sLeft == "ITSiege" && sLeft != "ITSiegeStone")
|
|
{
|
|
//Siege Weapons must be used above ground and in Natural Settings
|
|
if(!GetIsAreaAboveGround(oArea))return;
|
|
if(!GetIsAreaNatural(oArea))return;
|
|
|
|
oTarget = GetFirstObjectInShape(SHAPE_SPHERE, 3.0, lLoc, TRUE, OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
|
|
while (GetIsObjectValid(oTarget))
|
|
{
|
|
AssignCommand(oPC,ClearAllActions());
|
|
SendMessageToPC(oPC,"You will need 3 meters of clear space to place Siege Weapons.");
|
|
return;
|
|
}
|
|
|
|
//Siege Arbalest - Light
|
|
if(sItem == "ITSiegeArbalestLgt")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"siegearbalestlgt",lLoc);
|
|
oSiege = GetNearestObjectByTag(SIEGEARBALEST_LGT,oPC);
|
|
SetGroundingFacing(oSiege,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//Siege Arbalest - Heavy
|
|
if(sItem == "ITSiegeArbalestHvy")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"siegearbalesthvy",lLoc);
|
|
oSiege = GetNearestObjectByTag(SIEGEARBALEST_HVY,oPC);
|
|
SetGroundingFacing(oSiege,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//Siege Bricole
|
|
if(sItem == "ITSiegeBricole")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"siegebricole",lLoc);
|
|
oSiege = GetNearestObjectByTag(SIEGEBRICOLE,oPC);
|
|
SetGroundingFacing(oSiege,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//Siege Catapult - Light
|
|
if(sItem == "ITSiegeCatapultLgt")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"siegecatapultlgt",lLoc);
|
|
oSiege = GetNearestObjectByTag(SIEGECATAPULT_LGT,oPC);
|
|
SetGroundingFacing(oSiege,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//Siege Catapult - Heavy
|
|
if(sItem == "ITSiegeCatapultHvy")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"siegecatapulthvy",lLoc);
|
|
oSiege = GetNearestObjectByTag(SIEGECATAPULT_HVY,oPC);
|
|
SetGroundingFacing(oSiege,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//Siege Couillard
|
|
if(sItem == "ITSiegeCouillard")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"siegecouillard",lLoc);
|
|
oSiege = GetNearestObjectByTag(SIEGECOUILLARD,oPC);
|
|
SetGroundingFacing(oSiege,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//Siege Onager
|
|
if(sItem == "ITSiegeOnager")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"siegeonager",lLoc);
|
|
oSiege = GetNearestObjectByTag(SIEGEONAGER,oPC);
|
|
SetGroundingFacing(oSiege,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//Siege Perriere
|
|
if(sItem == "ITSiegePerriere")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"siegeperriere",lLoc);
|
|
oSiege = GetNearestObjectByTag(SIEGEPERRIERE,oPC);
|
|
SetGroundingFacing(oSiege,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
}
|
|
|
|
//::SIEGE WEAPONS
|
|
/******************************************************************************/
|
|
|
|
/******************************************************************************/
|
|
//::SIEGE SUPPLIES
|
|
|
|
//Acid Grenades Supply Barrel
|
|
if(sItem == "ITCatapultAcid")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"acidgrenades",lLoc);
|
|
oSiege = GetNearestObjectByTag(ITEM_ACID_GRENADE,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//Fire Grenades Supply Barrel
|
|
if(sItem == "ITCatapultFire")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"firegrenades",lLoc);
|
|
oSiege = GetNearestObjectByTag(ITEM_FIRE_GRENADE,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//Caltrops Grenades Supply Barrel
|
|
if(sItem == "ITOnagerCaltrops")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"caltropsgrenades",lLoc);
|
|
oSiege = GetNearestObjectByTag(ITEM_CAL_GRENADE,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//Oil Grenades Supply Barrel
|
|
if(sItem == "ITOnagerOil")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"oilgrenades",lLoc);
|
|
oSiege = GetNearestObjectByTag(ITEM_OIL_GRENADE,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//Siege Stones Supply
|
|
if(sItem == "ITSiegeStone")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"siegestones",lLoc);
|
|
oSiege = GetNearestObjectByTag(ITEM_SIEGE_STONE,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//Arbalest Spears Supply Rack
|
|
if(sItem == "ITArbalestSpear")
|
|
{
|
|
DestroyObject(oItem);
|
|
CreateObject(OBJECT_TYPE_PLACEABLE,"arbalestspears",lLoc);
|
|
oSiege = GetNearestObjectByTag(ITEM_ARB_SPEAR,oPC);
|
|
SetGroundingFacing(oSiege,oPC);
|
|
SetLocalInt(oSiege,"FACTION",nPCFaction);
|
|
return;
|
|
}
|
|
|
|
//::SIEGE SUPPLIES
|
|
/******************************************************************************/
|
|
|
|
}
|