PenUltima Online

It is currently Fri Sep 05, 2008 5:03 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Colored animations
PostPosted: Tue Aug 29, 2006 5:18 am 
Hello.

I remember seeing an include file made by Muaddib (not 100% sure), that had functions for using colored/hued animations.

I.e. PlayColoredMovingEffect(source,target,speed,id,expl,hue) or similar.

I tried to find it now, but I was unable to, so if anyone knows where to find it or a similar include/package to do the job I'd appreciate the info.


Top
  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 7:15 am 
Offline

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1122
Location: Southern Central USA
I found this in an old thread I had saved from the POL Forums. Original thread was started on Tue Jul 29, 2003 7:28 pm. It was originally posted by Anarchic.

Code:
// Posted: Wed Jul 30, 2003 9:00 am 
function PlayEffectHuefx(source,dest,type,effect,speed,duration,fix,explo,color,render)
  var packetString := "C0"+type+fixPacketLength(hex(source.serial),4)+fixPacketLength(hex(dest.serial),4)
  +effect+fixPacketLength(hex(source.x),2)+fixPacketLength(hex(source.y),2)+fixPacketLength(hex(source.z),1)
  +fixPacketLength(hex(dest.x),2)+fixPacketLength(hex(dest.y),2)+fixPacketLength(hex(dest.z),1)
  +fixPacketLength(hex(speed),1)+fixPacketLength(hex(duration),1)
  +"0000"+fix+explo+fixPacketLength(hex(color),4)+render;
  foreach mobile in ListObjectsInBox(source.x-20,source.y-20,source.z-120,source.x+20,source.y+20,source.z+120)
    if (mobile.ip)
      sendPacket(mobile,packetString);
    endif
  endforeach
endfunction


I am looking for the one by Maud. I remember the one you are talking about. Will take me a while to gather all the old posts I have saved together to search them.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Last edited by Yukiko on Tue Aug 29, 2006 7:41 am, edited 4 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 7:37 am 
Offline

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1122
Location: Southern Central USA
Unable to find Maud's original post but here is some more from the above referenced thread.


And here is another post by Maeglin from that same thread. Posted: Tue Jun 29, 2004 1:24 am :

Quote:
I have been able to decipher Anarchic's code, and make it some more usefull form:
//---------------------------------------
use uo;
var whos;
program sfxhue(who, text)
whos := who;
text := SplitWords(text);
if(!text)
return;
endif
var cel := Target(who);
var cel2 := Target(who);
var type := text[1];
if(!type)
type := "0";
endif
var effect := cint(text[2]);
if(!effect)
effect := 0;
endif
var speed := cint(text[3]);
if(!speed)
speed := 0;
endif
var duration := cint(text[4]);
if(!duration)
duration := 0;
endif
var fix := text[5];
if(!fix)
fix := "0";
endif
var explo := text[6];
if(!explo)
explo := "0";
endif
var color := cint(text[7]);
if(!color)
color := 0;
endif
var render := text[8];
if(!render)
render := "0";
endif

PlayEffectHuefx(cel,cel2,type,effect,speed,duration,fix,explo,color,render);

endprogram

function PlayEffectHuefx(source,dest,type,effect,speed,duration,fix,explo,color,render)
var packetString := "C0"+fixdpacketlength(type, 1)+fixPacketLength(hex(source.serial),4)+fixPacketLength(hex(dest.serial),4)
+effect+fixPacketLength(hex(source.x),2)+fixPacketLength(hex(source.y),2)+fixPacketLength(hex(source.z),1)
+fixPacketLength(hex(dest.x),2)+fixPacketLength(hex(dest.y),2)+fixPacketLength(hex(dest.z),1)
+fixPacketLength(hex(speed),1)+fixPacketLength(hex(duration),1)
+"0000"+fixdpacketlength(fix, 1)+fixdpacketlength(explo, 1)+fixPacketLength(hex(color),4)+fixdpacketlength(render, 1);
foreach mobile in ListObjectsInBox(source.x-20,source.y-20,source.z-120,source.x+20,source.y+20,source.z+120)
if (mobile.ip)
sendsysmessage(whos, packetstring);
sendPacket(mobile,packetString);
endif
endforeach
endfunction

function fixpacketlength(text, length)
var dlugosc := len(text) - 2;
var pocz := 3;
length := length * 2;
text := text[pocz, dlugosc];
while(dlugosc < length)
text := "0" + text;
dlugosc := len(text);
endwhile
return text;
endfunction

