monsters go out dungeons

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 097.
Note: Core 097 is no longer officially supported.
Post Reply
BELL
Journeyman Poster
Posts: 68
Joined: Tue Apr 22, 2008 6:09 am

monsters go out dungeons

Post by BELL »

itemdecs

Code: Select all

# System teleporter
Item 0x6200
{
    Name                systemteleporter
    Desc                System Teleporter
    Graphic             0x1ea7
    WalkOnScript        dungTele
    Movable             0
    Invisible           1
    SaveOnExit	      1
}
dungTele

Code: Select all

  if((mobile.npctemplate) && (mobile.script != "employed") && (mobile.script != "tamed") && (mobile.script != "escortee"))
    return;
  endif
bun monsters free teleported on walk systeleporters.... dragons, zombie, skeletons,spiders.. all
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Re: monsters go out dungeons

Post by Austin »

Id suggest making a CanTele function instead

Code: Select all


program WalkOnTile(mobile, tile, orig_x, orig_y, orig_z)
   if ( !CanTeleport(mobile) )
        return 0;
   endif

   //... remaining code here to do the moving and such
endprogram

function CanTeleport(mobile)
   if ( mobile.acctname ) // player
        return 1;
   elseif ( mobile.npctemplate )
      if ( mobile.script == "employed" )
         return 1;
      elseif ( mobile.script == "tamed" )
         return 1;
      elseif ( mobile.script == "escortee" )
         return 1;
      else
          return 0;
      endif
   endif
endfunction
BELL
Journeyman Poster
Posts: 68
Joined: Tue Apr 22, 2008 6:09 am

Re: monsters go out dungeons

Post by BELL »

im copypaste your code))) but not... unload scripts.. skeleton walk and teleported))

Code: Select all

use os;
use uo;

include "include/client";
include "include/attributes";

program walk_on_moongate(mobile, gate)
   if ( !CanTeleport(mobile))
        return 0;
   endif
  var magery := CInt(GetObjProperty(gate,"magery"));
  if((magery) && (mobile.acctname))
    if(GetEffectiveSkill(mobile, SKILLID_MAGERY) < magery)
      SendSysMessage(mobile,"your knowledge of the arcane arts is too low to traverse this gate.");
      return;
    endif
  endif
  set_critical(1);
  if(GetObjProperty(mobile, "#justgated"))
	return;
  endif
  var x, y, z;
  x := GetObjProperty( gate, "DestX" );
  y := GetObjProperty( gate, "DestY" );
  z := GetObjProperty( gate, "DestZ" );
  foreach critter in ListMobilesNearLocation( gate.x, gate.y, gate.z, 8);
    if(((critter.script == "employed") && (CInt(GetObjProperty(critter, "master")) == mobile.serial)) || ((critter.script == "escortee") && (CInt(GetObjProperty(critter, "Escortee")) == mobile.serial)) || ((critter.script == "tamed") && (CInt(GetObjProperty(critter, "master")) == mobile.serial)))
      SetObjProperty(critter, "Pause", 1);
      MoveCharacterToLocation( critter, gate.x, gate.y, gate.z, MOVECHAR_FORCELOCATION);
      EraseObjProperty(critter, "Pause");
    endif
  endforeach
  SetObjProperty(mobile,"#justgated",1);
  MoveCharacterToLocation(mobile, x, y, z );
  sleep(1);
  EraseObjProperty(mobile,"#justgated");
endprogram

function CanTeleport(mobile)
   if ( mobile.acctname ) // player
        return 1;
   elseif ( mobile.npctemplate )
      if ( mobile.script == "employed" )
         return 1;
      elseif ( mobile.script == "tamed" )
         return 1;
      elseif ( mobile.script == "escortee" )
         return 1;
      else
          return 0;
      endif
   endif
endfunction
BELL
Journeyman Poster
Posts: 68
Joined: Tue Apr 22, 2008 6:09 am

Re: monsters go out dungeons

Post by BELL »

im in shock... all mobs free teleported on walk.... ideas?
Justae
Expert Poster
Posts: 79
Joined: Thu May 24, 2007 2:12 pm

Re: monsters go out dungeons

Post by Justae »

Just a quick glance through the code, I suggest changing the function to :

Code: Select all

function CanTeleport(mobile)

   if ( mobile.acctname ) // player
        return 1;
   elseif ( mobile.npctemplate )
      if ( mobile.script == "employed" )
         return 1;
      elseif ( mobile.script == "tamed" )
         return 1;
      elseif ( mobile.script == "escortee" )
         return 1;
      endif

      //  All necessary checking has been done, so this condition must 
      //  be true if script gets this far.

      return 0;
   
   endif

endfunction
I have not tested it, but I am almost sure your problem lays with that last section in the function.

Regards
Justae
Post Reply