Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-23-2007, 07:21 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Gani Solutions!

Ive come up to a solution to all the resent gani problems, mainly that a gani is not able to read data from other players. I'll refer to the HUD gani I made on Mythic (most parts of it have been removed though).


This is a non-working example of it:

PHP Code:
player.attr[20] = "ml_hud.gani"
PHP Code:
function onPlayerEnters() setTimer(.05);

function 
onTimeOut()

  if (
mousex in |player..5player.2.5| && mousey in |player.1player.3|) {
    
hideimgs(300309);
    
ShowHUD();
    for (
04++) changeimgzoom(300 i.7);
  }

  
setTimer(.05);
}

function 
ShowHUD()
{
  
showimg(304"ml_gui-hphud.png"player.1.5 getimgwidth("ml_gui-hphud.png")/16/2player.1.5 - (19/16)/2);
  
showimg(305"ml_gui-hphud.png"player.1.5 getimgwidth("ml_gui-hphud.png")/16/6/16player.1.5 - (19/16)/4/16);

  
changeimgpart(304003713);
  
changeimgpart(30501424/(player.fullhearts/player.hearts) + 15);

  
changeimgvis(3053);

This example will not work since apparently, player.fullhearts is not readable for other players along with several other things. So with this, you will only be able to see your own health bar.

However, you can easily create an array-like player.attr and store the data in that.

PHP Code:
player.attr[20] = "ml_hud.gani";
player.attr[21] = @{player.heartsplayer.fullhearts}; 
PHP Code:
function onPlayerEnters() setTimer(.05);

function 
onTimeOut()

  if (
mousex in |player..5player.2.5| && mousey in |player.1player.3|) {
    
hideimgs(300309);
    
ShowHUD();
    for (
04++) changeimgzoom(300 i.7);
  }

  
setTimer(.05);
}

function 
ShowHUD()
{
  
showimg(304"ml_gui-hphud.png"player.1.5 getimgwidth("ml_gui-hphud.png")/16/2player.1.5 - (19/16)/2);
  
showimg(305"ml_gui-hphud.png"player.1.5 getimgwidth("ml_gui-hphud.png")/16/6/16player.1.5 - (19/16)/4/16);

  
changeimgpart(304003713);
  
changeimgpart(30501424/(player.attr[21].tokenize()[1]/player.attr[21].tokenize()[0]) + 15);

  
changeimgvis(3053);

This example, will work. Not only for the current player, you will be able to see other player's health bars as well. Remember that you have to update player.attr[21] every time that the player's HP changes, possibly in a timeout.


NOTE: Whenever you use onCreated() in a gani, it will only be triggered the FIRST time the gani is shown. If you do onPlayerEnters(), it will be triggered every time you enter a level AND when you update the script of the gani.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
 


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 06:23 AM.


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