PenUltima Online

It is currently Thu Aug 28, 2008 6:37 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 24 posts ] 
Author Message
 Post subject:
PostPosted: Wed Jun 21, 2006 6:19 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Ok, everyone that is trying to help thanks but forget all that because now ill just do i region, please guide me on what to do here is my current script:

Code:
use os;
use uo;
include "include/canAccess";
include "include/attributes";

const SEARCH_RANGE := 10;

program makevendor(who, deed)
  EraseObjProperty(who, "IsMeditating");
  EraseObjProperty(who, "HealTimer");
  if(!can_access(who, deed))
    return;
  endif
  if(!ReserveItem(deed))
    return;
  endif
  var place;
  if(who.multi.serial)
    var multi := who.multi;
    var sign;
    foreach thing in (multi.components)
      if(thing.objtype == 0xbd2)
        sign := thing;
        break;
      endif
    endforeach
    if(!sign)
      SendSysMessage(who, "You cannot place a vendor here.");
      return;
    endif
    if(!GetObjProperty(sign, "Public"))
      SendSysMessage(who, "You can only place vendors in public houses.");
      return;
    endif
    place := CreateNpcFromTemplate("playervendor", who.x, who.y, who.z);
    if(!place)
      SendSysMessage( who, "Your vendor has not been created");
      return;
    else
      SendSysMessage(who, "You have successfully created a vendor");
      SetObjProperty(place, "master", who.serial);
      SetObjProperty(place, "mn", who.name);
      SetObjProperty(place, "r", 1500);
      if(!DestroyItem(deed))
        RevokePrivilege(place, "invul");
        SetObjProperty(place, "guardkill", 1);
        ApplyRawDamage(place, (GetHp(place) + 5));
      endif
    endif
  else
   SendSysMessage( who, "You cannot place your vendor here");
   return;
  endif
endprogram



And i've got no idea where to start


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 12:04 pm 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 744
Location: Chicago, IL USA
Do you want them to be able to place outside and in their house? Just confined to one region?

if(who.multi.serial)
.....
else
SendSysMessage( who, "You cannot place your vendor here");
return;
endif

that would be a good place to start...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 12:19 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
I want them to be able to place anywhere in that region AND thier houses outside of that region


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 2:51 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
I just realized how dumb i am.. Can a moderator move this topic to scripting support.. sorry


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 8:57 pm 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 744
Location: Chicago, IL USA
ok, so what you do here is

Code:
program makevendor(who, deed)
  EraseObjProperty(who, "IsMeditating");
  EraseObjProperty(who, "HealTimer");
  if(!can_access(who, deed))
    return;
  endif
  if(!ReserveItem(deed))
    return;
  endif
  var place;
  if(who.multi.serial)
    var multi := who.multi;
    var sign;
    foreach thing in (multi.components)
      if(thing.objtype == 0xbd2)
        sign := thing;
        break;
      endif
    endforeach
    if(!sign)
      SendSysMessage(who, "You cannot place a vendor here.");
      return;
    endif
    if(!GetObjProperty(sign, "Public"))
      SendSysMessage(who, "You can only place vendors in public houses.");
      return;
    endif
    CreateVendor(who, deed);
  elseif ((who.x > leftx) && (who.x < rightx) && (who.y > topy) && (who.y < bottomy))
    CreateVendor(who, deed);
  else
   SendSysMessage( who, "You cannot place your vendor here");
   return;
  endif
endprogram

function CreateVendor(who, deed)
    place := CreateNpcFromTemplate("playervendor", who.x, who.y, who.z);
    if(!place)
      SendSysMessage( who, "Your vendor has not been created");
      return;
    else
      SendSysMessage(who, "You have successfully created a vendor");
      SetObjProperty(place, "master", who.serial);
      SetObjProperty(place, "mn", who.name);
      SetObjProperty(place, "r", 1500);
      if(!DestroyItem(deed))
        RevokePrivilege(place, "invul");
        SetObjProperty(place, "guardkill", 1);
        ApplyRawDamage(place, (GetHp(place) + 5));
      endif
    endif
endfunction



then declare these variables at the top of your script

var leftx := // The leftmost X (or western border) of your region
var rightx := // The rightmost X (or eastern border)
var topy := // The topmost Y (or northern border)
var bottomy := // The bottommost border (or southern border)

Be aware that the script I put there does no other checking of any kind if you're within the region box unless you're in a house then it will do all house checks. If you want to add extra checks and restrictions for your region, add them after
elseif ((who.x > leftx) && (who.x < rightx) && (who.y > topy) && (who.y < bottomy))


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 9:26 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Thank you, no you didnt solve my problem, you opened a new gateway to how i could place vendors on these tiles :)

Simple simple simple..:

For further refrence:
Quote:
use os;
use uo;
include "include/canAccess";
include "include/attributes";

program makevendor(who, deed)
EraseObjProperty(who, "IsMeditating");
EraseObjProperty(who, "HealTimer");
if(!can_access(who, deed))
return;
endif
if(!ReserveItem(deed))
return;
endif
var place;
if(who.multi.serial)
var multi := who.multi;
var sign;
foreach thing in (multi.components)
if(thing.objtype == 0xbd2)
sign := thing;
break;
endif
endforeach
if(!sign)
SendSysMessage(who, "You cannot place a vendor here.");
return;
endif
if(!GetObjProperty(sign, "Public"))
SendSysMessage(who, "You can only place vendors in public houses.");
return;
endif
CreateVendor(who, deed);
elseif (0xecb9)
CreateVendor(who, deed);

else
SendSysMessage( who, "You cannot place your vendor here");
return;
endif
endprogram

function CreateVendor(who, deed)
var place := CreateNpcFromTemplate("playervendor", who.x, who.y, who.z);
if(!place)
SendSysMessage( who, "Your vendor has not been created");
return;
else
SendSysMessage(who, "You have successfully created a vendor");
SetObjProperty(place, "master", who.serial);
SetObjProperty(place, "mn", who.name);
SetObjProperty(place, "r", 1500);
if(!DestroyItem(deed))
RevokePrivilege(place, "invul");
SetObjProperty(place, "guardkill", 1);
ApplyRawDamage(place, (GetHp(place) + 5));
endif
endif
endfunction



Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 9:28 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Err i take that back.. sigh, it lets you place it anywhere in the world..


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 22, 2006 12:34 am 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 744
Location: Chicago, IL USA
what did you set leftx, rightx, topy, bottomy to?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 22, 2006 7:11 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
I got it working, your s had a few bugs that i managed to fix, and its working great now thanks!


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

All times are UTC - 8 hours


Who is online

Users browsing this forum: Google [Bot] 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