Graal Forums  

Go Back   Graal Forums > Private forums > Graal4 Forums > Graal V4 Main Forum
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-10-2006, 07:53 PM
Tom Tom is offline
Grraaaaaw
Tom's Avatar
Join Date: May 2005
Posts: 2,037
Tom is on a distinguished road
Suggestion: Clientside Class

Clientside TStaticVar CAN'T join classes. In a former thread it was said it was due to security risk. However, why can't classes be scripted in the Weapon NPC and make the scripts truly class-oriented?

PHP Code:
class item
{
  function 
item( id = 0, quant = 1 ) // Constructor
  
{
    
this.index = id;
    
this.quant = quant;
  }
  function 
drop( quant = 1 )
  {
    if (
quant > this.quant) quant = this.quant;
    if (
quant < 1) return false;
    
triggeraction(0, 0, "serverside", "Items", this.id, this.quant);
  }
} 
Or, even more in depth, more functions to the actual classes:

PHP Code:
class wearableitem : public item
{
  function 
wearableitem( id = 0, quant = 1) : item:item( id, quant );

  function 
wear()
  {
    if (
this.worn) return true;
 
    
player.wear ++;
    
this.worn = true;

    return 
true;
  }
  function 
remove()
  {
    if (!
this.worn) return true;

    
player.wear --;
    
this.worn = false;
    return 
true;
  }
} 
 


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 07:30 AM.


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