Item based chivalry

Need help with your JScripts? Got questions concerning the DFNs? Come forward, step inside :)
Post Reply
dracuskaos
UOX3 Neophyte
Posts: 35
Joined: Sat Oct 25, 2008 3:54 am
Has thanked: 0
Been thanked: 0

Item based chivalry

Post by dracuskaos »

--------edit--------
sorry I forgot, this is a 'setscptrig to a chivalry spellbook I had to type 'add 0x2252 exactly or i got a piece of trim, it was weird.
--------edit-2-----
Code change, I added skillcheck and mantras. There are no actions for Chivalry so I removed Doaction lines.
Added sound effects and proper staticeffects
----end-edit-summary-------

I'm really new to this kind of code. so forgive me. I am offering what I've got as a base for the more learned to work with. I'll keep updating it as I get further along.

So far only cleanse by fire and close wounds work. and they aren't very good. I need to figure out what all the hooks and things are. :) if nothing else it's a real pretty Chiv book, all I need is to figure out pages and how to make each tile act as an individual spell rather than needing all the extra buttons.

Please forgive my coding, I'm trying to learn to ice skate while shoveling snow if you know what I mean.

Code: Select all

//Paladin Spellbook version 0.1.2
//Dracuskaos 2008


function onUseChecked( pUser, iUsed )
{
	pUser.SoundEffect( 0x58, true );//make some noise people!
        var myGump = new Gump; // create a new gump
	myGump.AddBackground( 57,50, 90, 215, 2600 ); // add an automic scaled background
	myGump.AddGump( 0, 0, 0x2b01 ); // add the book backdrop
	myGump.AddButton( 71, 227, 0xF7, 1, 0, 1 ); // add the "okay" button - Xuri

        myGump.AddGump( 56, 10, 0x5100 ); // add cleanse by fire tile
	myGump.AddRadio( 102, 10, 0x04b9, 0, 0 ); // add a dinky button
	myGump.AddText( 102, 35, 5, "Cleanse by fire" ); // add text, gets assigned TextID 0

        myGump.AddGump( 56, 55, 0x5101 ); // add close wounds tile
	myGump.AddRadio( 102, 55, 0x04b9, 0, 1 ); // add a dinky button
	myGump.AddText( 102, 80, 5, "Close wounds" ); // add text, gets assigned TextID 0

	myGump.AddText( 102, 125, 5, "Consecrate" ); // add text, gets assigned TextID 0
        myGump.AddGump( 56 , 100, 0x5102 ); // add consecrate weapon tile
	myGump.AddRadio( 102, 100, 0x04b9, 0, 2 ); // add a dinky button

        myGump.AddGump( 56 , 145, 0x5103 ); // add dispel evil tile
	myGump.AddRadio( 102, 145, 0x04b9, 0, 3 ); // add a dinky button
	myGump.AddText( 102, 170, 5, "Dispel Evil" ); // add text, gets assigned TextID 0

        myGump.AddGump( 216, 10, 0x5104 ); // add Divine Fury Tile
	myGump.AddRadio( 262, 10, 0x04b9, 0, 4 ); // add a dinky button
	myGump.AddText( 262, 35, 5, "Divine Fury" ); // add text, gets assigned TextID 0

        myGump.AddGump( 216, 55, 0x5105 ); // add Enemy of one tile
	myGump.AddRadio( 262, 55, 0x04b9, 0, 5 ); // add a dinky button
	myGump.AddText( 262, 80, 5, "Enemy of One" ); // add text, gets assigned TextID 0

        myGump.AddGump( 216, 100, 0x5106 ); // add Holy light tile
	myGump.AddRadio( 262, 100, 0x04b9, 0, 6 ); // add a dinky button
	myGump.AddText( 262, 125, 5, "Holy Light" ); // add text, gets assigned TextID 0

        myGump.AddGump( 216, 145, 0x5107 ); // add Noble sacrifice tile
	myGump.AddRadio( 262, 145, 0x04b9, 0, 7 ); // add a dinky button
	myGump.AddText( 262, 170, 5, "Noble Sacrifice" ); // add text, gets assigned TextID 0
 
        //myGump.AddGump( 216, 145, 0x5108 ); // add Revome Curse Tile
	//myGump.AddRadio( 262, 145, 0x04b9, 0, 8); // add a dinky button
	//myGump.AddText( 262, 170, 5, "Remove Curse" ); // add text, gets assigned TextID 0
 
        //myGump.AddGump( 216, 145, 0x5109 ); // add Sacred Journey Tile
	//myGump.AddRadio( 262, 145, 0x04b9, 0, 9 ); // add a dinky button
	//myGump.AddText( 262, 170, 5, "Sacred Journey" ); // add text, gets assigned TextID 0

	//myGump.AddRadio( 101, 30, 2152, 0, 0 ); //RadioButton with ID 0
	//myGump.AddRadio( 263, 30, 2152, 0, 1 ); //RadioButton with ID 1
	myGump.Send( pUser.socket ); // send this gump to client now
	myGump.Free(); // clear this gump from uox-memory
	return false;
}

