Thread: Player effects
View Single Post
  #1  
Old 12-29-2007, 11:33 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.

Last edited by DustyPorViva; 12-29-2007 at 08:29 PM..
Reply With Quote