PenUltima Online

It is currently Thu Aug 21, 2008 11:36 pm

All times are UTC - 4 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Custom logs
PostPosted: Sun Jul 02, 2006 5:28 pm 
Offline

Joined: Thu Feb 02, 2006 5:41 pm
Posts: 1094
Location: Southern Central USA
Kudos to the Devs for adding this forum. It has been long needed.

Here is a method for adding custom logs to your shard. It assumes that you are using the latest official POL Distro. At the time of writing this article that was POL 95 Distro. It also assumes you have some familiarity with eScript and editing/compiling files.

I edited this together from a previous post I made and cleaned up the code a tiny bit. I have tried to make sure there are no errors but there may be some.

Here goes...

One of the first things you will have to do is assign a few new objtypes for the new logs you are adding. Remember to assign numbers greater than 0x3FFF but less than 0xC000.

Entry for itemdesc.cfg file in \pol\pkg\skills\lumberjacking (be sure to change Item number to an item not in use; see objtypes.txt in main POL directory for

items currently in use. Should be 0x4000 or greater):

Code:
Item 0x6000
{
    Name                yewlog
    desc                yew log%s%
    graphic             0x1bdd
    color               0x002c
    Weight      1/2
    VendorSellsFor      10
    VendorBuysFor       1
}


I rely on the basic entry for wood.cfg in the \pol\regions\ to manage my wood resources rather than try to enter a cfg file for each specific type of wood.

So there is no need for any special resource management with my method. You could make entries for each type if you wanted say Yew trees to give more wood than regular trees. They are bigger than regular trees after-all but I was lazy :).


Open objtypes.inc located in \pol\scripts\includes and add the follwing entry in that file:

Code:
// Log types
const UOBJ_WOOD_YEW             := 0x6000; // change to your objtype for Yew logs
const UOBJ_WOOD_ASH             := 0x6001; // Change to your objtype for Ash logs
const UOBJ_WOOD_CYPRESS         := 0x6002; // Change to your objtype for Cypress logs
const UOBJ_WOOD_OAK             := 0x6003; // Change to your objtype for Oak logs

You can add more types for other woods that may exist or that you create.


Here is my version of the POL 95 lumberjack script modified with some of my original work. I have only provided the example of Yew logs here as a new item but if you look at what I have done you can see how to create more based on the treetype chopped. See the Do_Chops function to see where I modified the

script.

Code:
use cfgfile;
use uo;
use os;
use util;

include "include/client";
include "include/attributes";
include "include/string";
include "include/objtype";
include "include/canAccess";
include "include/utility";
include "include/dist";
include "include/toolWear";
include "include/noto";

const UACTION_CHOP := 0x0d;
const FX_POISON_GAS := 0x113a;
var bowcraftconfigfile := ReadConfigFile("::bowcraft");
var mex;
var mey;

program use_axe(me, axe)
  EraseObjProperty(me, "IsMeditating");
  EraseObjProperty(me, "HealTimer");
  if(!can_access(me, axe))
    return;
  endif
  if(!ReserveItem(axe))
    return;
  endif
  if(!IsAxEquipped(me, axe))
    SendSysMessage(me,"You have to equip that to lumberjack!");
    return;
  endif
  var tree := TreeNearby(me, axe);
  if(!tree)
    return;
  endif
  SendSysMessage(me, "You begin chopping...");
  var checker := 0;
  mex := me.x;
  mey := me.y;
  var mount;
  repeat
    mount := GetEquipmentByLayer(me, 25);
    if(mount)
      SendSysMessage(me,"you cannot chop wood while on horseback.");
      return;
    endif
    if(!axe)
      return;
    endif
    PerformAction(me, UACTION_CHOP);
    PlaySoundEffect(me, SFX_SKILL_LUMBERJACK);
    sleepms(2500);
    checker := Do_Chops(me, axe, tree);
  until(checker == 1);
endprogram


