Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   i have a scripting question (https://forums.graalonline.com/forums/showthread.php?t=85572)

GULTHEX 05-15-2009 02:14 AM

i have a scripting question
 
okay
i was wondering
you know on era or on gun servers

you see a damage thing

it says how much damage you did to them

im curious

how would i make one of those

cbk1994 05-15-2009 03:00 AM

It's a GANI shown; usually a player attribute, but it can also be a showani. Tig recommended using a player attribute rather than a showani to me a while back.

Here's a hint; since it's a GANI, you can peek inside Era's. It was written by Skyld, and it's in use on GK and Era, so you shouldn't just copy it. Just get some "ideas" from it.

PHP Code:

GANI0001
SPRITE    0         SPRITES   24    0   16    8 sprite

SINGLEDIRECTION
DEFAULTHEAD head19
.png
DEFAULTBODY body
.png

SCRIPT
function getAlignmentShadowColor(redgreenblue)
{
  if (
red 0.75 || green 0.75)
  {  
    
red2 0
    
green2 0
  }
    else
  { 
    
red2 1
    
green2 1
  } 

  return {
red2green2blue};
}

function 
onCreated()
{
  if (
client.dmgdisplay)
  {
    return;
  }

  
temp.ix 1;

  
this.styles = {
    
// {checktype, textcheck, r, g, b, zoom}
    // check type is 1 for params[0].starts(check)
    //            or 0 for params[0] == check
    
{1"+"00.311},
    {
0"No damage"11, (client.yellow 1), 0.65},
    {
1"-"1001},
    {
0"Dead"1001},
    {
1"*"0101},
    {
1"^"0.210.21}
  };

  for (
temp.2temp.>= 0temp.-= 0.1)
  {
    
this.alpha = (temp.temp.1);

    
showtext(temp.ix1.5, (2) + temp.i"""bc"params[0]);
    
changeimgvis(temp.ix2);
    
changeimgzoom(temp.ix0.9);
    
changeimgcolors(temp.ix111this.alpha);

    
showtext(temp.ix 11.6, (2) + temp.0.05"""bc"params[0]);
    
changeimgvis(temp.ix 11);
    
changeimgzoom(temp.ix 10.9);
    
changeimgcolors(temp.ix 1000this.alpha);

    for (
temp.stylethis.styles)
    {
      if (
temp.style[0] == 1)
      {
        
temp.cond params[0].starts(temp.style[1]);
      }
        else
      {
        
temp.cond params[0] == temp.style[1];
      }
    
      if (
temp.cond)
      {
        
changeimgcolors(temp.ixtemp.style[2], temp.style[3], temp.style[4], this.alpha);
        
changeimgzoom(temp.ixtemp.style[5]);
        
changeimgzoom(temp.ix 1temp.style[5]);

        
this.shadow getAlignmentShadowColor(temp.style[2], temp.style[3], temp.style[4]);
        
changeimgcolors(temp.ix 1this.shadow[0], this.shadow[1], this.shadow[2], this.alpha);

        break;
      }
    }

    
sleep(0.05);
  }

  
hideimgs(temp.ixtemp.ix 1);
}
SCRIPTEND

ANI
ANIEND 


Admins 05-15-2009 08:50 PM

To use that gani you could do something like this I think:

Save the script as mydamage.gani, then set
player.attr[10] = "mydamage.gani,100";
(10 can be any number between 1 and 30, 100 is the damage shown)
That is attaching the script to the player.

The player.attr[10] is then set to "" (empty string) again after a few seconds for clearing it, then when setting the player.attr[10] to "mydamage.gani,100" again later then onCreated() is called again.

GULTHEX 05-19-2009 02:00 AM

thanks for your help guys :)


All times are GMT +2. The time now is 10:59 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.