messing aorund with carve need help

Need help with your JScripts? Got questions concerning the DFNs? Come forward, step inside :)
Post Reply
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

messing aorund with carve need help

Post by dragon slayer »

Okay so i took copy of sowrds.js and made a texidemy.js but I'm hvaing problems definning what creatures i want carved to give the proper deed

say a orc

when it dies i want to beable to carve its dead body but not sure what this code does

Code: Select all

		if( (ourObj.morey>>24) == 0 )
		{
			var part1 = 1;
			var part2 = ourObj.morey>>16;
			var part3 = ourObj.morey>>8;
			var part4 = ourObj.morey%256;

			ourObj.morey = (part1<<24) + (part2<<16) + (part3<<8) + part4;
			if( part2 != 0 || ourObj.carveSection != -1 )
				ourObj.Carve( socket );
		}

i add this after all that

Code: Select all

			else if( tileID == 0x0011 )
			{
		CreateBlankItem( socket, mChar, 4, "raw fish steak", 0x097A, 0x0000, "ITEM", true );
	        mChar.SysMessage( "just testing." );
			}

I'm not sure what I'm doing wrong but doesn't seem to want to carve up this dead body of this orc..
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

I think you will find DFNDATA\CARVE\carve.dfn interesting :)

You shouldn't have to modify the swords.js script (or create a new one) if you just want specific items to appear on the corpses of specific creatures when carving up their body.

Basically just create a new [CARVE #]-section (or modify an existing one) in the above mentioned DFN file, throw in the items you want to spawn, and an optional amount, like this:
ADDITEM=DFNitemID,amount

Then add CARVE=# tag to your NPC.
-= Ho Eyo He Hum =-
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 »

yes i figured that much hehe I'm sorry i didnt post what i was trying to do

Okay i want to beable to click on a orcs dead corpse with a new tool and make it use some boards and that orcs body and create a trophy deed of that orcs head.
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

The problem is that all corpses share the same tileID in-game, while the actual "corpse item ID" is set in the amount-tag. So instead of trying to check if tileID is 0x0011, you should check if myTarget.amount is 0x0011 (or possibly the decimal version of the ID - 17).

Basically you want something like this before the morey-check:

Code: Select all

mChar.DoAction( 0x20 );
[color=red]if( ourObj.amount == 17 ) // or 0x0011, not sure which will work
{
	CreateBlankItem( socket, mChar, 4, "raw fish steak", 0x097A, 0x0000, "ITEM", true ); 
	mChar.SysMessage( "just testing." );
}[/color]
if( (ourObj.morey>>24) == 0 )
{
...<snip>
-= Ho Eyo He Hum =-
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 »

ah okay hehe
Post Reply