function Do_Chops(me, axe, tree)
  var difficulty := GetHarvestDifficulty("wood", tree.x, tree.y, tree.objtype, me.realm);
  if(difficulty == error)
    SendSysMessage(me, "There's not enough wood here to chop");
    return 1;
  endif
  if((me.x != mex) || (me.y != mey))
    SendSysMessage(me,"You stop chopping.");
    return 1;
  endif
  var points := CInt((GetEffectiveSkill(me, SKILLID_LUMBERJACKING) * 2) + 10);

// This is where I modified the original lumberjack script.
// I do a CheckSkill with my new definition of dificulty (the var diffi) based on the type of tree being chopped.
  var diffi;
    case (tree.objtype)
      0x12b8 : diffi := 85; // yew tree
      0x12b9 : diffi := 85; // yew tree
      0x12ba : diffi := 85; // yew tree
      0x12bb : diffi := 85; // yew tree
      0x0cdd : diffi := 75; // Oak tree
      0x0cda : diffi := 75; // Oak tree
      0x0ce6 : diffi := 60; // Cypress tree
      0x0c9e : diffi := 40; // Ash tree
      default: diffi := 0;  // default diffi level for logs not defined. If you want a min skill to be able to harvest logs change the '0' to some other

number.
    endcase;
  // The following 'if' statement will prevent any skill gains, and harvesting logs, until your skill is close to diffi.
  // If you changed the default value from 0 in the above 'case' statement you might want to consider removing the 'if' statement.
  if (GetAttribute (me, "Lumberjacking") < diffi)
      SendSysMessage(me, "You fail to find any usable wood here.");
      return 1;
  endif
// OK here is where I am going to add my custom log case statement
    var logtype := 0x1bdd; // Defaukt to regular logs if not in case.

    case (tree.objtype)
      0x12b8 : logtype := 0x6000; // yew log
      0x12b9 : logtype := 0x6000; // yew log
      0x12ba : logtype := 0x6000; // yew log
      0x12bb : logtype := 0x6000; // yew log
      default: logtype := 0x1bdd; // Regular plain old logs
    endcase;
// End of my modification (sort of)
  if(CheckSkill(me, SKILLID_LUMBERJACKING, diffi, points))
    var wood_amount := HarvestResource( "wood", tree.x, tree.y, 1, 10, me.realm );
    if(wood_amount == 0)
      SendSysMessage(me, "There's not enough wood here to chop.");
      return 1;
    endif
    if(!CreateItemInBackpack(me, logtype, wood_amount))
      SendSysMessage(me, "Your backpack is too full.");
      return 1;
    else
      SendSysMessage(me, "You put some logs in your backpack");
      CheckToolWear (me, axe, SKILLID_LUMBERJACKING);
      return 0;
    endif
  else
    SendSysMessage(me, "You fail to get any usable wood.");
    return 0;
  endif
endfunction

function TreeNearby(me, axe)
  SendSysMessage( me, "Select something to chop." );
  var tree := TargetCoordinates( me );
  if(!tree)
    SendSysMessage(me, "Cancelled");
    return 0;
  endif
  var distt := coordist( me.x, me.y, tree.x, tree.y );
  if(distt > 1 )
    if(!tree.item.container)
      SendSysMessage(me,"That is too far away");
      return 0;
    endif
  endif
  if(is_furniture(tree.item.objtype, tree.item))
    chopfurniture(me, tree.item);
    return 0;
  elseif(is_tree(tree.objtype))
    var difficulty := GetHarvestDifficulty( "wood", tree.x, tree.y, tree.objtype, me.realm );
    if(difficulty == error)
      SendSysMessage(me, "There's not enough wood here to chop.");
      return 0;
    endif
    return tree;
  else
    use_blade(me, axe, tree.item);
    return 0;
  endif
endfunction

