Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Player Effects (alpha, zoom, etc) (https://forums.graalonline.com/forums/showthread.php?t=134258134)

xAndrewx 02-22-2010 11:21 PM

Player Effects (alpha, zoom, etc)
 
1 Attachment(s)
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;
}



All times are GMT +2. The time now is 04:15 PM.

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