Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old 12-29-2007, 04:09 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Simple but effective! Nice. I would still use gani scripts though. This could be kinda laggy
__________________

Last edited by cbk1994; 12-29-2007 at 07:59 PM..
Reply With Quote
  #3  
Old 12-29-2007, 07:56 PM
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
I suspected as much when I made it, depending on how many players there are... but I haven't been able to test that.
Reply With Quote
  #4  
Old 12-29-2007, 10:55 PM
bscharff bscharff is offline
Bloo
bscharff's Avatar
Join Date: Sep 2006
Location: San Antonio, Texas
Posts: 185
bscharff has a little shameless behaviour in the past
Send a message via AIM to bscharff Send a message via MSN to bscharff Send a message via Yahoo to bscharff
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.
__________________
Trying to be nice now...

Last edited by bscharff; 12-30-2007 at 12:32 AM..
Reply With Quote
Reply


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 10:32 PM.


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