Colored animations

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 095. Note: Core 095 is no longer officially supported.

Moderator: POL Developer

Post Reply
Wille

Colored animations

Post by Wille »

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.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Post by Yukiko »

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: Select all

// 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.
Last edited by Yukiko on Tue Aug 29, 2006 7:41 am, edited 4 times in total.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Post by Yukiko »

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 :
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: Select all

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.
Wille

Post by Wille »

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.
Wille

Post by Wille »

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?
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am
Location: Myrtle Beach, South Carolina

Post by MontuZ »

Post Reply