generated from Jaysyn/ModuleTemplate
170 lines
6.3 KiB
Plaintext
170 lines
6.3 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: 07_methantrap
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This handles the effects of the methane pocket
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: ruelk and kuau'i (mostly kaua'i)
|
|
//:: Created On: 2/21/04
|
|
//:://////////////////////////////////////////////
|
|
int detectFlames(object oItem, object oPC);
|
|
|
|
void DoGasExplodes();
|
|
|
|
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")
|
|
{
|
|
DoGasExplodes();
|
|
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.
|
|
DoGasExplodes();
|
|
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.
|
|
DoGasExplodes();
|
|
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.
|
|
DoGasExplodes();
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
}
|
|
|
|
|
|
void DoGasExplodes()
|
|
{
|
|
object oEnterer = GetEnteringObject();
|
|
object oCaster = GetObjectByTag("07_METHANESOURCE");
|
|
|
|
object oTarget = oEnterer;
|
|
|
|
AssignCommand(oCaster, ActionCastSpellAtObject(SPELL_INFERNO, oTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
|
|
DelayCommand(5.0,SetLocalInt(OBJECT_SELF,"detonated",0));
|
|
return;
|
|
}
|