Lightfoot8 wrote...
if (~GetItemCharges(oStaff) & 1 ) SetItemCharges(oStaff,GetItemCharges(oStaff)+1); will stop the staff from losing all charges and keep him from having to go through the process of delayed iProp removal and re addition to get the staff to have charges again.
It does hinge on the assumption that the staff started with more then three charges though. If the Item started with only 2 or three charges the SetIsDestroyable(FALSE)); would not happen in time to save the staff. If I was 100% on him using TBS I would have added the OnAquite section to the script fragment. But with out him posting his script or *cough* asking for more information, I just posted the fast solution. Since the staff is starting with (assumption) more then three charges.
Thanks guys
First of all, just to clear things up, I am a girl, so that would be her scripts.
Here are a couple of the scripts I made, with the earlier fix added to them. The staves and lute all start with 49 charges, and set at 2 charges per use.
Staff of Elements:
// Staff of Elements Script
#include "x2_inc_switches"
void main()
{
if(GetUserDefinedItemEventNumber() == X2_ITEM_EVENT_ACTIVATE)
{
int nType;
object oEventItem = GetItemActivated();
object oActTarget = GetItemActivatedTarget();
location lActTarget = GetItemActivatedTargetLocation();
object oActivator = GetItemActivator();
object oPC = oActivator;
if (~GetItemCharges(oEventItem) & 1 ) SetItemCharges(oEventItem,GetItemCharges(oEventItem)+1);
AssignCommand(oEventItem,SetIsDestroyable(FALSE));
// The target must be a certain type of object.
nType = GetObjectType(oActTarget);
if ( nType != OBJECT_TYPE_CREATURE )
{
SendMessageToPC(oActivator, "Target must be a creature!");
return;
}
// If the PC has more than 39 levels of wizard.
if ( GetLevelByclass(class_TYPE_WIZARD, oPC) > 39 )
{
// Have the item activator cast Bolt, Elements.
AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
DelayCommand(0.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.00, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.00, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.00, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
}
// Else, if the PC has more than 39 levels of sorcerer.
else if ( GetLevelByclass(class_TYPE_SORCERER, oPC) > 39 )
{
// Have the item activator cast Bolt, Elements.
AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
DelayCommand(0.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.00, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.00, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.00, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
}
// Else, if the PC has more than 39 levels of bard.
else if ( GetLevelByclass(class_TYPE_BARD, oPC) > 39 )
{
// Have the item activator cast Bolt, Elements.
AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
DelayCommand(0.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.00, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.00, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(2.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.00, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(3.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
}
// Else if the PC has more than 29 levels of wizard.
else if ( GetLevelByclass(class_TYPE_WIZARD, oPC) > 29 )
{
// Have the item activator cast Bolt, Elements.
AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
DelayCommand(0.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.00, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
}
// Else, if the PC has more than 29 levels of sorcerer.
else if ( GetLevelByclass(class_TYPE_SORCERER, oPC) > 29 )
{
// Have the item activator cast Bolt, Elements.
AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
DelayCommand(0.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.00, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
}
// Else, if the PC has more than 29 levels of bard.
else if ( GetLevelByclass(class_TYPE_BARD, oPC) > 29 )
{
// Have the item activator cast Bolt, Elements.
AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
DelayCommand(0.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.00, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(1.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
}
// Else if the PC has more than 19 levels of wizard.
else if ( GetLevelByclass(class_TYPE_WIZARD, oPC) > 19 )
{
// Have the item activator cast Bolt, Shards.
AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
DelayCommand(0.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
}
// Else, if the PC has more than 19 levels of sorcerer.
else if ( GetLevelByclass(class_TYPE_SORCERER, oPC) > 19 )
{
// Have the item activator cast Bolt, Shards.
AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
DelayCommand(0.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
}
// Else, if the PC has more than 19 levels of bard.
else if ( GetLevelByclass(class_TYPE_BARD, oPC) > 19 )
{
// Have the item activator cast Bolt, Shards.
AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_FIRE, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
DelayCommand(0.20, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_COLD, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.40, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.60, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_LIGHTNING, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
DelayCommand(0.80, AssignCommand(oActivator, ActionCastSpellAtObject(SPELLABILITY_BOLT_SHARDS, oActTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)));
}
else
{
// Send a message to the player's chat window.
SendMessageToPC(oPC, "You do not have the required class level to use this item.");
}
}
}
The Lute of Happiness:
// Lute of Happiness
#include "x2_inc_switches"
void main()
{
if(GetUserDefinedItemEventNumber() == X2_ITEM_EVENT_ACTIVATE)
{
effect eVFX;
effect eEffect;
effect eDamage;
int nType;
object oEventItem = GetItemActivated();
object oActTarget = GetItemActivatedTarget();
location lActTarget = GetItemActivatedTargetLocation();
object oActivator = GetItemActivator();
object oPC = oActivator;
if (~GetItemCharges(oEventItem) & 1 ) SetItemCharges(oEventItem,GetItemCharges(oEventItem)+1);
AssignCommand(oEventItem,SetIsDestroyable(FALSE));
// If the PC targets an object.
if ( GetIsObjectValid(oActTarget) )
{
// The target must be a certain type of object.
nType = GetObjectType(oActTarget);
if ( nType != OBJECT_TYPE_CREATURE )
{
SendMessageToPC(oActivator, "Target must be a creature.");
return;
}
// If the PC has more than 39 levels of bard.
if ( GetLevelByclass(class_TYPE_BARD, oPC) > 39 )
{
// Cause damage.
eDamage = EffectDamage(d100(10), DAMAGE_TYPE_SONIC);
eVFX = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oActTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX , oActTarget);
}
// Else, if the PC has more than 34 levels of bard.
else if ( GetLevelByclass(class_TYPE_BARD, oPC) > 34 )
{
// Cause damage.
eDamage = EffectDamage(d100(
, DAMAGE_TYPE_SONIC);
eVFX = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oActTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX , oActTarget);
}
// Else, if the PC has more than 29 levels of bard.
else if ( GetLevelByclass(class_TYPE_BARD, oPC) > 29 )
{
// Cause damage.
eDamage = EffectDamage(d100(6), DAMAGE_TYPE_SONIC);
eVFX = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oActTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX , oActTarget);
}
// Else, if the PC has more than 24 levels of bard.
else if ( GetLevelByclass(class_TYPE_BARD, oPC) > 24 )
{
// Cause damage.
eDamage = EffectDamage(d100(5), DAMAGE_TYPE_SONIC);
eVFX = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oActTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX , oActTarget);
}
// Else, if the PC has more than 19 levels of bard.
else if ( GetLevelByclass(class_TYPE_BARD, oPC) > 19 )
{
// Cause damage.
eDamage = EffectDamage(d100(4), DAMAGE_TYPE_SONIC);
eVFX = EffectVisualEffect(VFX_FNF_SOUND_BURST);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oActTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX , oActTarget);
}
else
{
// Have the item activator say something.
AssignCommand(oActivator, SpeakString("You do not have the required bard level."));
}
}
// If the PC targets a location. An epic bard song occurs for all party members.
else
{
// If the PC has more than 39 levels of bard.
if ( GetLevelByclass(class_TYPE_BARD, oPC) > 39 )
{
object oParty = GetFirstFactionMember(oPC);
while(GetIsObjectValid(oParty))
{
if(GetArea(oPC)==GetArea(oParty))
{
// Apply some effects.
eEffect = ExtraordinaryEffect(EffectAttackIncrease(5));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
eEffect = ExtraordinaryEffect(EffectACIncrease(5, AC_DODGE_BONUS));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
eEffect = ExtraordinaryEffect(EffectConcealment(50));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
eEffect = ExtraordinaryEffect(EffectDamageReduction(15, DAMAGE_POWER_PLUS_TWENTY));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
eEffect = ExtraordinaryEffect(EffectDamageShield(20, DAMAGE_BONUS_2d12, DAMAGE_TYPE_SONIC));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
eEffect = ExtraordinaryEffect(EffectImmunity(IMMUNITY_TYPE_SNEAK_ATTACK));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
eEffect = ExtraordinaryEffect(EffectSpellResistanceIncrease(50));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
eEffect = ExtraordinaryEffect(EffectTemporaryHitpoints(500));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
// Apply a visual effect.
eVFX = ExtraordinaryEffect(EffectVisualEffect(VFX_DUR_BARD_SONG));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFX, oActivator, 300.0);
eVFX = ExtraordinaryEffect(EffectVisualEffect(VFX_DUR_PROT_PREMONITION));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFX, oParty, 300.0);
}
oParty = GetNextFactionMember(oPC);
}
}
// Else, if the PC has more than 29 levels of bard.
else if ( GetLevelByclass(class_TYPE_BARD, oPC) > 29 )
{
object oParty = GetFirstFactionMember(oPC);
while(GetIsObjectValid(oParty))
{
if(GetArea(oPC)==GetArea(oParty))
{
// Apply some effects.
eEffect = ExtraordinaryEffect(EffectACIncrease(5, AC_DODGE_BONUS));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
eEffect = ExtraordinaryEffect(EffectConcealment(50));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
eEffect = ExtraordinaryEffect(EffectDamageReduction(10, DAMAGE_POWER_PLUS_SIXTEEN));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
eEffect = ExtraordinaryEffect(EffectDamageShield(10, DAMAGE_BONUS_1d10, DAMAGE_TYPE_SONIC));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
eEffect = ExtraordinaryEffect(EffectSpellResistanceIncrease(45));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
// Apply a visual effect.
eVFX = ExtraordinaryEffect(EffectVisualEffect(VFX_DUR_BARD_SONG));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFX, oActivator, 300.0);
eVFX = ExtraordinaryEffect(EffectVisualEffect(VFX_DUR_PROT_PREMONITION));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFX, oParty, 300.0);
}
oParty = GetNextFactionMember(oPC);
}
}
// Else, if the PC has more than 19 levels of bard.
else if ( GetLevelByclass(class_TYPE_BARD, oPC) > 19 )
{
object oParty = GetFirstFactionMember(oPC);
while(GetIsObjectValid(oParty))
{
if(GetArea(oPC)==GetArea(oParty))
{
// Apply some effects.
eEffect = ExtraordinaryEffect(EffectACIncrease(5, AC_DODGE_BONUS));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
eEffect = ExtraordinaryEffect(EffectConcealment(50));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
eEffect = ExtraordinaryEffect(EffectSpellResistanceIncrease(40));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oParty, 300.0);
// Apply a visual effect.
eVFX = ExtraordinaryEffect(EffectVisualEffect(VFX_DUR_BARD_SONG));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFX, oActivator, 300.0);
eVFX = ExtraordinaryEffect(EffectVisualEffect(VFX_DUR_PROT_PREMONITION));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFX, oParty, 300.0);
}
oParty = GetNextFactionMember(oPC);
}
}
else
{
// Have the item activator say something.
AssignCommand(oActivator, SpeakString("You do not have the required bard level."));
}
}
}
}
Modifié par Sadira of Tyr, 08 janvier 2013 - 11:05 .