PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
Control over Corpses

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> Feature Suggestions
Display posts from previous:   

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 517

PostPosted: Tue Apr 29, 2008 7:54 am    Post subject: Control over Corpses Reply with quote

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?

Author Message
Nobono



Joined: 26 Sep 2007
Posts: 3

PostPosted: Wed Apr 30, 2008 3:38 am    Post subject: Reply with quote

I'm no scripter so this may be totally pointless but... How about forcing the "fall down" anim frame via packets and moving the player on the bed?

I think I've heard smth like that work somwhere, but have no clue if it really would work.

Author Message
coltain



Joined: 20 Mar 2007
Posts: 96
Location: Poland

PostPosted: Wed Apr 30, 2008 10:39 am    Post subject: Reply with quote

Yes, Yes, It works, just play the animation backward and loop the last frame

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 517

PostPosted: Thu May 01, 2008 8:05 am    Post subject: Reply with quote

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

Author Message
coltain



Joined: 20 Mar 2007
Posts: 96
Location: Poland

PostPosted: Thu May 01, 2008 11:15 am    Post subject: Reply with quote

first and last frame can be "looped"

juzst play animation slowly and send packet faster then delay between frames

Author Message
Luth
POL Developer


Joined: 30 Jan 2006
Posts: 35

PostPosted: Thu May 01, 2008 4:33 pm    Post subject: Reply with quote

That seems like it could be potentially very laggy. Does it not take a toll on performance? Even on large shards?

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 517

PostPosted: Thu May 01, 2008 8:10 pm    Post subject: Reply with quote

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)

Author Message
Austin
POL Developer


Joined: 30 Jan 2006
Posts: 354
Location: San Diego, California

PostPosted: Thu May 01, 2008 8:27 pm    Post subject: Reply with quote

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.

Author Message
Luth
POL Developer


Joined: 30 Jan 2006
Posts: 35

PostPosted: Thu May 01, 2008 9:40 pm    Post subject: Reply with quote

Corpse clothing does not always match the dead player's/npc's clothing, though. Unless that was recently changed and I missed it...?

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 517

PostPosted: Thu May 01, 2008 10:29 pm    Post subject: Reply with quote

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 Smile

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");

Author Message
coltain



Joined: 20 Mar 2007
Posts: 96
Location: Poland

PostPosted: Fri May 02, 2008 3:59 am    Post subject: Reply with quote

OldnGrey

I just prepared my "bed script" to put it in here, but since You did it....

I sit laggy? Not at all, its just an animation to play every 300ms (or another setting)

I solved it this way... If somebody have another idea please share Smile

Author Message
OldnGrey



Joined: 04 Feb 2006
Posts: 517

PostPosted: Fri May 02, 2008 5:43 am    Post subject: Reply with quote

Oh I'd love to see another solution too. My script was the result of only a few hours of playtesting among our staff and trying to get them to look right on a bed without making them go up one storey. It has rudimentary checks for exploits but won't be as good as a well tested script.

Post new topic   Reply to topic    PenUltima Online Forum Index -> Feature Suggestions All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty