Stable Master

For questions relating to POL scripting (not necessarily related to WoD)

Moderators: Siobhan, Sebastian, Drocket

Stable Master

Postby Khalid on Wed Dec 11, 2002 8:04 pm

can someone help me about making the stable master sell animals like horses to players... thanks for any help that u could bring me...
Khalid
Newbie
 
Posts: 19
Joined: Sat Nov 30, 2002 1:06 am

Postby Augur Wildwood on Thu Dec 12, 2002 1:02 am

I'm sure there are a few ways to go about this, but here is how I would approach it:

Take a look at the guild shopkeeper script in this location: C:\pol\pkg\guilds\adventurers_guild

That should give you an idea of how to modify the stamaster.src script located in: C:\pol\pkg\npcs\townfolk\merchants

Specifically, you will need to add a check for the word "buy" in this section of the script:

Code: Select all
EVID_SPEECH:
   if (event.text["stable"])


It might look something like this:

Code: Select all
EVID_SPEECH:
   if (event.text["buy"])
      TurnToward (ev.source);
      local parms := array;
      parms[1] := me;
      parms[2] := ev.source;
      start_script ("buyitems", parms);
   elseif (event.text["stable"])

...the code continues...

Then you need to copy the "buyitems" script from the C:\pol\pkg\guilds folder and modify it a bit. For example, remove all checks for guild membership, the bits that set and remove the "guildbuywindow" property, etc....

Also, you need to change this line in the "buyitems" script:

Code: Select all
   item_cfg_file := ReadConfigFile (":" + guild_name + ":itemsforsale");


Change it so that it points to a new "itemsforsale.cfg" file. If you want to keep all of these scripts together in the C:\pol\pkg\npcs\townfolk\merchants folder, then the line would look like this:

Code: Select all
   item_cfg_file := ReadConfigFile ("itemsforsale");


That file will need to contain the definitions of the animals that you want the vendor to sell.

Lastly, you will need to change the buyitems script to set a couple properties on the horse or other animal (set "script" to ::tamed ...and set "owner" to the player's serial number). So, for example, somewhere after the line that says:

Code: Select all
   local theitem := CreateItemInBackpack (player, chosen_item.objtype, 1);


...and before the line that says:

Code: Select all
   PrintTextAbovePrivate (shopkeep, "Thanks!  Come again soon!", player);


...you would include a couple lines that set those properties.

When all of that is done, compile the scripts, start your shard, and troubleshoot any remaining problems or glitches.

Hope that helps!

-Augur
Augur Wildwood
Sr. Regular Poster
 
Posts: 154
Joined: Tue Oct 08, 2002 8:37 pm
Location: Berkeley, CA

Postby Drocket on Thu Dec 12, 2002 10:26 pm

Yeah, that would be kind of a pain. The general route that Augur suggested would probably be the best way to go, except for the section:
local theitem := CreateItemInBackpack (player, chosen_item.objtype, 1);

it would be kind of bad to wind up with a horse in your backpack :) What I would suggest is to keep the same general format for the itemsforsale.cfg file, but for each element, add a line:
npcdesc (animal npcdesc name here)

Here's an (untested) version of the 'buyitems' script:
use uo;
use os;
use util;
use cfgfile;

include "../pkg/guilds/guilds";

var gump_layout := {};
var gump_data := {};
var string_counter := 1;

var item_cfg_file;
var players_gold;

program display_forsale_items (parms)

local shopkeep := parms[1];
local player := parms[2];
local guild_name := parms[3];
if (!shopkeep or !player or !guild_name)
return;
endif

if (GetObjProperty (player, "guildbuywindow") )
return;
endif
SetObjProperty (player, "guildbuywindow", 1);

item_cfg_file := ReadConfigFile (":merchants:itemsforsale");
if (!item_cfg_file)
Syslog ("Can't open :merchants:itemsforsale cfgfile!");
PrintTextAbovePrivate (shopkeep, "Sorry, but I'm having a bit of a problem right now.", player);
EraseObjProperty (player, "guildbuywindow");
return;
endif

players_gold := player.gold;
PrintTextAbovePrivate (shopkeep, "Hello, there! What do you want?", player);

BuildDisplayGump (guild_name);
local gump_return := SendDialogGump (player, gump_layout, gump_data);
if (!gump_return and gump_return[0] != 0)
PrintTextAbovePrivate (shopkeep, "Please close other gumps first.", player);
EraseObjProperty (player, "guildbuywindow");
return;
elseif (gump_return[0] = 0)
PrintTextAbovePrivate (shopkeep, "OK, maybe next time then.", player);
EraseObjProperty (player, "guildbuywindow");
return;
endif

local intkeyarray := GetConfigIntKeys (item_cfg_file);
local thekey := intkeyarray[gump_return[0]];
local chosen_item := FindConfigElem (item_cfg_file, thekey);
if (!chosen_item)
Syslog ("Error finding key " + thekey);
PrintTextAbovePrivate (shopkeep, "Sorry, but I'm having a bit of a problem right now.", player);
EraseObjProperty (player, "guildbuywindow");
return;
endif

if (!player.spendgold (chosen_item.price ))
PrintTextAbovePrivate (shopkeep, "I'm sorry, but you can't afford that right now.", player);
EraseObjProperty (player, "guildbuywindow");
return;
endif

var parms := { };
parms.+script := "::tamed";

set_critical(1);
newpet := SpawnNPCAtLocation (chosen_item.npctemplate, shopkeep.x+1, shopkeep.y+1, "guess", parms);
if (!newpet)
Say ("Uh-oh... Where'd he go?");
set_critical (1);
return;
endif

SetObjProperty (newpet, "master", player.serial);
newpet.script := "::tamed";
RestartScript (newpet);
set_critical(0);

PrintTextAbovePrivate (shopkeep, "Thanks! Come again soon!", player);
EraseObjProperty (player, "guildbuywindow");

endprogram




///////////////////
// does thw grunt work of building the gump
///////////////////

function BuildDisplayGump (guild_name)

gump_layout := {
"page 0",
"nodispose",
"resizepic 20 20 2600 400 300",
"resizepic 60 60 5120 60 60",
"text 140 50 1327 0",
"text 140 100 1327 1",
"text 140 270 1327 2",
"text 280 270 0 3",
"text 200 240 0 4",
"page 1"
};

gump_data := {
"Item:",
"Price:",
"Your tickets:",
players_tickets,
"Buy item",
};

string_counter := len (gump_data);
local pagenumber := 1;
local intkeyarray := GetConfigIntKeys (item_cfg_file);
local number_of_keys := len (intkeyarray);

foreach intkey in intkeyarray
local elem := FindConfigElem (item_cfg_file, intkey);
if (!elem)
Syslog ("Error finding " + guild_name + " key " + intkey);
endif

gump_layout.append ("tilepic 70 70 " + elem.graphic);
gump_layout.append ("text 200 50 0 " + string_counter);
gump_data.append (elem.desc_1);
string_counter := string_counter + 1;

gump_layout.append ("text 220 70 0 " + string_counter);
gump_data.append (elem.desc_2);
string_counter := string_counter + 1;

gump_layout.append ("text 200 100 0 " + string_counter);
gump_data.append (elem.price);
string_counter := string_counter + 1;

gump_layout.append ("text 100 140 0 " + string_counter);
gump_data.append (elem.line_1);
string_counter := string_counter + 1;

gump_layout.append ("text 100 160 0 " + string_counter);
gump_data.append (elem.line_2);
string_counter := string_counter + 1;

gump_layout.append ("text 100 180 0 " + string_counter);
gump_data.append (elem.line_3);
string_counter := string_counter + 1;

gump_layout.append ("button 180 245 2104 2103 1 0 " + (pagenumber));

if (pagenumber = 1)
if (number_of_keys > 1)
gump_layout.append ("button 365 200 5601 5605 0 2");
gump_layout.append ("page 2");
gump_layout.append ("button 60 200 5603 5607 0 1");
pagenumber := 2;
endif
elseif (pagenumber = number_of_keys)
gump_layout.append ("button 60 200 5603 5607 0 " + (pagenumber-1) );
else
pagenumber := pagenumber + 1;
gump_layout.append ("button 365 200 5601 5605 0 " + pagenumber);
gump_layout.append ("page " + pagenumber);
gump_layout.append ("button 60 200 5603 5607 0 " + (pagenumber-1) );
endif
endforeach
endfunction
Drocket
Site Admin
 
Posts: 820
Joined: Mon Oct 07, 2002 2:54 am

Postby Khalid on Fri Dec 13, 2002 2:04 am

thanks but there's still one problem in the buyitems

when i try to compile i recieve an error in the line 67

Code: Select all
var parms := { };
parms.+script := "::tamed";


btw it says that is an Error Detected in Program Body

what can this be? btw thanks for all ur help.. :D
Khalid
Newbie
 
Posts: 19
Joined: Sat Nov 30, 2002 1:06 am

Postby Augur Wildwood on Fri Dec 13, 2002 4:46 am

Not sure but if I had to guess I'd say that plus sign before "script" doesn't belong there.

BTW, thanks for pointing out that mistake Drocket. I knew I was missing some stuff... hehe. That's what troubleshooting is for! ;)

-Augur
Augur Wildwood
Sr. Regular Poster
 
Posts: 154
Joined: Tue Oct 08, 2002 8:37 pm
Location: Berkeley, CA

Postby Drocket on Fri Dec 13, 2002 6:18 am

Actually, the + sign is supposed to be there - that's how you build a structure. Actually, that bit of code is pretty of out of date: it should be declared as a struct instead of an array ({}). I'm not sure if that method will still work with POL 0.95 - they're removing quite a few obsolete methods.

Anyway, the problem is that I reused the 'parms' variable (which was originally used all the way at the top of the program.) POL isn't very imformative when it hits this sort of error... Anyway, its easy to fix;

var npc_parms := struct;
npc_parms.+script := "::tamed";

set_critical(1);
var newpet := SpawnNPCAtLocation (chosen_item.npctemplate, shopkeep.x+1, shopkeep.y+1, "guess", npc_parms);
if (!newpet)
PrintTextAbovePrivate (shopkeep, "Uh-oh... Where'd he go?", player);
set_critical (1);
return;
endif
Drocket
Site Admin
 
Posts: 820
Joined: Mon Oct 07, 2002 2:54 am

Postby Khalid on Sat Dec 14, 2002 8:14 am

well i have this little trouble trying to compile it it's about the SpawnNPCAtLocation here's the image of the error

Image

thanks for any help that u could bring me... :>
Khalid
Newbie
 
Posts: 19
Joined: Sat Nov 30, 2002 1:06 am

Postby Drocket on Sat Dec 14, 2002 9:31 am

Oh, thought I mentioned that in the 'bugfix reply' already. Add:
include "include/spawn";
with the other includes near the top of the file.
Drocket
Site Admin
 
Posts: 820
Joined: Mon Oct 07, 2002 2:54 am

Postby Khalid on Sat Dec 14, 2002 11:56 am

well now it runs... but when i say buy to an stable master it doesn't show up the gump where the options shall appear what can this be? thanks for all your help... :D
Khalid
Newbie
 
Posts: 19
Joined: Sat Nov 30, 2002 1:06 am

Postby Augur Wildwood on Sun Dec 15, 2002 6:28 am

You are probably not pointing to the correct location for the itemsforsale.cfg file that contains the mounts and other animals for sale. Specifically, the line that reads:

Code: Select all
 item_cfg_file := ReadConfigFile ("itemsforsale");


This line can contain a path (see the original line of code in my first post). The line above assumes that the itemsforsale.cfg file is located in the same folder as the buyitems script.

-Augur
Augur Wildwood
Sr. Regular Poster
 
Posts: 154
Joined: Tue Oct 08, 2002 8:37 pm
Location: Berkeley, CA

Postby Drocket on Mon Dec 16, 2002 6:54 am

Also, make sure you restart your shard, or ".unload stamaster" and ".restart" the stablemaster. NPCs don't use changed scripts unless you do one of the previous two things.
Drocket
Site Admin
 
Posts: 820
Joined: Mon Oct 07, 2002 2:54 am

Postby Khalid on Tue Dec 17, 2002 11:13 pm

well... i'm still having troubles... i can't get the vendor to show the window where the pets to buy are... :P



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

include "../pkg/guilds/guilds";
include "include/spawn";


var gump_layout := {};
var gump_data := {};
var string_counter := 1;

var item_cfg_file;
var players_gold;

program display_forsale_items (parms)
   local shopkeep := parms[1];
   local player := parms[2];
   local guild_name := parms[3];
   if (!shopkeep or !player or !guild_name)
      return;
   endif

   if (GetObjProperty (player, "guildbuywindow") )
      return;
   endif
   SetObjProperty (player, "guildbuywindow", 1);
   item_cfg_file := ReadConfigFile ("itemforsale");
   
   if (!item_cfg_file)
      Syslog ("Can't open itemforsale cfgfile!");
      PrintTextAbovePrivate (shopkeep, "Sorry, but I'm having a bit of a problem right now.", player);
      EraseObjProperty (player, "guildbuywindow");
      return;
   endif

   players_gold := player.gold;
   PrintTextAbovePrivate (shopkeep, "Hello, there! What do you want?", player);

   BuildDisplayGump (guild_name);
   local gump_return := SendDialogGump (player, gump_layout, gump_data);
   if (!gump_return and gump_return[0] != 0)
      PrintTextAbovePrivate (shopkeep, "Please close other gumps first.", player);
      EraseObjProperty (player, "guildbuywindow");
      return;
      elseif (gump_return[0] = 0)
         PrintTextAbovePrivate (shopkeep, "OK, maybe next time then.", player);
         EraseObjProperty (player, "guildbuywindow");
         return;
   endif

   local intkeyarray := GetConfigIntKeys (item_cfg_file);
   local thekey := intkeyarray[gump_return[0]];
   local chosen_item := FindConfigElem (item_cfg_file, thekey);
   if (!chosen_item)
      Syslog ("Error finding key " + thekey);
      PrintTextAbovePrivate (shopkeep, "Sorry, but I'm having a bit of a problem right now.", player);
      EraseObjProperty (player, "guildbuywindow");
      return;
   endif

   if (!player.spendgold (chosen_item.price ))
      PrintTextAbovePrivate (shopkeep, "I'm sorry, but you can't afford that right now.", player);
      EraseObjProperty (player, "guildbuywindow");
      return;
   endif
   
   var npc_parms := struct;
   npc_parms.+script := "::tamed";
   set_critical(1);
   var newpet := SpawnNPCAtLocation (chosen_item.npctemplate, shopkeep.x+1, shopkeep.y+1, "guess", parms);
   if (!newpet)
      PrintTextAbovePrivate (shopkeep, "Uh-oh... Where'd he go?", player);
      set_critical (1);
      return;
   endif

   SetObjProperty (newpet, "master", player.serial);
   newpet.script := "::tamed";
   RestartScript (newpet);
   set_critical(0);

   PrintTextAbovePrivate (shopkeep, "Thanks! Come again soon!", player);
   EraseObjProperty (player, "guildbuywindow");

endprogram




///////////////////
// does thw grunt work of building the gump
///////////////////

function BuildDisplayGump (guild_name)

   gump_layout := {
      "page 0",
      "nodispose",
      "resizepic 20 20 2600 400 300",
      "resizepic 60 60 5120 60 60",
      "text 140 50 1327 0",
      "text 140 100 1327 1",
      "text 140 270 1327 2",
      "text 280 270 0 3",
      "text 200 240 0 4",
      "page 1"
   };

   gump_data := {
      "Item:",
      "Price:",
      "Your Gold:",
      players_gold,
      "Buy item",
   };

   string_counter := len (gump_data);
   local pagenumber := 1;
   local intkeyarray := GetConfigIntKeys (item_cfg_file);
   local number_of_keys := len (intkeyarray);

   foreach intkey in intkeyarray
      local elem := FindConfigElem (item_cfg_file, intkey);
      if (!elem)
         Syslog ("Error finding " + guild_name + " key " + intkey);
      endif

      gump_layout.append ("tilepic 70 70 " + elem.graphic);
      gump_layout.append ("text 200 50 0 " + string_counter);
      gump_data.append (elem.desc_1);
      string_counter := string_counter + 1;

      gump_layout.append ("text 220 70 0 " + string_counter);
      gump_data.append (elem.desc_2);
      string_counter := string_counter + 1;

      gump_layout.append ("text 200 100 0 " + string_counter);
      gump_data.append (elem.price);
      string_counter := string_counter + 1;

      gump_layout.append ("text 100 140 0 " + string_counter);
      gump_data.append (elem.line_1);
      string_counter := string_counter + 1;

      gump_layout.append ("text 100 160 0 " + string_counter);
      gump_data.append (elem.line_2);
      string_counter := string_counter + 1;

      gump_layout.append ("text 100 180 0 " + string_counter);
      gump_data.append (elem.line_3);
      string_counter := string_counter + 1;

      gump_layout.append ("button 180 245 2104 2103 1 0 " + (pagenumber));

      if (pagenumber = 1)
         if (number_of_keys > 1)
            gump_layout.append ("button 365 200 5601 5605 0 2");
            gump_layout.append ("page 2");
            gump_layout.append ("button 60 200 5603 5607 0 1");
            pagenumber := 2;
         endif
      elseif (pagenumber = number_of_keys)
         gump_layout.append ("button 60 200 5603 5607 0 " + (pagenumber-1) );
      else
         pagenumber := pagenumber + 1;
         gump_layout.append ("button 365 200 5601 5605 0 " + pagenumber);
         gump_layout.append ("page " + pagenumber);
         gump_layout.append ("button 60 200 5603 5607 0 " + (pagenumber-1) );
      endif
   endforeach
endfunction
Khalid
Newbie
 
Posts: 19
Joined: Sat Nov 30, 2002 1:06 am

Postby Khalid on Tue Dec 17, 2002 11:15 pm

and this is the stamaster script... well just let me know if there's something wrong... thanks for all your help... :D

Code: Select all
use os;
use uo;
use npc;
use util;
use cfgfile;

include "include/client";
include "include/objtype";
include "include/eventid";
include "include/spawn";
include "include/attributes";
include "include/NPCBackpacks";
include "../pkg/npcs/speech";
include "../pkg/npcs/npc_util";
include "../pkg/npcs/npcinfo";

Const MAXFRIENDS   := 3;

global pet      := 0;      // Pet to stable
global player      := 0;      // Whoever said "stable"
global me         := Self ();