function fixdpacketlength(text, length)
var dlugosc := len(text);
var pocz := 1;
length := length * 2;
text := text[pocz, dlugosc];
while(dlugosc < length)
text := "0" + text;
dlugosc := len(text);
endwhile
return text;
endfunction
//-----------------------------------------
I did this program only to test this function, it now can make a lightningbolt effect, sometimes make an explosion, but still doesn't work like it's supposed to. Someone can take it from here and maybe make it work ;]



This was posted by Damnation. Posted: Tue Jun 29, 2004 1:37 am :

Code:
function PlayStationaryParticleEffect( source, zmod, effect, exploeffect:=0, particle, speed, duration:=0,
explode:=0, hue:=0,trans:=0, layer := "0xFF")

  var packetString := "C7";
  packetString := packetString + "02";
  packetString := packetString + fixPacketLength(source.serial,4);
  packetString := packetString + fixPacketLength(hex(0),4);
  packetString := packetString + fixPacketLength(hex(effect),2);
  packetString := packetString + fixPacketLength(hex(source.x),2);
  packetString := packetString + fixPacketLength(hex(source.y),2);
  packetString := packetString + fixPacketLength(hex((source.z+zmod)),1);
  packetString := packetString + fixPacketLength(hex(0),5);
  packetString := packetString + fixPacketLength(hex(speed),1);    // Speed of Animation
  packetString := packetString + fixPacketLength(hex(duration),1); // Duration
  packetString := packetString + "000000";                         // This is in place of the
                                                                   // Unknown and Fixed Direction portion
  packetString := packetString + fixPacketLength(hex(explode),1);  // Explode
  packetString := packetString + fixPacketLength(hex(hue),4);      // Color
  packetString := packetString + fixPacketLength(hex(trans),4);    // Transparency Level
  packetString := packetString + fixPacketLength(hex(particle),2); // effect (see particleffect subdir!)
  packetString := packetString + fixPacketLength(hex(exploeffect),2);  // Explode Effect ID
  // additional effect #, only used for moving effects, 0 otherwise
  // and since this is the non-moving type, tis 0 here.
  packetString := packetString + "0000";
  packetString := packetString + fixPacketLength(source.serial,4);
  // layer (of the character, e.g left hand, right hand, 0-4, 0xff: moving effect or target is no char)
  packetString := packetString + fixPacketLength(layer,2);
  packetString := packetString + "0000";
  foreach chr in ListMobilesNearLocation( source.x, source.y, source.z, 16 );
    SendPacket( chr, packetString );
  endforeach

endfunction



Hope this helps.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 8:15 am 
Thanks, I'll see if I can derive something out of these.

I already had the general idea how this should work using packets, however I'm unsure about the "Type" and "Rendermode" parts of the 0xC0 packet. What are valid entries for those?

So far I've only managed to freeze the walking animation of my character shortly after sending the packet, using 0, 1 or 2 for the render and type, and the combinations of those.

[Edit]

I managed to get the animations work, and I will post the code here once I've finished it proper for use.


Top
  
 
 Post subject:
PostPosted: Tue Aug 29, 2006 10:56 am 
A few more issues still seem to be problematic:

1. I am unable to find the type, or any other value combination that would determine whether the animation displayed uses the coordinates included in the packet or the coordinates of the objects who's serials are included in the packet.

I.e. Will it use me.serial and target.serial or x1, y1, z1 and x2, y2, z2 to determine the beginning and end points of the animation.

I did succeed to use the coordinates at some point, however I seem to be unable to reproduce the sequence.

2. World coordinates sometimes decrease below 0 and in my method of adding values to the packet string require converting the values into a hexadecimal at some point, however as far as I know hexadecimals do not support negative numbers. Because of this the conversion of -n always equals FFFFFFFF, and when included in the pkg it crashes the client.

Therefore I ask, if there is any method to include negative numbers as coordinates in the packet?


Top
  
 
 Post subject:
PostPosted: Fri Jun 01, 2007 2:14 pm 
Online
Distro Developer
User avatar

Joined: Fri Feb 10, 2006 8:08 am
Posts: 313
Location: Myrtle Beach, South Carolina
http://forums.polserver.com/viewtopic.php?t=1599


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

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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