Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Help (https://forums.graalonline.com/forums/showthread.php?t=71998)

ZeekTheMan2 02-06-2007 07:15 AM

Help
 
Can somebody help me with this why is its hiding everything accept the names of the players?

PHP Code:

Function onCreated()
{
 
onTimeout();
}
function 
onTimeout(){
 
showstats(1024);
}
setTimer(0.05); 


Twinny 02-06-2007 07:45 AM

Showstats
PHP Code:

1      ASD
2     Icons 
(for rupeesbombsarrows)
4     Rupees count
8     Bombs count
0x10     Arrows count
0x20     Hearts
0x40     Alignment 
(apbar
0x80     Magic points 
(mpbar
0x100     Minimap 
(you can only hide ityou can't show it when the player pressed Alt+3)
0x200     Inventory NPCs
0x400     Players
0x800     Right-click on players opens their profile
allstats     All of the previously stated stats flags enabled 

Also, what's the point of having show stats in a timeout?

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
showstats(allstats 0x80 0x40);



Chandler 02-07-2007 10:56 AM

I recommend doing it inside a //onPlayerEnters()// to make sure that it stays that way.

Gambet 02-08-2007 05:23 PM

So just add...

PHP Code:

function onPlayerEnters()
{
  
onCreated();



...to the bottom.

Chandler 02-08-2007 05:28 PM

Quote:

Originally Posted by Gambet (Post 1274933)
So just add...

PHP Code:

function onPlayerEnters()
{
  
onCreated();



...to the bottom.

This would be more efficient.
HTML Code:

function onCreated()
{
  this.onPlayerEnters();
}
function onPlayerEnters()
{
  showStats(1024);
}


Gambet 02-08-2007 05:56 PM

I don't see how there's a difference, both functions are called regardless.

JkWhoSaysNi 02-08-2007 06:27 PM

Yeah but onCreated() is only called once. onPlayerEnters is called every time a player enters the level so it gets called more.

Gambet 02-08-2007 06:32 PM

Quote:

Originally Posted by JkWhoSaysNi (Post 1274955)
Yeah but onCreated() is only called once. onPlayerEnters is called every time a player enters the level so it gets called more.


Doesn't matter though, since when you enter it will call onCreated if you make it call onCreated when you enter either way, thus allowing you to set it up in the onCreated instead of the onPlayerEnters.

Chandler 02-08-2007 07:59 PM

If you don't understand, that's your own fault. We're correct.

Gambet 02-08-2007 08:16 PM

Quote:

Originally Posted by Chandler (Post 1274979)
If you don't understand, that's your own fault. We're correct.


If you can't explain it, then it's the same as not understanding.

Chandler 02-08-2007 08:18 PM

Quote:

Originally Posted by Gambet (Post 1274983)
If you can't explain it, then it's the same as not understanding.

What isn't there to understand?
As far as I can see it, "JkWhoSaysNi" explained it. ;)

JkWhoSaysNi 02-08-2007 08:41 PM

Quote:

Originally Posted by Gambet (Post 1274983)
If you can't explain it, then it's the same as not understanding.



Ok, consider:

a:
PHP Code:

function onPlayerEnters()
{
  
onCreated();


b:
PHP Code:

function onCreated()
{
  
onPlayerEnters();



Now, if a player enters the level with

a: onPlayerEnters() gets called and onCreated() gets called then the rest of the script gets executed

b: onPlayerEnters() gets called and the rest of the script executes.

Since onPlayerEnters will get called more than onCreated() b is the most efficient.

I don't think i can explain it any clearer than that.

Tolnaftate2004 02-08-2007 09:23 PM

You're both wrong. You should only need to call showstats once. If it doesn't stay as you set it, there's another script interfering.

And it's good practice to not call onCreated().

Chandler 02-08-2007 09:32 PM

Quote:

Originally Posted by Tolnaftate2004 (Post 1274999)
You're both wrong. You should only need to call showstats once. If it doesn't stay as you set it, there's another script interfering.

And it's good practice to not call onCreated().

I assure you, try this on a playerworld^^

Tolnaftate2004 02-08-2007 10:45 PM

Quote:

Originally Posted by Chandler (Post 1275006)
I assure you, try this on a playerworld^^

Works on Zenkou fine.

Chandler 02-08-2007 10:46 PM

Quote:

Originally Posted by Tolnaftate2004 (Post 1275048)
Works on Zenkou fine.

Custom health / death? Doesn't involve "player.hearts"?

Tolnaftate2004 02-08-2007 10:55 PM

Quote:

Originally Posted by Chandler (Post 1275049)
Custom health / death? Doesn't involve "player.hearts"?

I tried it without the custom health and I still have no problem.

Chandler 02-08-2007 10:59 PM

Quote:

Originally Posted by Tolnaftate2004 (Post 1275056)
I tried it without the custom health and I still have no problem.

Weird. I tried doing something similar on V$:Conflict, it appeared on odd occasions. May have been another NPC as you've said.
Thanks for clearing that up ^^

Tolnaftate2004 02-08-2007 11:01 PM

Quote:

Originally Posted by Chandler (Post 1275057)
Weird. I tried doing something similar on V$:Conflict, it appeared on odd occasions. May have been another NPC as you've said.
Thanks for clearing that up ^^

I know what you're talking about though, that sometimes a GUI will flash when the player's hurt... :confused:

JkWhoSaysNi 02-09-2007 01:22 AM

Quote:

Originally Posted by Tolnaftate2004 (Post 1274999)
You're both wrong. You should only need to call showstats once. If it doesn't stay as you set it, there's another script interfering.


Yes, as someone might put in a level to show different stats. Which is why you need it onPlayerEnters. It's the same with custom tilesets, in theory you should be able to just set them once but if a level changes it, it'll never get changed back if you just do it on onCreated().

cbk1994 02-12-2007 03:20 AM

You're all nerds
PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
showStats1024 );
}
function 
onPlayerEnters()
{
  
showStats1024 );


Oww that was hard ... Took over 2 seconds to write!

Chompy 02-12-2007 04:18 PM

Quote:

Originally Posted by cbkbud (Post 1276437)
You're all nerds
PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
showStats1024 );
}
function 
onPlayerEnters()
{
  
showStats1024 );


Oww that was hard ... Took over 2 seconds to write!

Wait, why you reply to a thread where the thread starter has got the answer,
and you start your post with.. "You're all nerds"..

You didn't need to put that first line in your post..

And, it is not needed to use two showstats, its fine to have it in on of the functions..

cbk1994 02-13-2007 03:51 PM

Quote:

Originally Posted by Chompy (Post 1276627)
Wait, why you reply to a thread where the thread starter has got the answer,
and you start your post with.. "You're all nerds"..

You didn't need to put that first line in your post..

And, it is not needed to use two showstats, its fine to have it in on of the functions..

I put two because people were arguing about what place to put it. If you put it in both, it solves the problem ;)


All times are GMT +2. The time now is 03:28 PM.

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