program stabler_AI ()

   if ( me.name ["<random>"] )
      DoStablerOnCreationSetup ();
   endif
   speech := 5;
   
   EnableEvents (EVID_DAMAGED + EVID_ENGAGED);
   EnableEvents (EVID_SPEECH, 1);
   EnableEvents (EVID_ITEM_GIVEN);
   WalkHome ();

   var event;
   while (me)
      if (me.hidden)
         me.hidden := 0;
      endif

      event := os::wait_for_event ( 120 );
      if (event)
         case (event.type)
            EVID_ENGAGED:
            EVID_DAMAGED:
               SetVital (me, "Life", GetVitalMaximumValue (me, "Life"));
               me.hidden := 1;
               var hidetime := ReadGameClock ();
               repeat
                  event := os::wait_for_event (120);
                  if (!me.hidden)
                     me.hidden := 1;
                  endif
               until (hidetime + 120 < ReadGameClock());
               me.hidden := 0;

            EVID_SPEECH:
               if (event.text["buy"])
                  player := event.source;
                  local parms := array;
                  TurnToward (player);
                  parms[1] := me;
                  parms[2] := player;
                  start_script ("buyitems", parms);
               elseif (event.text["stable"])
                  player := event.source;
                  TurnToward (player);
                  Say ("Show me your pet.");
                  pet := Target (player);
                  if (pet)
                     if (pet.script["tamed"])
                        if (GetObjProperty (pet, "summoned") or GetObjProperty (pet, "totem"))
                           Say ("Any just what am i supposed to do with that?");
                        elseif (GetObjProperty (pet, "master") = player.serial)
                           var stableprice := GetStablePriceOfPet (pet);
                           Say ("I charge " + stableprice + " to take care of " + pet.name + ".");
                           if (player.spendgold (stableprice) )
                              Say ("Keep this ticket and give it to me when you want " + pet.name + " back.");
                              var ticket := CreateItemInBackpack (player, 0x14f0, 1);
                              ticket.usescript := "";
                              Save_Pet_Data (ticket, pet);
                           else
                              Say ("You don't have enough money!");
                           endif
                        else
                           say ("This is not a zoo!");
                        endif
                     elseif ( (pet.graphic = CID_HUMAN_MALE) or (pet.graphic = CID_HUMAN_FEMALE) )
                        Say ("Do I look like an Inn Keeper?!");
                     else
                        Say ("That is not your pet.");
                     endif
                  else
                     Say ("Never mind, then.");
                  endif
               else
                  check_speech (event.text, event.source);
               endif
            EVID_ITEM_GIVEN:
                     TurnToward (event.source);
               Load_Ticket_Data (event.source, event.item);
         endcase
      endif
   endwhile
endprogram




///////////////////
//  Called to save the pet data to the claim ticket
///////////////////

function Save_Pet_Data (byref ticket, byref pet)
   DropAllItems (pet);

   ticket.name := "Pet claim ticket for : " + pet.name;
   ticket.usescript := "";
   SetObjProperty (ticket, "petname", pet.name);
   SetObjProperty (ticket, "pethp", CINT (GetVital (pet, "Life")*100));
   SetObjProperty (ticket, "petmana", CINT (GetVital (pet, "Mana")/100));
   SetObjProperty (ticket, "petgraphic", pet.graphic);
   SetObjProperty (ticket, "petcolor", pet.color);
   SetObjProperty (ticket, "pettemplate", pet.npctemplate);

   //kill the pet
   MoveCharacterToLocation (pet, 5288, 1176 , 0, MOVECHAR_FORCELOCATION);
   ApplyRawDamage (pet, GetVital (pet, "Life") + 3);
endfunction




///////////////////
//  creates a new NPC based on the data stored in the claim ticket
///////////////////

function Load_Ticket_Data (byref player, byref ticket)

   if (ticket.objtype = 0x14f0 and GetObjProperty (ticket, "pettemplate") )
      if (!canclaim (player,GetObjProperty (ticket, "pettemplate")))
         Say ("You have no chance of controlling that!");
         MoveItemToContainer (ticket, player.backpack);
         return;
      endif

      var newpet := 0;
      Say ("Oh, let me find " + GetObjProperty (ticket, "petname") + " for you. One moment, please.");
      Sleep (3);

      var parms := { };
      parms.+script := "::tamed";

      set_critical(1);
         newpet := SpawnNPCAtLocation (GetObjProperty (ticket, "pettemplate"), me.x+1, me.y+1, "guess", parms);
         if (!newpet)
            Say ("Uh-oh...  Where'd he go?");
            set_critical (1);
            return;
         endif

         SetVital (newpet, "Life", GetObjProperty (ticket, "pethp") * 100);
         SetVital (newpet, "Mana", GetObjProperty (ticket, "petmana") * 100);

         newpet.graphic := GetObjProperty (ticket, "petgraphic");
         newpet.name := GetObjProperty (ticket, "petname");
         newpet.color := GetObjProperty (ticket, "petcolor");
         SetObjProperty (newpet, "color", GetObjProperty (ticket, "petcolor"));

         SetObjProperty (newpet, "master", player.serial);
         newpet.script := "::tamed";
         RestartScript (newpet);
      set_critical(0);

      Say ("Take care of " + GetObjProperty (ticket, "petname") + " and be sure to feed it!");
      DestroyItem (ticket);
   else
      TakeItem (player, ticket);
   endif

