Clockwork assembly

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

Clockwork assembly

Post by dragon slayer »

[clockwork]
{
GET=base_item
NAME=clockwork assembly
ID=0x1EA8
color=1102
weight=500
SCRIPT=6006
}
function onUseChecked ( pUser, iUsed )
{
  if( iUsed.container != null )
  {
    var numCrystals = pUser.ResourceCount( 0x1f1c );
        var numIngtIron = pUser.ResourceCount( 0x1bf2, 0x000 );
        var numIngtBrnz = pUser.ResourceCount( 0x1bf2, 0x6D6 );
        var numGears    = pUser.ResourceCount( 0x1053 );

        if( pUser.CheckSkill( 37, 600, 600 ) )
    {
        pUser.SysMessage( "You must have at least 60.0 skill in tinkering to construct a golem." );
            return false;
    }
        if( numCrystals >= 1 && numIngtIron >= 50 && numIngtBrnz >= 50 && numGears >= 5 )
        {
           pUser.UseResource( 1,  0x1f1c );
           pUser.UseResource( 50, 0x1bf2, 0x000 );
           pUser.UseResource( 50, 0x1bf2, 0x6D6 );
           pUser.UseResource( 5,  0x1053 );  
           pUser.SoundEffect( 0x241, true );
           var nSpawned = SpawnNPC( "golem", pUser.x, pUser.y, pUser.z, pUser.worldnumber );
       nSpawned.owner = pUser;
        }
        if ( numCrystals < 1 )
        {
           pUser.SysMessage( "You must have a power crystal to construct the golem." );
           return false;
        }
        if ( numIngtIron < 50 )
        {
           pUser.SysMessage( "You must have 50 iron ingots to construct the golem." );
           return false;
        }
        if ( numIngtBrnz < 50 )
        {
           pUser.SysMessage( "You must have 50 bronze ingots to construct the golem." );
           return false;
        }
        if ( numGears < 5 )
        {
           pUser.SysMessage( "You must have 5 gears to construct the golem." );
           return false;
        }
   }
   else
    pUser.SysMessage( "That must be in your pack for you to use it." );
    return false;
}
I did not post the golem it will spawn you have to create a script for it or change it to spawn something else.

known bugs
Any color of ingot is iron ingot so I'm still trying to figure out how to fix that.
Post Reply