PenUltima Online

It is currently Fri Aug 29, 2008 10:00 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Control over Corpses
PostPosted: Tue Apr 29, 2008 3:54 am 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 539
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?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 29, 2008 11:38 pm 
Offline
User avatar

Joined: Wed Sep 26, 2007 12:04 am
Posts: 3
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.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 30, 2008 6:39 am 
Offline

Joined: Tue Mar 20, 2007 7:17 am
Posts: 99
Location: Poland
Yes, Yes, It works, just play the animation backward and loop the last frame


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 01, 2008 4:05 am 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 539
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 01, 2008 7:15 am 
Offline

Joined: Tue Mar 20, 2007 7:17 am
Posts: 99
Location: Poland
first and last frame can be "looped"

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


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 01, 2008 12:33 pm 
Offline
POL Developer

Joined: Mon Jan 30, 2006 8:10 am
Posts: 69
That seems like it could be potentially very laggy. Does it not take a toll on performance? Even on large shards?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 01, 2008 4:10 pm 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 539
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)


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 01, 2008 4:27 pm 
Offline
POL Developer
User avatar

Joined: Wed Jan 25, 2006 2:30 am
Posts: 398
Location: San Diego, California
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.

_________________
-Austin


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 01, 2008 5:40 pm 
Offline
POL Developer

Joined: Mon Jan 30, 2006 8:10 am
Posts: 69
Corpse clothing does not always match the dead player's/npc's clothing, though. Unless that was recently changed and I missed it...?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 01, 2008 6:29 pm 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 539
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");


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 01, 2008 11:59 pm 
Offline

Joined: Tue Mar 20, 2007 7:17 am
Posts: 99
Location: Poland
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 :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 02, 2008 1:43 am 
Offline

Joined: Sat Feb 04, 2006 6:26 pm
Posts: 539
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl