ONEVENT: enterrange

ONEVENT: enterrange

Postby Derrick on Sun Oct 03, 2010 2:12 am

Most events are pretty well understood, but I recently stumbled across something i don't quite understand.

Most "enterrange" events take a single argument, the range; such as the following from prisoner.m:
Code: Select all
ONEVENT( enterrange , 0x01 )(object target)
{
  if(hasObjVar(this, "isPrisoner"))
  {
    bark(this, "Quickly, I beg thee! Unlock my chains! If thou dost look at me close thou canst see them.");
  }
  return(0x01);
}


But others, and possibly i haven't looked hard enough to see if this preceding argument is present in other events as well, take an integer preceding the range. Fom towncrier.m:
Code: Select all
ONEVENT( 400 , enterrange , 0x05 )(object target)
{
  if(numInList(Q63X) < 0x01)
  {
    return(0x01);
  }
  string Q65L = Q63X[random(0x00, numInList(Q63X) - 0x01)];
  faceHere(this, getDirectionInternal(getLocation(this), getLocation(target)));
  bark(this, "Hear ye! Hear ye!");
  bark(this, Q65L);
  return(0x01);
}

And this one is especially confounding, gasspurt.m:
Code: Select all
ONEVENT( 1000 , enterrange , 0x03 )(object target)
{
  if(isPlayer(target))
  {
    object player = target;
    location Q5IZ = getLocation(player);
    location Q5FI = getLocation(this);
    object Q4R7 = requestCreateObjectAt(0x11A6, Q5FI);
    sfx(Q5FI, 0x0108, 0x0107);
  }
  return(0x01);
}

ONEVENT( 250 , enterrange , 0x01 )(object target)
{
  if(isPlayer(target))
  {
    setPoisoned(target, 0x01);
    attachScript(target, "poisoned");
  }
  return(0x01)}

ONEVENT( 1000 , enterrange , 0x01 )(object target)
{
  if(isPlayer(target))
  {
    integer damage = random(0x01, 0x0A);
    location Q5FI = getLocation(this);
    object player = target;
    location Q5IZ = getLocation(player);
    doDamage(player, player, damage);
    sfx(Q5IZ, 0x014C, 0x014C);
    animateMobile(player, 0x14, 0x01, 0x01, 0x00, 0x00);
  }
  return(0x01)}

ONEVENT( 1000 , enterrange , 0x00 )(object target)
{
  if(isPlayer(target))
  {
    integer damage = random(0x01, 0x1E);
    location Q5IZ = getLocation(target);
    object player = target;
    doDamage(player, player, 0x1E);
    sfx(Q5IZ, 0x014C, 0x014C);
    setPoisoned(player, 0x01);
    attachScript(player, "poisoned");
  }
  return(0x00)}

I'm guessing this has something to do with timing, either limits or delays, I'm betting that i's a delay (in ticks?) that the mobile has to stick around before it triggers, but I have some doubts.

Here's another that indicates that:
Code: Select all
ONEVENT( 100 , enterrange , 0x01 )(object target)
{
  if(hasObjVar(this, "isWaitingForEscort"))
  {
    bark(this, "I am waiting for my escort to " + Q4RI(Q4O8) + ". If thou art interested, check the local bulletin board for details, or just say 'I will take thee.'");
  }
  return(0x01)}
Derrick
Site Admin
 
Posts: 250
Joined: Tue Jun 17, 2008 2:33 pm


Re: ONEVENT: enterrange

Postby Dies Irae on Sun Oct 03, 2010 8:20 am

I think the first parameter is the chance of trigger the event.

^_^
Dies Irae
 
Posts: 105
Joined: Sun Apr 19, 2009 8:49 am
Location: Gorizia - Italy


Re: ONEVENT: enterrange

Postby Garret on Sun Oct 03, 2010 8:48 am

Dies Irae, nice guess!
As i remember it was somewhere already about chances
Garret
 
Posts: 22
Joined: Thu Sep 24, 2009 1:43 pm
Location: Was Russia,Moscow; Currently Germany,Berlin


Re: ONEVENT: enterrange

Postby Batlin on Sun Oct 03, 2010 9:03 am

Hi guys.

The meaning of that value and related 'formula' was place here under "The event system": http://uodemo.joinuo.com/?title=Server_Code
<Derrick> RunUO AI is kind of a functional prototype, which i have hacked into something resembling OSI behavior, but only by complitcating everything
Batlin
Site Admin
 
Posts: 306
Joined: Wed Apr 08, 2009 6:35 am


Re: ONEVENT: enterrange

Postby Derrick on Sun Oct 03, 2010 6:09 pm

Nice. Thanks!

I'm glad I have learned to ask instead of guessing!
Derrick
Site Admin
 
Posts: 250
Joined: Tue Jun 17, 2008 2:33 pm



Return to UO Demo

Who is online

Users browsing this forum: No registered users and 1 guest