Can I please suggest that we have more control over how an npc corpse is dressed? I think the core randomly discards some clothing or armour before it displays the corpse facing in one direction or another.
The reason I want to do this is because I want to clone a player into an npc, slay the npc and move the corpse so it can lie on a bed dressed as the player. Then I change the player graphic to something tiny so they are not aware it's them.
The v5 client at least allows the corpse to be moved, so this seems feasible as an idea - I've long wanted to be able to lie on a bed in the inne!
Failing that, does anyone know any other way of lying on a bed?
Control over Corpses
Hmm
How can you loop the last frame?
The packet after the animation number is:
BYTE[1] unknown1 (0x00)
BYTE[1] direction
BYTE[2] repeat (1 = once / 2 = twice / 0 = repeat forever)
BYTE[1] forward/backwards(0x00=forward, 0x01=backwards)
BYTE[1] repeat Flag (0 - Don't repeat / 1 repeat)
BYTE[1] frame Delay (0x00 - fastest / 0xFF - Too slow to watch)
I can only see how you could loop the entire sequence
How can you loop the last frame?
The packet after the animation number is:
BYTE[1] unknown1 (0x00)
BYTE[1] direction
BYTE[2] repeat (1 = once / 2 = twice / 0 = repeat forever)
BYTE[1] forward/backwards(0x00=forward, 0x01=backwards)
BYTE[1] repeat Flag (0 - Don't repeat / 1 repeat)
BYTE[1] frame Delay (0x00 - fastest / 0xFF - Too slow to watch)
I can only see how you could loop the entire sequence
I imagine if you set the framerate to be incredibly slow it will simply get an animation packet every second per player which may not be excessive at all even with a few players onscreen.
I don't want to give up on this idea - apparently runuo has it already?
I will keep trying. I have to get it working eventually, but so far playing it backwards isn't doing what I expected for the dying backwards animation (21 decimal)
I don't want to give up on this idea - apparently runuo has it already?
I will keep trying. I have to get it working eventually, but so far playing it backwards isn't doing what I expected for the dying backwards animation (21 decimal)
The clothing is based on what the mobile was wearing before it died.
Make an npc and conceal it - equip it with matching stuff the player had - graphic, color and name. Set all those items once equipped to movable = 0 to keep people from stripping it.
You can then make the corpse movable and adjust its Z position to be above the bed and change its facing to go the right way.
Make an npc and conceal it - equip it with matching stuff the player had - graphic, color and name. Set all those items once equipped to movable = 0 to keep people from stripping it.
You can then make the corpse movable and adjust its Z position to be above the bed and change its facing to go the right way.
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
You would need to put this in a logon.src too:
EraseObjProperty(character, "#liedown");
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: Select all
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
EraseObjProperty(character, "#liedown");