generated from Jaysyn/ModuleTemplate
Initial commit
Initial commit
This commit is contained in:
345
_module/nss/oai_animals.nss
Normal file
345
_module/nss/oai_animals.nss
Normal file
@@ -0,0 +1,345 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Animal Hide and Fresh Meat Giver
|
||||
// oai_animals
|
||||
// By:Don Anderson
|
||||
// dandersonru@msn.com
|
||||
//
|
||||
// Assign this to the Arae OnEnter Event
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "oai_inc_base"
|
||||
|
||||
void SetInventoryDroppable(object oAnimal);
|
||||
|
||||
void main()
|
||||
{
|
||||
object oAnimal = OBJECT_SELF;//Use This Line if calling from OnSpawn Event
|
||||
string sAnimal = GetTag(oAnimal);
|
||||
int nCON = GetAbilityModifier(ABILITY_CONSTITUTION,oAnimal);
|
||||
int nCount;
|
||||
|
||||
if(GetIsDM(oAnimal)) return;
|
||||
if(GetIsPC(oAnimal)) return;
|
||||
|
||||
string sHide = "x2_it_cmat_leath";//Leather Hide
|
||||
string sFBear = "freshbear";
|
||||
string sFBeef = "freshbeef";
|
||||
string sFBison = "freshbison";
|
||||
string sFChicken = "freshchicken";
|
||||
string sFPork = "freshpork";
|
||||
string sFVenison = "freshvenison";
|
||||
string sFTrout = "freshtrout";
|
||||
string sFBass = "freshbass";
|
||||
string sFPike = "freshpike";
|
||||
string sFCrab = "freshcrab";
|
||||
|
||||
//Pack Animals do not Get Fresh Stuff
|
||||
int nPack = FindSubString(sAnimal,"Pack");
|
||||
if(nPack != -1) return;
|
||||
|
||||
//We Check which Animal and give them Fresh Meat
|
||||
//Bear
|
||||
int nBear = FindSubString(sAnimal,"BEAR");
|
||||
if(nBear != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_OMNIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFBear, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
CreateItemOnObject(sHide, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Bison
|
||||
int nBison = FindSubString(sAnimal,"BISON");
|
||||
if(nBison != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFBison, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
CreateItemOnObject(sHide, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Cow
|
||||
int nCow = FindSubString(sAnimal,"COW");
|
||||
if(nCow != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFBeef, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
CreateItemOnObject(sHide, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Oxen
|
||||
int nOx = FindSubString(sAnimal,"OX");
|
||||
if(nOx != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFBeef, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
CreateItemOnObject(sHide, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Water Buffalo
|
||||
int nBuffalo = FindSubString(sAnimal,"BUFFALO");
|
||||
if(nBuffalo != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFBeef, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
CreateItemOnObject(sHide, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Deer
|
||||
int nDeer = FindSubString(sAnimal,"DEER");
|
||||
if(nDeer != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFVenison, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
CreateItemOnObject(sHide, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Antelope
|
||||
int nAntelope = FindSubString(sAnimal,"ANTELOPE");
|
||||
if(nAntelope != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFVenison, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
CreateItemOnObject(sHide, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Gazelle
|
||||
int nGazelle = FindSubString(sAnimal,"GAZELLE");
|
||||
if(nGazelle != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFVenison, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
CreateItemOnObject(sHide, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Boar
|
||||
int nBoar = FindSubString(sAnimal,"BOAR");
|
||||
if(nBoar != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_OMNIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFPork, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
CreateItemOnObject(sHide, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Pig
|
||||
int nPig = FindSubString(sAnimal,"PIG");
|
||||
if(nPig != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFPork, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
CreateItemOnObject(sHide, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Peccary
|
||||
int nPeccary = FindSubString(sAnimal,"PECCARY");
|
||||
if(nPeccary != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFPork, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
CreateItemOnObject(sHide, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Hog
|
||||
int nHog = FindSubString(sAnimal,"HOG");;
|
||||
if(nHog != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFPork, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
CreateItemOnObject(sHide, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Babirusa
|
||||
int nBabirusa = FindSubString(sAnimal,"BABIRUSA");
|
||||
if(nBabirusa != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFPork, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
CreateItemOnObject(sHide, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Chicken
|
||||
int nChicken = FindSubString(sAnimal,"CHICKEN");
|
||||
if(nChicken != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE);
|
||||
|
||||
CreateItemOnObject(sFChicken, oAnimal, 1);
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
|
||||
//Crab
|
||||
int nCrab = FindSubString(sAnimal,"CRAB");
|
||||
if(nCrab != -1)
|
||||
{
|
||||
//Behavior State
|
||||
SetBehaviorState(NW_FLAG_BEHAVIOR_OMNIVORE);
|
||||
|
||||
if(nCON < 2) nCON = 2;
|
||||
|
||||
nCount = 1;
|
||||
while (nCount <= nCON)
|
||||
{
|
||||
CreateItemOnObject(sFCrab, oAnimal, 1);
|
||||
nCount++;
|
||||
}
|
||||
SetInventoryDroppable(oAnimal);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void SetInventoryDroppable(object oAnimal)
|
||||
{
|
||||
int nCount = 0;
|
||||
object oItem = GetFirstItemInInventory(oAnimal);
|
||||
while(GetIsObjectValid(oItem) && nCount <= 6)
|
||||
{
|
||||
SetDroppableFlag(oItem,TRUE);
|
||||
nCount++;
|
||||
GetNextItemInInventory(oAnimal);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user