Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Player effects (https://forums.graalonline.com/forums/showthread.php?t=78118)

DustyPorViva 12-29-2007 11:33 AM

Player effects
 
I've been taught how to globally show player effects(zoom, alpha, rotation, etc...) via gani scripts. This was great... although a bit complicated. Not to mention it seemed buggy. Sometimes it wouldn't set the right values correctly, sometimes it didn't update... it just was a hassle. So after someone came to me for some help with the subject I came up with a script:
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
enabledefmovement();
  if ((
client.red+client.green+client.blue+client.alpha+client.rotation+client.zoom+client.stretchx+client.stretchy)==null) {
    
client.red=1;
    
client.green=1;
    
client.blue=1;
    
client.alpha=1;
    
client.rotation=0;
    
client.zoom=1;
    
client.stretchx=1;
    
client.stretchy=1;
  }
  
onTimeout();
}

function 
onTimeout() {
  
temp.effects={"red","green","blue","alpha","rotation","zoom","stretchx","stretchy"};
  
player.attr[29]=client.red+1 SPC client.green+1 SPC client.blue+1 SPC client.alpha+1 SPC client.rotation+1 SPC client.zoom+1 SPC client.stretchx+1 SPC client.stretchy+1;
  for (
i=0;i<temp.effects.size();i++) {
    
player.attr[29][i]=client.(@ temp.effects[i]);
    for (
pl:players) {
      
pl.(@ temp.effects[i])=pl.attr[29].tokenize()[i]-1;
    }
    
player.(@ temp.effects[i])=player.attr[29][i];
  }
  
setTimer(0.05);


How does it work? Well instead of relying on a gani script, it simply goes through the player's client.effectvars, shoves them into an attr and then applies every players effects in a loop. The only thing you need to change is the clients appropriate client.string(and make sure every player has the weapon... or else they won't see any players effects):
  • client.red : 0-1 : changes the players red value
  • client.green : 0-1 : changes the players green value
  • client.blue : 0-1 : changes the players blue value
  • client.alpha : 0-1 : changes the players alpha value(transparency)
  • client.rotation : 0-pi*2(~6.28) : changes the players rotation
  • client.zoom : >0 : changes the players zoom(size)
  • client.stretchx : >0 : changes the players horizontal stretch
  • client.stretchy : >0 : changes the players vertical stretch
There is no need to touch the script at all... the only known problems I have seen so far is that if effects are set, players bodies are invisible until they move... but that's a problem with Graal and setting these effects in any way.

cbk1994 12-29-2007 04:09 PM

Simple but effective! Nice. I would still use gani scripts though. This could be kinda laggy

DustyPorViva 12-29-2007 07:56 PM

I suspected as much when I made it, depending on how many players there are... but I haven't been able to test that.

bscharff 12-29-2007 10:55 PM

Very nice!
I'll sure be using this!

EDIT:
OK, I uploaded it onto Utopia.
It worked great.
One problem though; it made everyone invisible to themselves.
I foodled with it for about 15 minutes then gave up.
I suspect that the "for (i=0;i<temp.effects.size();i++) {" was doing it, although I have no clue :P

Nonetheless; it's a great script and it inspired me to make my own.


All times are GMT +2. The time now is 10:52 AM.

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