Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


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 11:45 PM.


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