Books of Golems

Got any custom JavaScript additions/tweaks you think other people would like to see? Post 'em here!
Post Reply
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

Books of Golems

Post by dragon slayer »

Okay so this is just two of many books i will be creating to mimic DnD
here is the Flesh Golem and Clay Golem


golems.dfn
[claygolem]
{
NAME=a clay golem
ID=0x000D
SKIN=0x045d
DIRECTION=N
BACKPACK
STR=200 255
DEX=200 255
INT=2571 92
KARMA=0
FAME=0
MAGICRESISTANCE=700 950
TACTICS=800 990
MACEFIGHTING=1000
DAMAGE=8 35
DEF=28
FX1=-1
FY1=-1
FZ1=-1
FX2=20
TOTAME=1100
}

[fleshgolem]
{
NAME=a flesh golem
ID=0x0190
SKIN=0x83ea
DIRECTION=N
BACKPACK
STR=200 255
DEX=200 255
INT=2571 92
KARMA=0
FAME=0
MAGICRESISTANCE=1000
TACTICS=800 990
MACEFIGHTING=800 990
DAMAGE=8 35
DEF=20
FX1=-1
FY1=-1
FZ1=-1
FX2=20
TOTAME=1100
}
summonbooks.dfn
[bookclaygolem]
{
get=base_item
name=a magical book
name2=Book of Clay Golem
id=0x0e3b
color=0x045d
decay=1
script=5048
}

[bookfleshgolem]
{
get=base_item
name=a magical book
name2=Book of Flesh Golem
id=0x0e3b
color=0x83ea
decay=1
script=5047
}

[clay]
{
get=base_item
name=clay
id=0x26b8
color=0x045d
pileable=1
amount=1
decay=1
}
fleshgolem.js
function onUseChecked ( pUser, iUsed )
{
  if( iUsed.container != null )
  {
       var numBrain = pUser.ResourceCount( 0x1cf0 );
       var numHeart = pUser.ResourceCount( 0x1ced, 0x000 );
       var numLegs = pUser.ResourceCount( 0x1cec, 0x000 );
       var numArms = pUser.ResourceCount( 0x1ce5 );

       if( pUser.CheckSkill( 25, 600, 600 ) )
       {
            pUser.SysMessage( "You must have at least 60.0 skill in magery to construct a flesh golem." );
            return false;
       }
       if( numBrain >= 1 && numHeart >= 1 && numLegs >= 2 && numArms >= 2 )
       {
           pUser.UseResource( 1,  0x1cf0 );
           pUser.UseResource( 1, 0x1ced, 0x000 );
           pUser.UseResource( 2, 0x1cec, 0x000 );
           pUser.UseResource( 5,  0x1ce5 );  
           pUser.SoundEffect( 0x241, true );
           var nSpawned = SpawnNPC( "fleshgolem", pUser.x, pUser.y, pUser.z, pUser.worldnumber );
           nSpawned.owner = pUser;
       }
       if ( numBrain < 1 )
       {
          pUser.SysMessage( "You must have a brain to construct the flesh golem." );
           return false;
       }
       if ( numHeart < 1 )
       {
           pUser.SysMessage( "You must have a heart to construct the flesh golem." );
           return false;
       }
       if ( numLegs < 2 )
       {
           pUser.SysMessage( "You must have 2 legs to construct the flesh golem." );
           return false;
       }
       if ( numArms < 2 )
       {
           pUser.SysMessage( "You must have 2 arms to construct the flesh golem." );
           return false;
       }
   }
   else
   pUser.SysMessage( "That must be in your pack for you to use it." );
    return false;
}
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

Post by dragon slayer »

claygolem.js

Code: Select all

function onUseChecked ( pUser, iUsed ) 
{ 
  if( iUsed.container != null ) 
  { 
       var numClay = pUser.ResourceCount( 0x26b8 ); 

       if( pUser.CheckSkill( 25, 600, 600 ) ) 
       { 
            pUser.SysMessage( "You must have at least 60.0 skill in magery to construct a clay golem." ); 
            return false; 
       } 
       if( numClay >= 50 ) 
       { 
           pUser.UseResource( 1,  0x26b8 ); 
           pUser.SoundEffect( 0x241, true ); 
           var nSpawned = SpawnNPC( "claygolem", pUser.x, pUser.y, pUser.z, pUser.worldnumber ); 
           nSpawned.owner = pUser; 
       } 
       if ( numClay < 50 ) 
       { 
          pUser.SysMessage( "You must have 50 Clay to construct the clay golem." ); 
           return false; 
       }
   } 
   else 
   pUser.SysMessage( "That must be in your pack for you to use it." ); 
    return false; 
}
Post Reply