function is_furniture(theobj, thing)
  var miscobjtypes := { 0x7007, 0xa30, 0xa34, 0xa38, 0xfae, 0x9e40};
  if((theobj >= 0x9a8) && (theobj <= 0x9ab))
    return 1;
  elseif((theobj >= 0xa2a) && (theobj <= 0xa2c))
    return 1;
  elseif((theobj >= 0xa4c) && (theobj <= 0xa53))
    return 1;
  elseif((theobj >= 0xa97) && (theobj <= 0xa9e))
    return 1;
  elseif((theobj >= 0xb2c) && (theobj <= 0xb40))
    return 1;
  elseif((theobj >= 0xb49) && (theobj <= 0xb90))
    return 1;
  elseif((theobj >= 0xe3c) && (theobj <= 0xe43))
    return 1;
  elseif((theobj >= 0xe7c) && (theobj <= 0xe80))
    return 1;
  elseif((theobj >= 0xf65) && (theobj <= 0xf77))
    return 1;
  elseif(theobj in miscobjtypes)
    return 1;
  elseif(GetObjProperty(thing, "ItemsCreatedSerials"))
    return 1;
  else
    return 0;
  endif
endfunction

function is_tree(theobj)
  if((theobj >= 0x0c99) && (theobj <= 0x0cea))
    return 1;
  elseif((theobj >= 0x0cf3) && (theobj <= 0x0d03))
    return 1;
  elseif((theobj >= 0x0d41) && (theobj <= 0x0dab))
    return 1;
  elseif((theobj >= 0x12b6) && (theobj <= 0x12c7))
    return 1;
  elseif((theobj >= 0x0d37) && (theobj <= 0x0d38))
    return 1;
  elseif((theobj == 0x0c9e) || (theobj == 0x0ca8) || (theobj == 0x0caa) || (theobj == 0x0cab))
    return 1;
  else
    return 0;
  endif
endfunction


function IsAxEquipped(me,axe)
  if((!Accessible(me,axe)) || (Distance(me, axe) > 1))
    return 0;
  endif
  foreach item in ListEquippedItems(me)
    if (axe.serial == item.serial )
      return 1;
    endif
  endforeach
  return EquipItem(me, axe );
endfunction

function chopfurniture(me, theobj)
  if(!can_access(me, theobj))
    return;
  endif
  var sign;
  if(GetObjProperty(theobj, "lockeddown") || GetObjProperty(theobj, "secure"))
    SendSysMessage(me, "You cannot destroy secure or locked down items.");
    return;
  endif
  if(theobj.objtype == 0x7007)
    var houseserial := GetObjProperty(theobj, "houseserial");
    sign := SystemFindObjectBySerial(houseserial);
    if(GetObjProperty(sign, "barrelserial") == theobj.serial)
      EraseObjProperty(sign, "barrelserial");
      SendSysMessage(me, "you cannot destroy that while it is locked down.");
      return;
    endif
  endif
  if(!Accessible(me, theobj))
    SendSysMessage(me, "you cant reach that");
    return;
  endif
  if(me.multi)
    if(GetObjProperty((me.multi), "ownerserial") != me.serial)
      var house := me.multi;
      foreach thing in (house.components)
        if((thing.objtype == 0x0bd0) || (thing.objtype == 0x0bd2))
          sign := thing;
          break;
        endif
      endforeach
      var coowner := 0;
      var coownerlist := GetObjProperty(sign, "coownerlist");
      foreach thing in coownerlist
        if(thing == me.serial)
          coowner := 1;
          break;
        endif
      endforeach
      if(!coowner)
        SendSysMessage(me, "this does not belong to you!");
        return;
      endif
    endif
  endif
  foreach thing in EnumerateItemsInContainer(theobj)
    if(theobj.container)
      MoveItemToContainer(thing, theobj.container);
    else
      MoveObjectToLocation(thing, theobj.x, theobj.y, theobj.z, theobj.realm, MOVEITEM_FORCELOCATION);
    endif
  endforeach
  if(theobj.usescript == ":tinkering:tinkerTraps")
    var traptype := GetObjProperty(theobj,"trap_type");
    var trapstrength := GetObjProperty(theobj,"trap_strength");
    var trapperserial := CInt(GetObjProperty(theobj, "trapper"));
    var trapper := SystemFindObjectBySerial(trapperserial, SYSFIND_SEARCH_OFFLINE_MOBILES);
    if(trapper)
      SetObjProperty(me, "LastHit", {trapper.name, trapper.serial, "trapped chest" });
      SetScriptController(trapper);
    endif
    case (traptype)
      "1" :   PlaySoundEffect(me, SFX_224);
              var dmg := (RandomInt(20) + CInt(trapstrength));
              SendSysMessage(me, "You set off a needle trap!");
              ApplyDamage(me, dmg);
              theobj.usescript := "";
              EraseObjProperty( theobj, "trap_type" );
              EraseObjProperty( theobj, "trap_strength" );

      "2" :   start_script(":traps:poisonTrapTriggered", {me, theobj, "You set off a poison trap!", trapstrength});

      "3" :   PlaySoundEffect(me, SFX_208);
              SendSysMessage(me, "You set off an explosion trap!");
              PlayObjectCenteredEffect( me, FX_EXPLODE_3, 10,10);
              var dmg := (RandomInt(20) + CInt(trapstrength));
              ApplyRawDamage(me, dmg);
              theobj.usescript := "";
              EraseObjProperty( theobj, "trap_type" );
              EraseObjProperty( theobj, "trap_strength" );
    endcase
  endif
  var created := GetObjProperty(theobj, "ItemsCreatedSerials");
  if(created)
    var holder;
    foreach thing in created
      holder := SystemFindObjectBySerial(thing);
      if(holder)
        DestroyItem(holder);
      endif
    endforeach
  else
    DestroyItem(theobj);
  endif
  PlaySoundEffect(me, 0x13a);
  return;
