![]() |
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 :) |
Thats handled by something different. You can find how to modify those graphics via http://wiki.graal.net/index.php/Showstats
|
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? |
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 :confused: |
Okay :) Where do I deside the layer no. ?
Thanks! |
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:
|
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 ! :) |
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.
|
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:
|
ya, it's onPlayerHurt
|
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! |
1 Attachment(s)
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 |
Quote:
|
Quote:
Edit: I guess you found the client flags. |
Quote:
New GS2 commands.rtf |
Thank you! That updated commands.rtf helped a lot :)
|
function onPlayerHurt definitely invokes on the clientside if you were still having issues with it.
However, you will need to rescript how healing works on your server (namely detecting if a player is in a bed and changing the heart drop items? rescript pots?) so that it would throw an event or trigger the health display to update as well if you don't want to use a timeout |
Hm...it works part time.
The player.chat works, but the GUI doesn't update. PHP Code:
|
I would recommend checking the names in your GUI.
Particularly: new GuiTextCtrl("HealthConrol_Text") |
You seem to have missed something.
Change PHP Code:
PHP Code:
|
Quote:
|
Oh my, isn't that clumsy!
Should've double checked those things before I posted. Really sorry for taking up your time with spelling errors :S Thank you though, it works now :) |
| All times are GMT +2. The time now is 09:32 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.