Page 1 of 1
Kindling
Posted: Fri Dec 16, 2011 10:32 am
by John
I've noticed that when I chop a tree the logs are put into my backpack. Then when I make kindling each one is deducted from the total logs I had.
Example: I chop trees until I have 40 logs. I make a kindling and now I have 39 logs. This works like it is suppose to.
However, when i make several kindling and they stack into a pile.. a problem occurs when i double click. It should deduct one from the stack and place a campfire on the ground. Instead it ignites the entire stack and places a single campfire on the ground.
Example: I have a stack of 20 kindling. I double click the stack and all are ignited. It should act like.. doubleclick 19, doubleclick 18, ... etc.
I'm still learning javascript. I've mostly been focusing on dfndata. But I wanted to point out that kindling stacks are not working correctly.
Posted: Fri Dec 16, 2011 6:04 pm
by dragon slayer
here is my fix for that but puts the hole stack of kindling under the fire lol.
Code: Select all
if( iUsed.amount > 1 )
iUsed.amount = (iUsed.amount-1);
var eKindling = CreateDFNItem( pUser.socket, pUser, "0x0de3", 1, "ITEM", false );
if( eKindling && eKindling.isItem )
eKindling.movable = 2;
eKindling.dir = 29;
eKindling.StartTimer( 60000, 1, true ); //Campfire burns for 60 second
pUser.SysMessage( GetDictionaryEntry( 1765, pSock.Language ));
still not sure how to keep the stack in pack when fire is created
Posted: Sat Dec 17, 2011 3:18 am
by dragon slayer
here you go john i fixed the kindling problem now
all works great
Code: Select all
function onUseChecked( pUser, iUsed )
{
var pSock = pUser.socket;
var CampingAttempt = pUser.skills.camping / 10;
var Success = RandomNumber( 0, 100 );
if( pSock && iUsed && iUsed.isItem )
{
//Check to see if it's locked down
if( iUsed.movable == 2 || iUsed.movable == 3 )
{
socket.SysMessage( GetDictionaryEntry( 774, socket.Language ) ); //That is locked down and you cannot use it
return false;
}
if( iUsed.amount > 1 )
iUsed.amount = (iUsed.amount-1);
else
iUsed.Delete();
var eKindling = CreateDFNItem( pUser.socket, pUser, "0x0de3", 1, "ITEM", false );
if( eKindling && eKindling.isItem )
eKindling.movable = 2;
eKindling.dir = 29;
eKindling.StartTimer( 60000, 1, true ); //Campfire burns for 60 second
pUser.SysMessage( GetDictionaryEntry( 1765, pSock.Language ));
}
return false;
}
Posted: Sat Dec 17, 2011 4:10 am
by John
Nice! I will try this out. Thanks

Posted: Sat Dec 17, 2011 4:40 am
by John
Found a couple problems. It does subtract 1 from a pile now which is awesome. But now the camping skill don't raise at all. When skill raises should get random str, dex, int but it don't work now. Also, when I double click a kindling, it always says I successfully create a campfire but does not give the message about waiting a few seconds to secure camp nor does it give message that says camp is secure.
The default kindling script raised camping skill, stats, and displayed the two securing camp messages. I hate to ask this but could you check why its not raising skill, stats, or giving those messages? I do want to say thanks for scripting the subtract 1 from pile that works awesome.
I tested with 50 kindling and it did subtract one by one down to none but I had the skill window up and camping skill stayed at 20.1. Strength stayed at 60, Dex at 10, Int at 10.
Posted: Sat Dec 17, 2011 5:57 am
by dragon slayer
My bad forgot to readd skill check when i started to redo the script
Posted: Sat Dec 17, 2011 6:43 am
by dragon slayer
here you go john with skill check now :)
Code: Select all
function onUseChecked( pUser, iUsed )
{
var pSock = pUser.socket;
var CampingAttempt = pUser.skills.camping / 10;
var Success = RandomNumber( 0, 100 );
if( pSock && iUsed && iUsed.isItem )
{
//Check to see if it's locked down
if( iUsed.movable == 2 || iUsed.movable == 3 )
{
socket.SysMessage( GetDictionaryEntry( 774, socket.Language ) ); //That is locked down and you cannot use it
return false;
}
if( pUser.CheckSkill( 10, 0, 1000 ) )
{
if( iUsed.amount > 1 )
iUsed.amount = (iUsed.amount-1);
else
iUsed.Delete();
var eKindling = CreateDFNItem( pUser.socket, pUser, "0x0de3", 1, "ITEM", false );
if( eKindling && eKindling.isItem )
eKindling.movable = 2;
eKindling.dir = 29;
eKindling.StartTimer( 15000, 1, true );
pUser.SysMessage( GetDictionaryEntry( 1765, pSock.Language ));
}
else
pUser.SysMessage( GetDictionaryEntry( 1764, pSock.Language ));
}
return false;
}
I'm still working on the camp secure msgs :)
Posted: Sat Dec 17, 2011 7:21 am
by John
You have no idea how happy this kindling script makes me
I know many don't use camping because most use inns to logout safely, but I've always had fun playing Rangers in UO. Thanks for this and the work you did on bedroll. Much appreciated!
Posted: Sun Dec 18, 2011 3:23 am
by dragon slayer
you could always make inns not insta logout

me I'm working on a js script to make it so if you log out at a inn it costs you 1k gold

Posted: Sun Dec 18, 2011 3:46 am
by John
I found another problem with the kindling script. After a campfire burns out and you see the ashes on ground, they don't decay or delete themselves.. where ever you placed a campfire the ashes will remain there until you manually 'remove them. They should remove themselves shortly after they burn out.
I didnt notice this until i was practicing camping in yew. I lit campfires from the healer shop to the archery shop and went off to chop wood, when i returned 10 minutes later the ashes where still on ground. I left server running and walked away from computer for about 10 additional minutes to fix me something to eat and when i returned the ashes were still on ground.. a line of 50 of them lol. Some reason the ashes arent decaying.
Posted: Mon Dec 19, 2011 1:29 am
by dragon slayer
Ill fix that and post fix for you

Posted: Mon Dec 19, 2011 2:17 am
by John
Thanks
Sorry, I'm not trying to be annoying. Your work is quite awesome. I was just posting any bugs I find in scripts. No hurry and many thanks in advance.
Posted: Mon Dec 19, 2011 3:22 am
by dragon slayer
heck I'm not a dev here I'm just trying to help hehe xuir is the main dev
I'm just glad i could be of some help since xuri is a busy guy
But bug you found maybe a decay timer bug on all items.