endfunction

function use_blade(who, blade, use_on)
  if(!can_access(who,use_on))
    return;
  endif
  if(!ReserveItem(use_on))
    return;
  endif
  var checkme := use_on.objtype;
  if((checkme == UOBJ_LOGS) || (checkme == 0x1bd7))
    CarveLogs(who, blade, use_on);
  elseif(use_on.npctemplate == "sheep")
    process_wool(who, blade, use_on);
  elseif(use_on.objtype == UOBJ_CORPSE)
    ReleaseItem(blade);
    Carve_Corpse(who, use_on);
  elseif(is_fish(checkme))
    CarveFish(who, blade, use_on);
  else
    SendSysMessage(who, "I don't know how to use those items together.");
  endif
endfunction

function process_wool(who, blade, sheep)
  if(sheep.graphic == 207)
    sheep.graphic := 223;
    CreateItemInContainer(who.backpack, 0xf125, 3);
    CheckToolWear (who, blade, SKILLID_TAILORING);
  else
    SendSysMessage(who,"That sheep is not yet ready to be shorn.");
  endif
endfunction

function is_fish(theobj)
  if((theobj >= UOBJ_FISH_START) && (theobj <= UOBJ_FISH_END) )
    return 1;
  elseif ((theobj >= UOBJ_SFISH_START) && (theobj <= UOBJ_SFISH_END))
    return 1;
  else
    return 0;
  endif
endfunction

function CarveFish(who, blade, use_on)
  if((!ReserveItem(use_on)) || (use_on.movable == 0))
    SendSysMessage(who, "You cannot use that.");
    return;
  endif
  var num_steaks := (4 * use_on.amount);
  PlaySoundEffect(who, SFX_57);
  if(DestroyItem(use_on))
    CreateItemInBackpack(who, UOBJ_FISHSTEAK, num_steaks);
    CheckToolWear (who, blade, SKILLID_FISHING);
    SendSysMessage(who, "You carve the fish steaks and put them in your backpack");
  endif
  sleep(1);
endfunction

