Page 1 of 1

monsters go out dungeons

Posted: Tue Sep 30, 2008 10:00 am
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

Re: monsters go out dungeons

Posted: Tue Sep 30, 2008 10:10 am
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

Re: monsters go out dungeons

Posted: Tue Sep 30, 2008 10:31 am
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

Re: monsters go out dungeons

Posted: Wed Oct 01, 2008 12:34 am
by BELL
im in shock... all mobs free teleported on walk.... ideas?

Re: monsters go out dungeons

Posted: Thu Oct 02, 2008 1:15 am
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