Even if the Object is already given its item properties, at times if the item is dropped and then picked up again then another weapon within the user's inventory can recieve the same random properties.
Is there any way to prevent this from occuring? If discovered a player could easily abuse it and continue to populate his basic longsword collection full of elemental damage, and then proceed to sell them for profit. I'm not very experienced in the ItemProperty area so please let me know if i'm doing something wrong.
CONTENTS BELOW
1. eleweap (tagbased system, the effect)
2. snippet of GetWeaponType function
3. aq_eleweap (part of tagbased system)
eleweap
sWeapon = GetWeaponType(oItem); returns a string with the weapon's "type" based on a local variable placed upon the item.
#include "x2_inc_itemprop"
#include "csu_library"
void main()
{
object oItem = GetModuleItemAcquired();
itemproperty ipAdd;
string sName;
string sWeapon;
int nProp = GetLocalInt( oItem, "Enchanted");
int nRand = d4();
if (nProp == 0)
{
switch (nRand)
{
case 1:
ipAdd = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ACID, IP_CONST_DAMAGEBONUS_1d6);
sName = "Acid";
break;
case 2:
ipAdd = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGEBONUS_1d6);
sName = "Flame";
break;
case 3:
ipAdd = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_COLD, IP_CONST_DAMAGEBONUS_1d6);
sName = "Ice";
break;
case 4:
ipAdd = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ELECTRICAL, IP_CONST_DAMAGEBONUS_1d6);
sName = "Thunder";
break;
default:
break;
}
sWeapon = GetWeaponType(oItem);
IPSafeAddItemProperty(oItem, ipAdd);
sName = ColorString(("Elemental " + sWeapon + " of " + sName), 0, 255, 0);
SetName(oItem , sName);
SetLocalInt( oItem, "Enchanted", nRand);
}
else
{
// Do Nothing
}
}GetWeaponType snippet. just a shortened example of the function
// CHECKS INT "Type" & RETURNS WEAPON TYPE
string GetWeaponType(object oItem)
{
string sType = "Weapon";
int nType = GetLocalInt( oItem, "Type");
switch (nType)
{
// Bladed
case 1:
sType = "Dagger";
break;
case 2:
sType = "Shortsword";
break;
case 3:
sType = "Longsword";
break;
case 4:
sType = "Greatsword";
break;
default:
sType = "0";
break;
}
return sType;
}
aq_eleweap
(taken from Lilac's Script Generator)
#include "x2_inc_switches"
void main()
{
int nEvent =GetUserDefinedItemEventNumber();
switch (nEvent)
{
case X2_ITEM_EVENT_ACTIVATE:
ExecuteScript("ac_"+GetTag(GetItemActivated()), OBJECT_SELF);
break;
case X2_ITEM_EVENT_EQUIP:
ExecuteScript("eq_"+GetTag(GetPCItemLastEquipped()), OBJECT_SELF);
break;
case X2_ITEM_EVENT_UNEQUIP:
ExecuteScript("ue_"+GetTag(GetPCItemLastUnequipped()), OBJECT_SELF);
break;
case X2_ITEM_EVENT_ACQUIRE:
ExecuteScript("aq_"+GetTag(GetModuleItemAcquired()), OBJECT_SELF);
break;
case X2_ITEM_EVENT_UNACQUIRE:
ExecuteScript("ua_"+GetTag(GetModuleItemLost()), OBJECT_SELF);
break;
case X2_ITEM_EVENT_SPELLCAST_AT:
ExecuteScript("sp_"+GetTag(GetModuleItemLost()), OBJECT_SELF);
break;
case X2_ITEM_EVENT_ONHITCAST:
ExecuteScript("on_"+GetTag(GetSpellCastItem()), OBJECT_SELF);
break;
}
}
Modifié par Xanodus, 30 octobre 2010 - 05:43 .





Retour en haut