function Carve_Corpse(who, cadaver)
  Detach();
  if((!Accessible(who, cadaver)) or (!CheckLineOfSight(who, cadaver)))
    SendSysMessage(who, "You cannot use that");
    return;
  endif
  if(Distance(who, cadaver) > 2)
    SendSysMessage(who, "You are not close enough");
    return;
  endif
  var c_type := cadaver.corpsetype;
  if(GetObjProperty(cadaver, "cut") == "1")
    SendSysMessage( who, "You cannot get any more from this corpse." );
    foreach thing in EnumerateItemsInContainer(cadaver)
      MoveObjectToLocation(thing, cadaver.x, cadaver.y, cadaver.z, cadaver.realm, MOVEITEM_FORCELOCATION);
    endforeach
    DestroyItem(cadaver);
  elseif((c_type == 400) || (c_type == 401))
    var beardlist := {0x203e, 0x203f, 0x2040, 0x2041, 0x204b, 0x204c, 0x204d };
    var hairlist  := {0x2044, 0x2045, 0x2046, 0x2047, 0x2048, 0x2049, 0x204a, 0x203b, 0x203c, 0x203d };
    foreach thing in EnumerateItemsInContainer(cadaver)
      if((thing.objtype in hairlist) or (thing.objtype in beardlist))
        DestroyItem(thing);
      else
        MoveObjectToLocation(thing, cadaver.x, cadaver.y, cadaver.z, cadaver.realm, MOVEITEM_FORCELOCATION);
      endif
    endforeach
    var partsarray := {};
    var part;
    part := CreateItemAtLocation(cadaver.x-1, cadaver.y, cadaver.z, 0x1da0, 1, who.realm);
    partsarray.append(part);
    SetObjProperty(part, "serial", GetObjProperty(cadaver, "serial"));
    var aname := cadaver.name;
    aname["A corpse of"] := "";
    part.name := "The head of " + aname;
    part := CreateItemAtLocation(cadaver.x-1, cadaver.y, cadaver.z, 0x1da1, 1, who.realm);
    partsarray.append(part);
    part := CreateItemAtLocation(cadaver.x-1, cadaver.y+1, cadaver.z, 0x1da2, 1, who.realm);
    partsarray.append(part);
    part := CreateItemAtLocation(cadaver.x+1, cadaver.y, cadaver.z, 0x1da3, 1, who.realm);
    partsarray.append(part);
    part := CreateItemAtLocation(cadaver.x+1, cadaver.y+1, cadaver.z, 0x1da4, 1, who.realm);
    partsarray.append(part);
    part := CreateItemAtLocation(cadaver.x, cadaver.y, cadaver.z, 0x1d9f, 1, who.realm);
    partsarray.append(part);
    var blood := CreateItemAtLocation(cadaver.x, cadaver.y, cadaver.z, 0x122a, 1, who.realm);
    blood.movable := 0;
    DestroyItem(cadaver);
    sleep(40);
    foreach thing in partsarray
      if(!thing.container)
        DestroyItem(thing);
      endif
    endforeach
    sleep(20);
    DestroyItem(blood);
  else
    if(c_type == 223)
      CreateItemInContainer(cadaver, 0x9f1, 2);
      SendSysMessage(who, "You place the items on the corpse.");
      var theblood := CreateItemAtLocation(cadaver.x, cadaver.y, cadaver.z, UOBJ_BLOOD, 1, who.realm);
      sleep(30);
      DestroyItem(cadaver);
      sleep(30);
      DestroyItem(theblood);
      return;
    endif
    var conf := ReadConfigFile(":*:npcdesc");
    var tmplate := GetObjProperty(cadaver, "npctemplate");
    if(!tmplate)
      SendSysMessage(who, "You cut the corpse, but fail to find anything useful.", 3, 40);
      var theblood := CreateItemAtLocation(cadaver.x, cadaver.y, cadaver.z, UOBJ_BLOOD, 1, who.realm);
      sleep(30);
      DestroyItem(cadaver);
      sleep(30);
      DestroyItem(theblood);
      return;
    else
      SetObjProperty(cadaver, "cut","1");
      var corpseitm := conf[tmplate]."corpseitm";
      var corpseamt := conf[tmplate]."corpseamt";
      print("I: " + corpseitm);
      print("A: " + corpseamt);
      if(!corpseitm)
        print("error");
        var theblood := CreateItemAtLocation(cadaver.x, cadaver.y, cadaver.z, UOBJ_BLOOD, 1, who.realm);
        sleep(30);
        DestroyItem(cadaver);
        sleep(30);
        DestroyItem(theblood);
        return;
      endif
      var i := 1;
      corpseitm := SplitWords(corpseitm);
      corpseamt := SplitWords(corpseamt);
      foreach thing in corpseitm
        CreateItemInContainer(cadaver, thing, Cint(corpseamt[i]));
        i := i + 1;
      endforeach
      SendSysMessage(who, "You place the items on the corpse.");
      var theblood := CreateItemAtLocation(cadaver.x, cadaver.y, cadaver.z, UOBJ_BLOOD, 1, who.realm);
      sleep(30);
      DestroyItem(cadaver);
      sleep(30);
      DestroyItem(theblood);
    endif
  endif
