Initial Upload
Initial Upload
This commit is contained in:
163
_module/nss/asg_rul_bulditem.nss
Normal file
163
_module/nss/asg_rul_bulditem.nss
Normal file
@@ -0,0 +1,163 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Name(ASG_RULE) Build Item Routine
|
||||
//:: FileName
|
||||
//:: Copyright (c) 2001 Bioware Corp.
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
script version 1.1 - 12/17/02
|
||||
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Donny Wilbanks
|
||||
//:: Created On: 08/02/02
|
||||
//:://////////////////////////////////////////////
|
||||
#include "nw_i0_plot"
|
||||
void Asg_TakeItems(object oPC,string sREQ,int vNUM)
|
||||
{
|
||||
// Take items from player
|
||||
int vK=1;
|
||||
string sTag = sREQ;
|
||||
int vSP = FALSE;
|
||||
if (sTag=="EXP")
|
||||
{
|
||||
vSP=TRUE;
|
||||
int vPCXP = GetXP(oPC);
|
||||
int vNEWXP = vPCXP - vNUM;
|
||||
SetXP(oPC,vNEWXP);
|
||||
}
|
||||
if (sTag=="GOLD")
|
||||
{
|
||||
vSP=TRUE;
|
||||
TakeGold(vNUM,oPC,TRUE);
|
||||
}
|
||||
if (vSP == FALSE)
|
||||
{
|
||||
object oItem = GetFirstItemInInventory(oPC);
|
||||
while (GetIsObjectValid(oItem))
|
||||
{
|
||||
if (vK<=vNUM)
|
||||
{
|
||||
sTag=GetTag(oItem);
|
||||
// DEBUG : SendMessageToPC(GetFirstPC(),"DEBUG: fOUND "+sTag+".");
|
||||
if (sTag==sREQ)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
// DEBUG: SendMessageToPC(GetFirstPC(),"DEBUG: fOUND "+sREQ+" # "+IntToString(vNUM));
|
||||
vK++;
|
||||
}
|
||||
}
|
||||
oItem = GetNextItemInInventory(oPC);
|
||||
}
|
||||
// DEBUG: SendMessageToPC(GetFirstPC(),"DEBUG: "+sREQ+" # "+IntToString(vNUM));
|
||||
}
|
||||
}
|
||||
//
|
||||
void main()
|
||||
{
|
||||
object oPC = GetPCSpeaker();
|
||||
object oItem;
|
||||
object oCreature;
|
||||
|
||||
int vITEMTOBUILD = GetLocalInt(oPC,"ITEMTOBUILD");
|
||||
int vNUMBERGIVEN = GetLocalInt(oPC,"NUMBERGIVEN");
|
||||
string sREQ1 = GetLocalString(oPC,"REQ1");
|
||||
string sREQ2 = GetLocalString(oPC,"REQ2");
|
||||
string sREQ3 = GetLocalString(oPC,"REQ3");
|
||||
string sREQ4 = GetLocalString(oPC,"REQ4");
|
||||
int vNUM1 = GetLocalInt(oPC,"NUM1");
|
||||
int vNUM2 = GetLocalInt(oPC,"NUM2");
|
||||
int vNUM3 = GetLocalInt(oPC,"NUM3");
|
||||
int vNUM4 = GetLocalInt(oPC,"NUM4");
|
||||
int vPLACE = GetLocalInt(oPC,"PLACE");
|
||||
string sDIST_WHAT= GetLocalString(oPC,"PLACE");
|
||||
float vDIST = GetLocalFloat(oPC,"DIST");
|
||||
object oSummoningPoint = GetNearestObjectByTag(sDIST_WHAT,oPC);
|
||||
// **
|
||||
// ** Search and Destroy Componants.
|
||||
// **
|
||||
string sBluePrint = GetLocalString(oPC,"BLUEPRINT");
|
||||
if (vNUM1>=1) Asg_TakeItems(oPC,sREQ1,vNUM1);
|
||||
if (vNUM2>=1) Asg_TakeItems(oPC,sREQ2,vNUM2);
|
||||
if (vNUM3>=1) Asg_TakeItems(oPC,sREQ3,vNUM3);
|
||||
if (vNUM4>=1) Asg_TakeItems(oPC,sREQ4,vNUM4);
|
||||
// **
|
||||
// ** Create Item or Placeable at Location or on Person.
|
||||
// **
|
||||
switch (vPLACE)
|
||||
{
|
||||
case(1):
|
||||
{
|
||||
oItem = CreateItemOnObject(sBluePrint,oPC,vNUMBERGIVEN);
|
||||
}
|
||||
break;
|
||||
case(2):
|
||||
{
|
||||
oItem = CreateObject(OBJECT_TYPE_PLACEABLE,sBluePrint,GetLocation(oPC),TRUE);
|
||||
}
|
||||
break;
|
||||
case(3):
|
||||
{
|
||||
oItem = CreateObject(OBJECT_TYPE_PLACEABLE,sBluePrint,GetLocation(oSummoningPoint),TRUE);
|
||||
}
|
||||
break;
|
||||
case(4):
|
||||
{
|
||||
oCreature = CreateObject(OBJECT_TYPE_CREATURE,sBluePrint,GetLocation(oSummoningPoint),TRUE);
|
||||
}
|
||||
break;
|
||||
case(5):
|
||||
{
|
||||
oItem = CreateItemOnObject(sBluePrint,oPC,vNUMBERGIVEN);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// ActionSpeakString("ERROR: Failure to Create item ["+sBluePrint+"] in asg_rul_bulditem.");
|
||||
}
|
||||
if (GetIsObjectValid(oItem))
|
||||
{
|
||||
SetLocalObject(oPC,"ASG_SPECIAL_ITEM_CONSTRUCTION_FLAG",oItem);
|
||||
SetIdentified(oItem,TRUE);
|
||||
}
|
||||
// **
|
||||
// ** Specail Propeties that need to be assigned - assign them here.
|
||||
// **
|
||||
string sTag; sTag=GetTag(oItem);
|
||||
if (sTag=="ASG_BEDROLL")
|
||||
{
|
||||
SetLocalInt(oItem,"BEDROLL_CHARGES",50);
|
||||
}
|
||||
//
|
||||
SetLocalObject(oPC,"ASG_SPECIAL_ITEM_CONSTRUCTION_FLAG",oItem);
|
||||
// ** Clean up old varibles
|
||||
SetLocalInt(oPC,"ITEMTOBUILD",0);
|
||||
SetLocalString(oPC,"ITEMNAME","none");
|
||||
SetLocalString(oPC,"BLUEPRINT","none");
|
||||
SetLocalInt(oPC,"NUMBERGIVEN",0);
|
||||
SetLocalString(oPC,"REQ1","empty");
|
||||
SetLocalString(oPC,"REQ2","empty");
|
||||
SetLocalString(oPC,"REQ3","empty");
|
||||
SetLocalString(oPC,"REQ4","empty");
|
||||
SetLocalInt(oPC,"NUM1",0);
|
||||
SetLocalInt(oPC,"NUM2",0);
|
||||
SetLocalInt(oPC,"NUM3",0);
|
||||
SetLocalInt(oPC,"NUM4",0);
|
||||
SetLocalInt(oPC,"PLACE",1);
|
||||
SetLocalString(oPC,"DIST_WHAT","none");
|
||||
if (GetIsObjectValid(oItem))
|
||||
{
|
||||
// Setup it's religon...
|
||||
string sDName = GetLocalString(oPC,"INGAMEDEITY");
|
||||
if (sDName=="")
|
||||
{
|
||||
sDName="Baccob";
|
||||
SetLocalString(oPC,"INGAMEDEITY","Baccob");
|
||||
SetLocalInt(oPC,"GoodEvil",ALIGNMENT_NEUTRAL);
|
||||
SetLocalInt(oPC,"LawChaos",ALIGNMENT_NEUTRAL);
|
||||
}
|
||||
int vGoodEvil = GetLocalInt(oPC,"GoodEvil");
|
||||
int vLawChaos = GetLocalInt(oPC,"LawChaos");
|
||||
SetLocalString(oItem,"INGAMEDEITY",sDName);
|
||||
SetLocalInt(oItem,"GoodEvil",vGoodEvil);
|
||||
SetLocalInt(oItem,"LawChaos",vLawChaos);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user