Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-30-2009, 11:48 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
Custom/Default Toggle

Well this is basically a weapon script for switching your server from a default to a custom mode. Which essentially is the first step in developing custom systems for your server.

I generally give this it's own weapon script and list it first in weaponorder= in the serveroptions, because having the enables and disables all over the place is messy and you can end up with unneeded bugs. I.e: Zodiac's old map opening on crossing level link bug.

It's very basic so feel free to expand upon it in your own implementations, which may include special conditions for the different modes and so on.

PHP Code:
/*
   Allows easy-toggling between Default and Custom systems.
*/
//#CLIENTSIDE

function onPlayerEnters() {
  if (
this.defaultmode) {
    
onDefaultMode();
  } else {
    
onCustomMode();
  }
}

function 
onCustomMode() {
  
showstats(1024);
  
enablefeatures(allfeatures-2-4-8-0x100-0x200-0x400-0x800-0x2000-0x40-0x10-0x20);
  
disablemap();
  
disablepause();
  
disableweapons();
  
disableselectweapons();  
}

function 
onDefaultMode() {
  
enablemap();
  
enablepause();
  
enableweapons();
  
enableselectweapons();
  
enablefeatures(allfeatures);
  
showstats(allstats);  

If you have no need to switch between the two, feel free to use the onCustomMode function for your own use, of course you'll have to alter the enablefeatures flag portion to meet your custom needs

On the Zodiac Dev server I use the following script to toggle between the modes.

PHP Code:
function ChatBar.onAction() {
  if (
ChatBar.text == "/classicmode") {
    
ChatBar.text "";
    
this.defaultmode = !this.defaultmode;
    for (
temp.wepplayer.weapons) {
      
wep.trigger("PlayerEnters""");
    }
  }

__________________
Quote:
Reply With Quote
  #2  
Old 09-02-2009, 06:32 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
I can see where others would find this useful, nice release.
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 09:28 PM.


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