Files
HeroesStone_PRC8/_module/nss/07_methwarn.nss
Jaysyn904 1eefc84201 Initial Commit
Initial Commit.
2025-09-14 15:40:46 -04:00

174 lines
6.4 KiB
Plaintext

//::///////////////////////////////////////////////
//:: 07_methwarn
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Determines if the pc has an item that has flame properties
and delivers a message to PC if so.
*/
//:://////////////////////////////////////////////
//:: Created By: ruelk and kaua'i (mostly kaua'i)
//:: Created On: 2/21/04
//:://////////////////////////////////////////////
int detectFlames(object oItem, object oPC);
void DoMessage();
void main()
{
object oEnterer = GetEnteringObject();
//Below here is probably all (lol) you will need to add to your methane onEnter script,
//posibly renaming oEnterer if appropiate
//check the methane has not been blown up someone else already:
if(GetLocalInt(OBJECT_SELF, "detonated") == 1)
return;
object oItem=GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oEnterer);
if(oItem != OBJECT_INVALID)
if (GetTag(oItem)=="NW_IT_TORCH001")
{
DoMessage();
return;
}
//check both right and left hand inventory slot
oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oEnterer);
if(oItem != OBJECT_INVALID)
if(detectFlames(oItem, oEnterer)==1)
{ //KABOOM!
// SetLocalInt(OBJECT_SELF, "detonated", 1);
//apply damage here, suggest function. suggest include above SetLocalInt() in function.
//obviously remove debug strings once they are no longer needed too.
DoMessage();
return;
}
//for offhand and gloves, check the previous item did not detonate the gas
oItem = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oEnterer);
if(oItem != OBJECT_INVALID)
if(detectFlames(oItem, oEnterer)==1)
{ //KABOOM!
// SetLocalInt(OBJECT_SELF, "detonated", 1);
//apply damage here, suggest function. suggest include above SetLocalInt() in function.
DoMessage();
return;
}
//gloves, for monks.
oItem = GetItemInSlot(INVENTORY_SLOT_ARMS, oEnterer);
if(oItem != OBJECT_INVALID)
if(detectFlames(oItem, oEnterer)==1)
{ //KABOOM!
// SetLocalInt(OBJECT_SELF, "detonated", 1);
//apply damage here, suggest function. suggest include above SetLocalInt() in function.
DoMessage();
return;
}
}
//determines if the weapon/item PC is holding is a flaming item
// developed by kaua'i
int detectFlames(object oItem, object oPC)
{
itemproperty itemProp;
int done =0;
int propType = -1;
int subType = -1;
int param1 = -1;
int param1value = -1;
int costParam = -1;
int costParamExclude = -1;
int tempCostParam = 0;
//depending on the damage type/effect, the values of the items props that have to be checked vary.
if(GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_BONUS))
{
propType = 16; subType = 10; param1 = 255; param1value = -1; costParam = 4; costParamExclude = 6;
//FloatingTextStringOnCreature("DEBUG: detected damage bonus weapon", oPC);
}
else if (GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_BONUS_VS_ALIGNMENT_GROUP))
{
propType = 17; subType = -1; param1 = -1; param1value = 10; costParam = 4; costParamExclude = 6;
//FloatingTextStringOnCreature("DEBUG: detected damage bonus vs align weapon", oPC);
}
else if (GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_BONUS_VS_RACIAL_GROUP))
{
propType = 18; subType = -1; param1 = -1; param1value = 10; costParam = 4; costParamExclude = 6;
//FloatingTextStringOnCreature("DEBUG: detected damage bonus vs race weapon", oPC);
}
else if (GetItemHasItemProperty(oItem, ITEM_PROPERTY_DAMAGE_BONUS_VS_SPECIFIC_ALIGNMENT))
{
propType = 19; subType = -1; param1 = -1; param1value = 10; costParam = 4; costParamExclude = 6;
//FloatingTextStringOnCreature("DEBUG: detected damage bonus vs spec. align weapon", oPC);
}
else if (GetItemHasItemProperty(oItem, ITEM_PROPERTY_ONHITCASTSPELL))
{
propType = 82; subType = 124; param1 = -1; param1value = -1; costParam = -1;
// FloatingTextStringOnCreature("DEBUG: detected damage bonus via spell weapon", oPC);
}
else return 0; //get out quickly where possible.
itemProp = GetFirstItemProperty(oItem);
while(done == 0)
{
if(GetItemPropertyType(itemProp) == propType)
{//looking at a damage bonus weapon, check is fire type
// FloatingTextStringOnCreature("DEBUG: passed propType condition", oPC);
if(GetItemPropertySubType(itemProp) == subType || subType == -1)
{
//FloatingTextStringOnCreature("DEBUG: passed subType condition", oPC);
if(GetItemPropertyParam1(itemProp) >= param1 || param1 == -1)
{
// FloatingTextStringOnCreature("DEBUG: passed param1 cond", oPC);
if(GetItemPropertyParam1Value(itemProp) >= param1value || param1value == -1)
{
// FloatingTextStringOnCreature("DEBUG: passed param1value cond", oPC);
tempCostParam = GetItemPropertyCostTableValue(itemProp);
if( tempCostParam >= costParam && tempCostParam != costParamExclude || costParam == -1 )//we have a winner!
{
// FloatingTextStringOnCreature("DEBUG: passed costParam cond", oPC);
return 1;
} //end if cost param
} // end if param1 value
}//end if param 1
}//end if property sub type
} //end if item property
itemProp = GetNextItemProperty(oItem);
if(GetIsItemPropertyValid(itemProp) == 0)
done = 1;
} //end while
return 0;
}
//Gets and fires the correct message
//developed by ruelk
void DoMessage()
{
int nDetectDifficulty = StringToInt(GetLockKeyTag(OBJECT_SELF));
string sString = GetName(OBJECT_SELF);
object oPC = GetEnteringObject();
if (!GetIsObjectValid(oPC)) return;
if (!GetIsSkillSuccessful(oPC, SKILL_SEARCH, nDetectDifficulty))
return;
FloatingTextStringOnCreature(sString, oPC);
}