Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-15-2009, 02:14 AM
GULTHEX GULTHEX is offline
Registered User
Join Date: Jul 2008
Posts: 148
GULTHEX can only hope to improve
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
Reply With Quote
  #2  
Old 05-15-2009, 03:00 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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 
__________________
Reply With Quote
  #3  
Old 05-15-2009, 08:50 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
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.
Reply With Quote
  #4  
Old 05-19-2009, 02:00 AM
GULTHEX GULTHEX is offline
Registered User
Join Date: Jul 2008
Posts: 148
GULTHEX can only hope to improve
thanks for your help guys
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:50 AM.


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