endfunction

function CarveLogs(who, blade, logs)
  if(logs.movable == 0)
    SendSysMessage(who, "You cannot use those logs.");
    return;
  endif
  if(!Accessible(who, logs))
    SendSysMessage(who, "You cannot use that");
    return;
  endif
  if(!logs.container)
    if(Distance(who, logs) > 2)
      SendSysMessage(who, "That is too far away");
      return;
    endif
  endif
  var selection := SelectMenuItem2(who, "BowcraftCarving");
  if(!selection)
    return;
  endif
  var what := selection.objtype;
  if(!Accessible(who, logs))
    SendSysMessage(who, "I can't access the logs to make that.");
    return;
  endif
  var objectconfig := FindConfigElem(bowcraftconfigfile, what);
  if(!objectconfig)
    return;
  endif
  var material := CInt(GetConfigString(objectconfig, "Material"));
  if(material > logs.amount)
    SendSysMessage(who, "You don't have enough logs to make that.");
    return;
  endif
  var difficulty := GetConfigInt(objectconfig, "Difficulty");
  var pointvalue := GetConfigInt(objectconfig, "PointValue");
  var bow := 0;
  Detach();
  PlaySoundEffect(who, 0x5a);
  PerformAction(who, 0x021);
  sleep(2);
  PlaySoundEffect(who, 0x5a);
  PerformAction(who, 0x021);
  sleep(2);
  PlaySoundEffect(who, 0x5a);
  PerformAction(who, 0x021);
  sleep(2);
  PlaySoundEffect(who, 0x5a);
  PerformAction(who, 0x021);
  sleep(2);
  if(CheckSkill(who, SKILLID_BOWCRAFT, difficulty, pointvalue))
    if(what == UOBJ_SHAFTS)
      var amt := logs.amount;
      if(DestroyItem(logs))
        CreateItemInBackpack(who, what, amt);
        CheckToolWear (who, blade, SKILLID_BOWCRAFT);
        SendSysMessage(who, "You create some shafts and place them in your pack." );
      endif
    elseif (what == UOBJ_BOW)
      if(SubtractAmount(logs, material))
        bow := CreateItemInBackpack(who, what);
        CheckToolWear (who, blade, SKILLID_BOWCRAFT);
        SendSysMessage(who, "You create a bow and place it in your pack.");
        SetName(bow, "a bow");
      endif
    elseif (what == UOBJ_XBOW)
      if(SubtractAmount(logs, material))
        bow := CreateItemInBackpack(who, what);
        CheckToolWear (who, blade, SKILLID_BOWCRAFT);
        SendSysMessage(who, "You create a crossbow and place it in your pack.");
        SetName(bow, "a crossbow");
      endif
    elseif (what == UOBJ_HEAVY_XBOW)
      if(SubtractAmount(logs, material))
        bow := CreateItemInBackpack(who, what);
        CheckToolWear (who, blade, SKILLID_BOWCRAFT);
        SendSysMessage(who, "You create a heavy crossbow and place it in your pack.");
        SetName(bow, "a heavy crossbow");
      endif
    else
      SendSysMessage(who, "I don't know how to make that.");
      return;
    endif
    var myskill := CInt(GetEffectiveSkill(who, SKILLID_BOWCRAFT));
    var modpts := 0;
    if(myskill >=  difficulty)
      modpts := (myskill - difficulty);
    endif
    var rint := RandomInt(100);
    if(modpts >= rint)
      ExceptionalFameMod(who, myskill, difficulty, Cint(pointvalue / 2));
      setquality(who, bow);
    endif
  else
    SubtractAmount(logs, (RandomInt(5) + 1));
    SendSysMessage(who, "You destroy some logs.");
  endif