endfunction




///////////////////
//  makes sure that the player can control the pet that they're trying to claim
///////////////////

function CanClaim (byref player, pettemplate)

   case (pettemplate)
      "horse":
      "horse2":
      "horse3":
      "horse4":
      "horse5":
      "forestostard":
      "desertostard":
      "llama":
         return 1;
   endcase

   var elem := GetNpcTemplateElem (pettemplate);
   var difficulty := CINT (GetConfigInt (elem, "tameskill"));
   if (!difficulty)
      return 0;
   endif

   if (difficulty < 50)
      return 1;
   elseif ((difficulty - 20) > GetAttribute (player, ATTRIBUTEID_TAMING))
      return 0;
   else
      return 1;
   endif
endfunction




///////////////////
//  Drops all the items that the pet is carrying
///////////////////

function DropAllItems (byref pet)

   var mypack := FindMyPack(pet.serial);
   foreach myitems in enumerateitemsincontainer(mypack)
      if (myitems.container.serial = mypack.serial)
              moveitemtolocation (myitems, pet.x, pet.y, pet.z, 0);
         sleepms(100);
      endif
   endforeach

   if (pet.backpack)
      mypack := pet.backpack;
      foreach item in enumerateitemsincontainer(mypack)
         if (item.container.serial = mypack.serial)
                 moveitemtolocation(item, pet.x, pet.y, pet.z, 0);
         endif
      endforeach
   endif

endfunction




///////////////////
//  The price to stable a pet is based on the difficulty of taming it
///////////////////

function GetStablePriceOfPet (pet)
   var mobelem := GetNpcTemplateElem (pet.npctemplate);
   var tameskill := CINT (mobelem.tameskill);
   if (!tameskill)
      return 250;
   endif

   if (tameskill <= 60)
      return 30;
   elseif (tameskill <= 70)
      return 50;
   elseif (tameskill <= 80)
      return 100;
   elseif (tameskill <= 90)
      return 200;
   elseif (tameskill <= 100)
      return 300;
   elseif (tameskill <= 110)
      return 400;
   else
      return 500;
   endif
   return 1;


endfunction




///////////////////
//  called when the NPC is first created, this function names
//  them and clothes them
///////////////////

function DoStablerOnCreationSetup()

   var newbackpack := CreateItemAtLocation (5288 , 1176 , 0, UOBJ_BACKPACK, 1);
   EquipItem (me, newbackpack);

   me.gender := RandomInt (2);
   me.graphic := 400+me.gender;
   me.name := RandomName (me);
   me.title_suffix := " the stablemaster";

   var parms := {};
   parms[1]:= me;
   parms[2]:= "poor";
   set_priority( 1 );
   start_script("::/misc/dressme", parms);
endfunction
Khalid
Newbie
 
Posts: 19
Joined: Sat Nov 30, 2002 1:06 am

Postby Khalid on Wed Dec 18, 2002 6:04 am

and well it would be helpful if u tell me what do i have to put in the cfg file... just

i.e.:
Code: Select all
NpcDesc Horse


or i have to put something else in there?


thanks... :D


ahh... how can i do to make hostiles NPC don't walk through gates, and that kind of stuff?... thanks again... :D
Khalid
Newbie
 
Posts: 19
Joined: Sat Nov 30, 2002 1:06 am

Postby Augur Wildwood on Thu Dec 19, 2002 1:23 am

It would help us a bit if you could tell us what the stablemaster says when you say "buy" to him.

-Augur
Augur Wildwood
Sr. Regular Poster
 
Posts: 154
Joined: Tue Oct 08, 2002 8:37 pm
Location: Berkeley, CA

Next

Return to Scripting Forum

Who is online

Users browsing this forum: No registered users and 1 guest

cron