Help: Can we edit carve/cook amount algorithm?
Help: Can we edit carve/cook amount algorithm?
Here is what I want to implement:
--When a fish is clicked on with a knife, the .js script carves ALL fish of that type (not just 1 for 4 steaks). The algorithm automatically checks the skill of the PC, and damages certain fish if appropriate.
--When cooking ribs or fish steaks the .js script will calculate the entire resource amount, cook all that can be cooked, and damage the ones that should be burnt.
--Appropriate skill gains are given just as if the PC cooked them one at a time.
Since my shard isn't intended for a compenative persistant world with thousands of PCs, it is kind of boring and redundant to have to click and cook each rib and fish individually. Fishing is fun, but carving 64 fish and then cooking 700+ steaks individually is boring and time consuming. If we could adjust the .JS scripts to handle each thing singularly that would be awesome!
Since there are 4 or 5 fish types, carving 4 or 5 fish, and then cooking all in one batch would still include the fun of UO's item-interaction but save the boredom of single cooking and/or setting up macros and waiting.
Thanks guys!
--When a fish is clicked on with a knife, the .js script carves ALL fish of that type (not just 1 for 4 steaks). The algorithm automatically checks the skill of the PC, and damages certain fish if appropriate.
--When cooking ribs or fish steaks the .js script will calculate the entire resource amount, cook all that can be cooked, and damage the ones that should be burnt.
--Appropriate skill gains are given just as if the PC cooked them one at a time.
Since my shard isn't intended for a compenative persistant world with thousands of PCs, it is kind of boring and redundant to have to click and cook each rib and fish individually. Fishing is fun, but carving 64 fish and then cooking 700+ steaks individually is boring and time consuming. If we could adjust the .JS scripts to handle each thing singularly that would be awesome!
Since there are 4 or 5 fish types, carving 4 or 5 fish, and then cooking all in one batch would still include the fun of UO's item-interaction but save the boredom of single cooking and/or setting up macros and waiting.
Thanks guys!
-
Grimson
- Developer
- Posts: 802
- Joined: Sat Jun 04, 2005 1:52 am
- Location: Germany
- Has thanked: 0
- Been thanked: 0
A simple change in the item creation part of the scripts should do this.
for example in rawfish.js change this:
to this:
Edit:
For actions that take skill it might be better to wrap the code into a while loop:
for example on cookedfish the code would look like this:
Note: This will abort when CheckSkill fails.
for example in rawfish.js change this:
Code: Select all
targSerial.amount = targSerial.amount -1;
if( targSerial.amount < 1 )
targSerial.Delete();
pUser.SoundEffect( 0x018E, true );
var itemMade = CreateDFNItem( pUser.socket, pUser, "0x097a", 4, "ITEM", true ); // makes 4 raw fish steaks
Code: Select all
var itemAmount = targSerial.amount * 4; // How many raw steaks to create
targSerial.Delete(); // Delete the fish
pUser.SoundEffect( 0x018E, true );
var itemMade = CreateDFNItem( pUser.socket, pUser, "0x097a", itemAmount, "ITEM", true ); // makes raw fish steaks
pUser.SysMessage( "You slice a fish to steaks." );
For actions that take skill it might be better to wrap the code into a while loop:
Code: Select all
while( ressource > x )
{
do it
}
Code: Select all
// remove one raw fish steak
var iMakeResource = pUser.ResourceCount( 0x097A ); // is there enough resources to use up to make it
if( iMakeResource < 1 )
{
pUser.SysMessage( "You don't seem to have any fish steaks!" );
return;
}
while( iMakeResource > 0 )
{
pUser.UseResource( 1, 0x097A ); // uses up a resource (amount, item ID, item colour)
iMakeResource = iMakeResource - 1; // decrease the resource count for the while loop
pUser.SoundEffect( 0x0021, true );
// check the skill
if( !pUser.CheckSkill( 13, 1, 300 ) ) // character to check, skill #, minimum skill, and maximum skill
{
pUser.SysMessage( "You burnt the fish to crisp." );
return;
}
var itemMade = CreateDFNItem( pUser.socket, pUser, "0x097B", 1, "ITEM", true ); // makes a fish steak
}
pUser.SysMessage( "You cook fish steaks." );
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
You could just change the script to cut up the stack all at once, and only run checkskill 20 times (or however many fish steaks there are).
(or whatever the while loop will look like)
Code: Select all
var i = 0;
while( i > item.amount )
{
checkskill stuff;
next i;
}-= Ho Eyo He Hum =-
-
Grimson
- Developer
- Posts: 802
- Joined: Sat Jun 04, 2005 1:52 am
- Location: Germany
- Has thanked: 0
- Been thanked: 0
This way he will also get steaks when checkskill actually failedXuri wrote:You could just change the script to cut up the stack all at once, and only run checkskill 20 times (or however many fish steaks there are).(or whatever the while loop will look like)Code: Select all
var i = 0; while( i > item.amount ) { checkskill stuff; next i; }
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
Oops, that's right. Didn't think of that
Heh
;P
Code: Select all
var i = 0;
var successAmount = 0;
while( i > item.amount )
{
if( checkskill stuff is true )
successAmount++;
next i;
}
CreateDFNItem( fishsteak, successAmount )
-= Ho Eyo He Hum =-
-
jr
- UOX3 Newbie
- Posts: 15
- Joined: Mon Mar 07, 2005 1:40 pm
- Location: Kiel
- Has thanked: 0
- Been thanked: 0
Actually I think it would be a good idea to encapsulate this loop into a new CheckSkill method (available to C++ and JS) that takes an additional count parameter and returns the number of successes.Xuri wrote:Code: Select all
var i = 0; var successAmount = 0; while( i > item.amount ) { if( checkskill stuff is true ) successAmount++; next i; } CreateDFNItem( fishsteak, successAmount )
-
Maarc
- Developer
- Posts: 576
- Joined: Sat Mar 27, 2004 6:22 am
- Location: Fleet, UK
- Has thanked: 0
- Been thanked: 0
- Contact:
Shunting out a function like this to JS/C++ wouldn't be very hard, I just wonder about the pay off. Would there really be that many instances where this needs to occur? If it will be used fairly frequently, I could understand, but I don't know how often it would be. If you think it'll be frequent, feel free to sing out, I rarely code in JS myself 
-
jr
- UOX3 Newbie
- Posts: 15
- Joined: Mon Mar 07, 2005 1:40 pm
- Location: Kiel
- Has thanked: 0
- Been thanked: 0
I'm not doing that much skill coding either, but while I was playing around with mining I was stumbling about smelting which currently smelts the complete pile, but only does a single skill check (and destroys half the ore if the skill check fails). Therefore I was already thinking about this problem of repeated skill checks when I saw this topic. The pay off would be that all mass producing actions would use the same skill check semantics that could be centrally changed. Actually I think that mass producing is different enough from 'lovingly' manipulating single items that it would be a good idea to have the possibility to introduce a bonus (powergaming shard) or penalty (roleplaying shard) globally to mass producing.Maarc wrote:Shunting out a function like this to JS/C++ wouldn't be very hard, I just wonder about the pay off. Would there really be that many instances where this needs to occur? If it will be used fairly frequently, I could understand, but I don't know how often it would be. If you think it'll be frequent, feel free to sing out, I rarely code in JS myself