Well here is a dot command I wrote that seems to do the animation thing sort of okay.
It's based on the packets.inc file most people might have. Oh, and I know there are better ways of doing fixPacketLength - it was just a test after all
Code:
use uo;
use polsys;
use os;
program txt_testliedown(character, parm)
if ( GetObjProperty(character, "#liedown") )
return 0;
endif
SetObjProperty(character, "#liedown", 1);
var x := character.x;
var y := character.y;
var z := character.z;
var height := 4;
if ( parm )
if ( CInt(parm) <= 9 and CInt(parm) > 0 )
height := CInt(parm);
endif
else
SendSysMessage(character, "You can use a number between 1 and 9 to set the height. Default is 4");
endif
MoveObjectToLocation(character, x, y, z + height, character.realm, MOVEOBJECT_FORCELOCATION);
while ( character )
PlayCharAnim(character);
sleepms(500);
if ( character.x != x or character.y != y )
break;
endif
sleepms(500);
if ( character.x != x or character.y != y )
break;
endif
sleepms(500);
if ( character.x != x or character.y != y )
break;
endif
sleepms(500);
if ( character.x != x or character.y != y )
break;
endif
endwhile
MoveObjectToLocation(character, x, y, z, character.realm, MOVEOBJECT_FORCELOCATION);
EraseObjProperty(character, "#liedown");
endprogram
function PlayCharAnim(who)
var dir := 1;
var speed := 30; //0 = fastest, 30 = way too slow
var doesrepeat := 0;
var framecount := 6; // seems to set the frame it uses?
var numrepeats := 1;
var packetString := "6E";
packetString := packetString + fixPacketLength(hex(who.serial), 4);
packetString := packetString + fixPacketLength(hex(21), 2); // animation
packetString := packetString + fixPacketLength(hex(framecount), 2); // frame count
packetString := packetString + fixPacketLength(hex(numrepeats), 2); // Repetition times
packetString := packetString + fixPacketLength(hex(dir), 1); // 00 == fwd, 01 == bkwd
packetString := packetString + fixPacketLength(hex(doesrepeat), 1); // Does this animation repeat? 01 == yes
packetString := packetString + fixPacketLength(hex(speed), 1); // frame delay
foreach chr in ListMobilesNearLocation(who.x, who.y, who.z, 16, who.realm);
SendPacket(chr, packetString);
endforeach
endfunction
///////////////////////////////////////////////////////////////
//Pads a string with a "0" prefix, until it is of proper length
// packetString value to pad.
// byteLength number of bytes. Byte counted as two chars.
///////////////////////////////////////////////////////////////
function fixPacketLength(packetString, byteLength)
if ( !packetString || packetString == error )
packetString := 0;
endif
packetString := CStr(packetString);
if ( packetString[1, 2] == "0x" )
packetString := CStr(packetString[3, len(packetString)]);
endif
if ( len(packetString) > byteLength * 2 )
// var extraBytes := (byteLength * 2) - len(packetString);
var extraBytes := len(packetString) - (byteLength * 2) + 1;
return CStr(packetString[extraBytes, len(packetString)]);
endif
while ( len(packetString) < byteLength * 2 )
packetString := "0" + packetString;
endwhile
return packetString;
endfunction
You would need to put this in a logon.src too:
EraseObjProperty(character, "#liedown");