endfunction

function setquality(who, bow)
  var tname := TruncateArticle(bow.name);
  if(CInt(GetEffectiveSkill(who, SKILLID_BOWCRAFT)) >= 99)
    bow.name := "an exceptional " + tname + " [crafted by " + who.name + "]";
  else
    bow.name := "an exceptional " + tname;
  endif
  bow.quality := bow.quality + 0.2;
  bow.hp := bow.maxhp;
  SendSysMessage(who, "You created an exceptional item.");
endfunction

function ExceptionalFameMod(who, skill, diff, points)
  if(skill > diff - 20)
    diff := diff + 20;
    if((skill - diff) <= 5)
      points := points;
    elseif((skill - diff) <= 10)
      points := (points * 3) / 4;
    elseif((skill - diff) <= 15)
      points := points / 2;
    elseif((skill - diff) <= 20)
      points := points / 4;
    else
      points := 0;
    endif
    points := Cint(points);
    var fame := Cint(GetObjProperty(who, "Fame"));
    var famegain := fame + points;
    SetObjProperty(who, "Fame", famegain);
    var msgtext := "You have ";
    if(points < 0)
      msgtext := msgtext + "lost ";
      points := Abs(points);
    else
      msgtext := msgtext + "gained ";
    endif
    if(points > 150)
      msgtext := msgtext + "a great amount of ";
    elseif(points > 125)
      msgtext := msgtext + "alot of ";
    elseif(points > 75)
      msgtext := msgtext + "a good amount of ";
    elseif(points > 30)
      msgtext := msgtext + "some ";
    elseif(points > 0)
      msgtext := msgtext + "a little ";
    else
      return 0;
    endif
    msgtext := msgtext + "Fame.";
    SendSysMessage(who, msgtext);
    var karma := Cint(GetObjProperty(who, "Karma"));
    var kmod := GetKarmaLevel(karma);
    var fmod := GetFameLevel(famegain);
    var newtitle := nototitles[ (kmod) ];
    newtitle := "The " + CStr(newtitle[fmod]) + " ";
    if(newtitle["None"])
      newtitle := "";
    endif
    if(fmod == 5)
      if(who.gender == 1)
        newtitle := newtitle + "Lady ";
      else
        newtitle := newtitle + "Lord ";
      endif
    endif
    if(newtitle != who.title_prefix)
      who.title_prefix := newtitle;
      SendSysMessage(who, "you are now known as " + newtitle + who.name);
    endif
    SetNotoTitle(who, karma, fame);
  endif
endfunction



Ofcourse understand that these logs still won't have any special abilities and you will have to be responsible for transferring the colour of the logs to any item crafted from them but I hope I have given you a hand up to creating something special for your shard.


To add qualities to items based on wood type, in this example bows, you will need to edit each script that uses the wood, in this example bladed.src
Test for the wood type using if or case statements. Then apply the mods accordingly. Here is a small piece of my code that does that:

First look for this line near or at line 35: var checkme := use_on.item.objtype;
Following that line you will see an 'if' statement.

Change it to the following: if ( (checkme == UOBJ_LOGS) or (checkme == UOBJ_WOOD_YEW)) if ( (checkme == UOBJ_LOGS) or (checkme == UOBJ_WOOD_YEW)

Code:
   if (wood == UOBJ_LOGS)
      return;
   elseif (wood == UOBJ_WOOD_YEW)
      bow.maxhp_mod := bow.maxhp_mod + 10;
      bow.hp := bow.maxhp_mod;
      bow.quality := bow.quality - 0.1;
      bow.dmg_mod := bow.dmg_mod + 2;
      bow.color := 0x802c; // Set to your colour for yew logs
      SetName(bow, ("a yew " + tname) );


As I said that is an example and not a fully working script. Hopefully using that you can see how mods are made and build your own sections in the
appropriate scripts

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 4 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl