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 08-10-2011, 12:13 AM
Adddeeee Adddeeee is offline
Registered User
Join Date: Aug 2011
Posts: 30
Adddeeee is on a distinguished road
Finimg, showimg, hideimg index?

Hi!

Thinking of creating a health system. I searched the forum and have come to the conclusion that I need to use findimg(), hideimg() and showimg().

When using either I need to specify an index. I need to know the index of the "heart" images in order to hide them and display any other images instead.

Where do I find all the indexes of the default images drawn on the screen?

And does it matter what index I put to my own "hearts" images?

Thank you
Reply With Quote
  #2  
Old 08-10-2011, 12:23 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Thats handled by something different. You can find how to modify those graphics via http://wiki.graal.net/index.php/Showstats
Reply With Quote
  #3  
Old 08-10-2011, 12:43 AM
Adddeeee Adddeeee is offline
Registered User
Join Date: Aug 2011
Posts: 30
Adddeeee is on a distinguished road
Ahaaa...thought that was for hiding the hearts shown over the players head when hit.

But what if I want to add new images? Can I choose whaterver index I want to? Doesn't it exist any list with restricted indexes?
Reply With Quote
  #4  
Old 08-10-2011, 12:50 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Indexes up to 200 can be seen by all players. Starting with 201+, only the local player will see the images. Just remember to use layer 4 so they draw to GUI layer rather than tile layer.

What happens with an image under 201 but on layer 4? I'm not rightly sure
Reply With Quote
  #5  
Old 08-10-2011, 12:52 AM
Adddeeee Adddeeee is offline
Registered User
Join Date: Aug 2011
Posts: 30
Adddeeee is on a distinguished road
Okay Where do I deside the layer no. ?

Thanks!
Reply With Quote
  #6  
Old 08-10-2011, 12:57 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
This is the documentation for findimg:

TServerNPC.findimg(int) - returns object

It, more specifically, returns a TShowImg, which is a type of object.



Let's see what we can do with TShowImgs... type /scripthelp TShowImg in RC.

A bunch of stuff should pop up, including something like...

TShowImg.layer - integer

This is what we want.



So to actually use this information:

PHP Code:
temp.findimg(201);
temp.i.layer 4
Reply With Quote
  #7  
Old 08-10-2011, 01:02 AM
Adddeeee Adddeeee is offline
Registered User
Join Date: Aug 2011
Posts: 30
Adddeeee is on a distinguished road
Thank you Feeling kind of dumb now when you just find all that info in such a short time! Still struggling to get used to the detective work that has to be done!

But I'm getting there! Thank you all !
Reply With Quote
  #8  
Old 08-10-2011, 01:12 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
No problem. Much of GS2 mastery is gaining familiarity with all the functions and quirks of the language. /scripthelp goes a long way but hardly the whole way. The various wikis (http://wiki.graal.net and http://wiki.graal.us) are also useful.
Reply With Quote
  #9  
Old 08-11-2011, 02:00 PM
Adddeeee Adddeeee is offline
Registered User
Join Date: Aug 2011
Posts: 30
Adddeeee is on a distinguished road
Thank you for your replies earlier

I managed to get my own images shown instead of the default hearts. Although, we've decided to use a health bar instead of just images.

But I'm not really a fan of the onTimeout function used. Feels like it could be done without a timer running constantly?

Isn't there any event that handels onPlayerHurt or do I need to write such an event by myself?

Here's the code we use:

PHP Code:
//#CLIENTSIDE
function onCreated()
{
  new 
GuiControlProfile("TextProfile"
  {
    
fontcolor "0 0 0";
    
fonttype "Arial";
    
fontsize 25;
    
fontstyle "b";
  }
    
  new 
GuiProgressCtrl("HealthControl_Bar"
  {
    
profile GuiBlueProgressProfile;
    
width 360;
    
height 40;
    
screenwidth width 20;
    
10;
    
progress player.hearts/player.fullhearts;
    
    new 
GuiTextCtrl("HealthConrol_Text"
    {
      
profile TextProfile;
      
HealthControl_Bar.width this.width 2;
      
10;
      
height 20;
      
width 80;
      
text player.hearts SPC "/" SPC player.fullhearts;
    } 
  }
  
  
onTimeout();
}

function 
onTimeout()
{
  
HealthControl_Bar player.hearts/player.fullhearts;
  
HealthControl_Text.text player.hearts SPC "/" SPC player.fullhearts;
  
setTimer(0.5);

Reply With Quote
  #10  
Old 08-11-2011, 02:11 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
ya, it's onPlayerHurt
Reply With Quote
  #11  
Old 08-11-2011, 02:25 PM
Adddeeee Adddeeee is offline
Registered User
Join Date: Aug 2011
Posts: 30
Adddeeee is on a distinguished road
Ah thank you

This may be a little OT, but do you know where to find a list of all the default events? And even more OT, do you know where to find a list of the default client flags?

Thank you!
Reply With Quote
  #12  
Old 08-11-2011, 03:41 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You can find a list of events in commands.rtf (GS1, just convert them to GS2), found in your Graal folder provided you installed the level editor.

Search: playerhurt

You can find player flags in scriptfunctions_client.txt, generated by Graal.exe when you start it with the -listscriptfunctions parameter. Attached it for you anyway.

Search: TServerPlayer
Attached Files
File Type: txt scriptfunctions_client.txt (101.7 KB, 979 views)
__________________
Quote:
Reply With Quote
  #13  
Old 08-11-2011, 03:45 PM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by Adddeeee View Post
Ah thank you

This may be a little OT, but do you know where to find a list of all the default events? And even more OT, do you know where to find a list of the default client flags?

Thank you!
http://gscript.graal.net/Index
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #14  
Old 08-11-2011, 05:06 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Adddeeee View Post
Unable to find the onPlayerHurt in the events category. It doesn't exist any after all? Also, I can't seem to find any default client flags. Or aybe there are no default client flags available?
The documentation just isn't complete.

Edit: I guess you found the client flags.
__________________
Quote:
Reply With Quote
  #15  
Old 08-11-2011, 08:22 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by fowlplay4 View Post
You can find a list of events in commands.rtf (GS1, just convert them to GS2), found in your Graal folder provided you installed the level editor.

Search: playerhurt

You can find player flags in scriptfunctions_client.txt, generated by Graal.exe when you start it with the -listscriptfunctions parameter. Attached it for you anyway.

Search: TServerPlayer
I think this is also very helpful for commands. I don´t know if it includes events but I think it got the basic stuff which would be important

New GS2 commands.rtf
__________________
MEEP!
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 04:17 PM.


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