Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-22-2010, 11:21 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Player Effects (alpha, zoom, etc)

Pretty straight forward on how to add to your playerworld-only uses one player attr; upload the gani "player-effects.gani" in to the gani directory and add this weapon code

HTML Code:
/*
  How it's used

  temp.list = {"alpha", "zoom", "red", "green", 
               "blue", "stretchx", "stretchy"};
    (Remember- if you're editing this order, modify inside
      the gani aswell, np_player-effects)

  choose an attribute from the list above  
  and call this script clientside
  
  PLEffects.onSetEffect("choice from list", value);
*/

//#CLIENTSIDE
function onCreated() {
  PLEffects = this;

    //If the player hasn't logged online before
    // lets set the right things
  if (player.attr[20] == null) {
      //Alpha, Zoom, red, green, blue, stretchx, stretchy
    temp.ani = "player-effects.gani,1,1,1,1,1,1,1";
    player.attr[20] = temp.ani;
  }
  
    //Just to check (will set the players alpha to 0.5)
  this.onSetEffect("alpha", 0.5);
}

public function onSetEffect(var, val) {
    //The list that can be modified
  temp.list = {"alpha", "zoom", "red", "green", 
               "blue", "stretchx", "stretchy"};
  
    //If it's not supported don't allow it
  if (!(temp.var in temp.list)) return false;

    //If it's not between these two values, don't allow it
  if (!(temp.val in |0, 5|)) return false;
 
    //Remove the player-effects (the gani name)
  temp.c = player.attr[20].substring(19).tokenize("");
  
    //Find the current stats
  temp.c = temp.c[0].substring(1);
  
    //Replace the values needed
  temp.c.replace(temp.list.index(temp.var), temp.val);

    //Let's set that bad boy!
  player.attr[20] = "player-effects.gani," @ temp.c;
}
Attached Files
File Type: gani player-effects.gani (526 Bytes, 261 views)
__________________
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 01:04 PM.


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