Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Graal V4 Main Forum (https://forums.graalonline.com/forums/forumdisplay.php?f=143)
-   -   Global Functions (https://forums.graalonline.com/forums/showthread.php?t=61353)

Velox Cruentus 09-23-2005 02:33 AM

Global Functions
 
A nifty addition to the game would be able to establish functions on a global scope (Functions accessible to all npcs).
Maybe have all NPCs automatically run this on creation: "function onCreated() this.join("globalfunc");"

This would be very appreciated, and quite useful.

e.g.:
PHP Code:

CLASS_GlobalFunc
function reportIn()
{
  echo(
"Reporting " this.id " in " this.level "(" this."," this.").");


&
PHP Code:

LOCAL_NPC
function onCreated()
{
  
reportIn();



ForgottenLegacy 09-23-2005 03:04 AM

It would be easier to make a functionlibrary class and have a player.weapons loop, with findweapon, and with a join() function. You can use the function 'isinclass(str)' to check to see if the weapon is already in the class. Have a clientside part of the script run, while watching a checksum of the weapons to see if any changes have been made, and if so, run the serverside loop to join every weapon to the class.

Worth a try.

ChibiChibiLuc 09-23-2005 08:12 PM

Ooor we could just have a global functions class that's automatically joined.. >_>
But yeah, I'd love to have a globally joined class.


I'd also like to see the ability to join classes with clientside functions to a player, so we can call them without going to the serverside..

PHP Code:

Player-joined class
//#CLIENTSIDE
public function Dist(myx,myy,gotox,gotoy) {
  
distx gotox myx;
  
disty gotoy myy;
  return (
distx^disty^2) ^ .5;


PHP Code:

NPC Weapon
//#CLIENTSIDE
function onWeaponfired() {
  
somex int(random(0,64));
  
somey int(random(0,64));
  
player.chat player.Dist(player.x,player.y,somex,somey);



-Coughs.- Aaanyway..

Inverness 09-25-2005 04:10 AM

How about making it so public functions in the Control-NPC can be called without using ("Control-NPC").function();

coreys 09-25-2005 06:17 AM

public function already exists. it has for a while, my friend yaharii has used it many times.

DarkFireXZ3 09-25-2005 08:01 AM

Hmm, I'm gonna mess around with those functions out of boredom and i have no one on my server execpt Idling staff members. =] So for no complaining of what i do, eh?


All times are GMT +2. The time now is 01:43 AM.

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