Areas and Fixes
Added CCOH and missing areas Changed some areas to be craftable, Fixed some on death issues, Fixed the Gaurd
This commit is contained in:
258
_module/nss/_craft_papermill.nss
Normal file
258
_module/nss/_craft_papermill.nss
Normal file
@@ -0,0 +1,258 @@
|
||||
//#include "_persist_01a"
|
||||
#include "aps_include"
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
object oPC = GetLastDisturbed();
|
||||
object oItem = GetInventoryDisturbItem();
|
||||
object oSelf = OBJECT_SELF;
|
||||
string sItemTag = GetTag(oItem);
|
||||
string sItemResRef = GetResRef(oItem);
|
||||
string sSuccess = "";
|
||||
string sProduct = "papr_blank_";
|
||||
int iProduct = 0;
|
||||
int iDifficulty = 0;
|
||||
|
||||
// The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System.
|
||||
// You can replace them with whatever 'no-drop' code you have or comment them out.
|
||||
string sNoDropFlag = (GetStringLeft(GetTag(oItem),6));
|
||||
if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_")
|
||||
return;
|
||||
if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX)
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed.");
|
||||
return;
|
||||
}
|
||||
// End of compatability portion.
|
||||
|
||||
if (GetStringLeft(sItemTag,5)!="pulp_")
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("This is not bleached pulp.",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetStringRight(sItemTag,3)!="001") //pulp_wood_raw001, pulp_rice_raw001, pulp_silk_raw001
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("You must first bleach this pulp before pressing and making it into paper.",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF,"iAmInUse")!=0)
|
||||
{
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
FloatingTextStringOnCreature("The paper mill is not yet done with it's current task.",oPC,FALSE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
object oItem2 = GetItemPossessedBy(oSelf,GetTag(oItem));
|
||||
int iStackSize = GetNumStackedItems(oItem2);
|
||||
//FloatingTextStringOnCreature("STACK = "+IntToString(iStackSize),oPC,FALSE);
|
||||
|
||||
if (sItemTag=="pulp_wood_raw001")
|
||||
{
|
||||
//Normal Paper
|
||||
iDifficulty = 250;
|
||||
sProduct=sProduct+"norma";
|
||||
sSuccess = "You carefully screen and press the wood pulp into normal paper.";
|
||||
}
|
||||
|
||||
if (sItemTag=="pulp_rice_raw001")
|
||||
{
|
||||
//Rice Paper
|
||||
sProduct=sProduct+"rice";
|
||||
sSuccess = "You carefully screen and press the rice pulp into rice paper.";
|
||||
}
|
||||
|
||||
if (sItemTag=="pulp_silk_raw001")
|
||||
{
|
||||
//Silk Paper
|
||||
iDifficulty = 500;
|
||||
sProduct=sProduct+"silk";
|
||||
sSuccess = "You carefully screen and press the silk and wood pulp into silk paper.";
|
||||
}
|
||||
|
||||
//int iPaperSkill = GetTokenPair(oPC,13,13);
|
||||
int iPaperSkill = GetPersistentInt(oPC,"iPaperSkill","UOACraft");
|
||||
int iPaperChance = iPaperSkill;
|
||||
if (iPaperSkill <350)
|
||||
{
|
||||
iPaperChance = GetAbilityScore(oPC,ABILITY_DEXTERITY)*5;
|
||||
iPaperChance = iPaperChance + (GetAbilityScore(oPC,ABILITY_WISDOM)*3);
|
||||
iPaperChance = iPaperChance + (GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*2);
|
||||
iPaperChance = iPaperChance *3;
|
||||
if (iPaperChance>350)iPaperChance = 350;
|
||||
if (iPaperSkill>iPaperChance) iPaperChance = iPaperSkill;
|
||||
}
|
||||
|
||||
if (iDifficulty>iPaperSkill)
|
||||
{
|
||||
FloatingTextStringOnCreature("You have no idea how to process this pulp into paper.",oPC,FALSE);
|
||||
CopyItem(oItem,oPC,TRUE);
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
|
||||
SetLocalInt(OBJECT_SELF,"iAmInUse",99);
|
||||
DelayCommand(31.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0));
|
||||
|
||||
location lSelf = GetLocation(OBJECT_SELF);
|
||||
vector vSelf = GetPosition(OBJECT_SELF);
|
||||
object oArea = GetArea(OBJECT_SELF);
|
||||
vector vFire;
|
||||
int vDirection;
|
||||
float fSelf;
|
||||
int iRandom;
|
||||
float fDistance;
|
||||
location lFire;
|
||||
fSelf = GetFacing(OBJECT_SELF)+270.0;
|
||||
|
||||
int iLoop = 30;
|
||||
float fDelay3 = 0.0;
|
||||
int iPosition = 15;
|
||||
|
||||
for (iLoop; iLoop>0; iLoop--)
|
||||
{
|
||||
if (iLoop>14)
|
||||
{
|
||||
iPosition = iPosition - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
iPosition = iPosition+1;
|
||||
}
|
||||
if (iLoop==14) fSelf = GetFacing(OBJECT_SELF)+90;
|
||||
fDelay3 = fDelay3+1.0;
|
||||
fDistance = (IntToFloat(iPosition)/17.0);
|
||||
vFire = vSelf + (AngleToVector(fSelf) * fDistance);
|
||||
vFire.z += 0.5;
|
||||
lFire = Location(oArea,vFire,fSelf);
|
||||
DelayCommand(fDelay3,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SMOKE_PUFF),lFire));
|
||||
}
|
||||
|
||||
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,30.0));
|
||||
|
||||
PlaySound("al_cv_millwheel1");
|
||||
DelayCommand(5.9,PlaySound("al_cv_millwheel1"));
|
||||
DelayCommand(11.9,PlaySound("al_cv_millwheel1"));
|
||||
DelayCommand(17.9,PlaySound("al_cv_millwheel1"));
|
||||
DelayCommand(23.9,PlaySound("al_cv_millwheel1"));
|
||||
|
||||
PlaySound("al_cv_firetorch1");
|
||||
DelayCommand(5.9,PlaySound("al_cv_firetorch1"));
|
||||
DelayCommand(11.9,PlaySound("al_cv_firetorch1"));
|
||||
DelayCommand(17.9,PlaySound("al_cv_firetorch1"));
|
||||
DelayCommand(23.9,PlaySound("al_cv_firetorch1"));
|
||||
|
||||
PlaySound("al_cv_fanlg1");
|
||||
DelayCommand(4.9,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(9.9,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(14.9,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(19.9,PlaySound("al_cv_fanlg1"));
|
||||
DelayCommand(24.9,PlaySound("al_cv_fanlg1"));
|
||||
|
||||
PlaySound("al_cv_pump");
|
||||
DelayCommand(5.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(8.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(11.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(14.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(17.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(20.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(23.9,PlaySound("al_cv_pump"));
|
||||
DelayCommand(26.9,PlaySound("al_cv_pump"));
|
||||
|
||||
DelayCommand(2.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(6.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(10.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(14.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(18.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(22.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(26.0,PlaySound("as_cv_smithbelo1"));
|
||||
DelayCommand(30.0,PlaySound("as_cv_smithbelo1"));
|
||||
|
||||
|
||||
|
||||
|
||||
int iSkillGain=0;
|
||||
iPaperChance = iPaperChance-iDifficulty;
|
||||
if (Random(1000)<iPaperChance)
|
||||
{
|
||||
if (Random(1000) >= iPaperSkill)
|
||||
{
|
||||
if (d10(1)+1 >= iPaperChance/100) iSkillGain = 1;
|
||||
}
|
||||
DelayCommand(30.0,CreateAnObject(sProduct,oPC,iStackSize));
|
||||
DelayCommand(30.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE));
|
||||
|
||||
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
||||
{
|
||||
iSkillGain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLocalInt(oPC,"iSkillGain",99);
|
||||
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
||||
}
|
||||
}
|
||||
|
||||
if (iSkillGain ==1)
|
||||
{
|
||||
string sOldSkill = "";
|
||||
string sOldSkill2 = "";
|
||||
iPaperSkill++;
|
||||
sOldSkill2 = IntToString(iPaperSkill);
|
||||
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
||||
if (iPaperSkill > 9)
|
||||
{
|
||||
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
||||
}
|
||||
else
|
||||
{
|
||||
sOldSkill = "0"+sOldSkill;
|
||||
}
|
||||
if (iPaperSkill <= 1000)
|
||||
{
|
||||
//DelayCommand(30.0,SetTokenPair(oPC,13,13,iPaperSkill));
|
||||
DelayCommand(30.0,SetPersistentInt(oPC,"iPaperSkill",iPaperSkill,0,"UOACraft"));
|
||||
DelayCommand(30.0,SendMessageToPC(oPC,"======================================"));
|
||||
DelayCommand(30.0,SendMessageToPC(oPC,"Your skill in papermaking has gone up!"));
|
||||
DelayCommand(30.0,SendMessageToPC(oPC,"Current papermaking skill : "+ sOldSkill+"%"));
|
||||
DelayCommand(30.0,SendMessageToPC(oPC,"======================================"));
|
||||
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(29.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP")));
|
||||
}
|
||||
}
|
||||
DestroyObject(oItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
DelayCommand(30.0,FloatingTextStringOnCreature("The paper fails to set properly to the screen and is lost.",oPC,FALSE));
|
||||
if (iStackSize>1) iStackSize = Random(iStackSize)-1;
|
||||
if (iStackSize>0)
|
||||
{
|
||||
DelayCommand(31.0,FloatingTextStringOnCreature("You manage to recover some of the pulp.",oPC,FALSE));
|
||||
DelayCommand(31.0,CreateAnObject(sItemTag,oPC,iStackSize));
|
||||
DestroyObject(oItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
DestroyObject(oItem);
|
||||
}
|
||||
|
||||
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
||||
{
|
||||
CreateItemOnObject(sResource,oPC,iStackSize);
|
||||
return;
|
||||
}
|
Reference in New Issue
Block a user