function onGumpPress( pSock, pButton, gumpData )
{
	var pUser = pSock.currentChar;
	switch(pButton)
	{
		case 0:
			// abort and do nothing
			break;
	        case 1:
			var OtherButton = gumpData.getButton(0);
			switch(OtherButton)
			{ 
				case 0:
					var pUP=pUser.poison
                                        var suceeded = pUser.CheckSkill( 51, 50, 1000 );
                                        if (suceeded)
   
                                        {if( pUser.mana < 10 )
                                             {
                                             pUser.TextMessage( "insufficient mana.", 0x000 );
                                             break;
                                             }
                                        else
                                             {
                                             pUser.TextMessage( "Expor Flamus", true , 0x0480);
                                             pUser.MagicEffect( 51 )//flamestrike
                                             pUser.MagicEffect( 4 )//sparklies
                                             pUser.SoundEffect( 0x01E0, true );//cure
                                             pUser.SoundEffect( 0x0209, true );//flame strike
                                             //pUser.mana=pUser.mana-10; //these work but kill the animation
                                             //pUser.SetPoisoned(0);     //don't know why
                                             //pUser.poison=0            //gonna change it anyway

                                             }
                                        break;
                                        }
                                        else
                                        var soundID;
                                        soundID=0x0046;
                                        pUser.SoundEffect( soundID, true );
                                        break;   
            			case 1:
					var suceeded = pUser.CheckSkill( 51, 0, 1000 );
                                        if (suceeded)
   
                                        {if( pUser.mana < 10 )
                                             {
                                             pUser.TextMessage( "insufficient mana.",true , 0x0000 );
                                             break;
                                             }
                                        else
                                             {
                                             var soundID;
                                             soundID=0x0202;
                                             pUser.SoundEffect( soundID, true );
                                             pUser.StaticEffect( 0x373A, 0, 15 )
                                             pUser.health=pUser.health+(pUser.skills.chivalry/10+

(pUser.karma*.001));
                                             pUser.mana=pUser.mana-10;
                                             }
                                        break;
                                        }
                                        else
                                        var soundID;
                                        soundID=0x0046;
                                        pUser.SoundEffect( soundID, true );
                                        break;

				case 2:
					pUser.TextMessage( "Consecrus Arma.",true , 0x0480);
					var suceeded = pUser.CheckSkill( 51, 150, 1000 );
                                        if (suceeded)
                                        {
                                        }
					break;

				case 3:
					pUser.TextMessage( "Dispiro Malas",true , 0x0480);
					var suceeded = pUser.CheckSkill( 51, 350, 1000 );
                                        if (suceeded)
                                        {
                                        }
					break;

				case 4:
					pUser.TextMessage( "Divinus Furis",true , 0x0480);
					var suceeded = pUser.CheckSkill( 51, 250, 1000 );
                                        if (suceeded)
                                        {
                                        }

				case 5:
					pUser.TextMessage( "Forul Solum",true , 0x0480);
					var suceeded = pUser.CheckSkill( 51, 450, 1000 );
                                        if (suceeded)
                                        {
                                        }
					break;

				case 6:
					pUser.TextMessage( "Augus Luminos",true , 0x0480);
					var suceeded = pUser.CheckSkill( 51, 550, 1000 );
                                        if (suceeded)
                                        {
                                        }
					break;

				case 7:
					pUser.TextMessage( "Dium Prostra",true , 0x0480);
					var suceeded = pUser.CheckSkill( 51, 650, 1000 );
                                        if (suceeded)
                                        {
                                        }
					break;

				case 8:
					pUser.TextMessage( "Extermo Vomica",true , 0x0480);
					var suceeded = pUser.CheckSkill( 51, 550, 1000 );
                                        if (suceeded)
                                        {
                                        }
					break;

				case 9:
					pUser.TextMessage( "Sanctum Viatas",true , 0x0480);
					var suceeded = pUser.CheckSkill( 51, 150, 1000 );
                                        if (suceeded)
                                        {
                                        }
					break;

			}
			break;
	}
}


Based on the Gump Example code, Chiv layout is original Dracuskaos 2008
Post Reply