UOX3 Script Engine

API and Event handling

Magic Related Functions

CastSpell
Prototype
pUser.CastSpell( spellNum, ( directCast) );
PurposeCauses character to cast spellNum. Character can be an NPC or PC. spellNum can be any valid spellNum from spells.dfn. The optional boolean parameter directCast can be used to make the character automatically cast the spell at their current target (if spell is targeted)
Example of Usage
// Player casts recall spell
pUser.CastSpell( 32 );

// NPC casts lightning bolt at their current target
myNPC.CastSpell( 30 );

 

HasSpell
Prototype
bool HasSpell( spellNum );
PurposeScans through a spellbook's content to see if it contains spellNum, or through a player's backpack to see if they have a spellbook with spellNum in the first spellbook found
Example of Usage
// Check character's inventory for a spellbook with specified spell
var bHasSpell = pUser.HasSpell( 0 );

// Check directly if spellbook has specified spell
var bHasSpell = mySpellbook.HasSpell( 0 );

 

AddSpell
Prototype
AddSpell( spellNum );
PurposeAdds spell spellNum to first spellbook encountered in player's backpack
Example of Usage
pUser.AddSpell( 0 );

 

RemoveSpell
Prototype
RemoveSpell( spellNum );
PurposeRemoves spellNum from specified spellbook, or from first spellbook encountered in player's spellbook
Example of Usage
// Remove spell directly from spellbook
mySpellbook.RemoveSpell( 0 );

// Remove spell from first spellbook found in player's backpack
pUser.RemoveSpell( 0 );

 

SpellFail
Prototype
SpellFail();
PurposeMakes the sounds and noises associated with spell failure for character. Takes no arguments.
Example of Usage
pUser.SpellFail();

 

©Copyright 2000-2001 WWW.UOX3.NET (Daniel Stratton/Matthew Randall)