Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-06-2009, 08:06 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Set Effect

Simple question.
What set effect values would make an image seem slightly transparent, but still have the regular colors and stuff, then what set effect puts it back to normal?
Ill go ahead and post my script, because its blocking and from what I know, it shouldn't be. Besides someone probably knows a better way to do what I'm trying to do anyways.

PHP Code:
function onCreated(){
  
setimg("armageddon-bridge11.png");
}
function 
onPlayerTouchsMe(){
  if (
this.touched == 1){
    
setcoloreffect(1,1,1,0.44);
    
setTimer(2);
  }
  if (
this.touched != 1){
    
this.touched 1;
  }
}

function 
onTimeout(){
  
setcoloreffect(0,0,0,1);
  
this.touched 0;
}
//#CLIENTSIDE
function onPlayerTouchsMe(){
  
dontblocklocal();
  
drawoverplayer();

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 11-06-2009, 08:44 AM
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
It'll need to be clientside, try something like

PHP Code:
//#CLIENTSIDE
function onPlayerTouchsMe() {
  
setEffectMode(1); // draw as opacity rather than alpha, if that makes sense
  
setColorEffect(111.7); // R, G, B, opacity — change opacity as needed

__________________
Reply With Quote
  #3  
Old 11-06-2009, 12:21 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by cbk1994 View Post
It'll need to be clientside, try something like

PHP Code:
//#CLIENTSIDE
function onPlayerTouchsMe() {
  
setEffectMode(1); // draw as opacity rather than alpha, if that makes sense
  
setColorEffect(111.7); // R, G, B, opacity — change opacity as needed

Thank you, once again.
Reply With Quote
  #4  
Old 11-07-2009, 01:46 AM
Sage_Shadowbane Sage_Shadowbane is offline
Graal Developer
Sage_Shadowbane's Avatar
Join Date: Mar 2004
Posts: 585
Sage_Shadowbane will become famous soon enough
You should probably also make it non-blocking under an onCreated() function. As this will make it non-blocking as soon as its created for the client, rather than waiting until the player touches it, From my experience it will take a quick second to become non-blocking waiting for the players touch, as apposed to it already being non-blocking before the player reaches it.
Reply With Quote
  #5  
Old 11-07-2009, 02:05 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Ahh, ok ty.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #6  
Old 11-07-2009, 02:09 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Actually, i noticed using this, that the trans shows up too, any way around that?
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #7  
Old 11-07-2009, 05:00 AM
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
Quote:
Originally Posted by sssssssssss View Post
Actually, i noticed using this, that the trans shows up too, any way around that?
What do you mean?
__________________
Reply With Quote
  #8  
Old 11-07-2009, 05:32 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
the trans for that image is yellow, its transparent normally, but after touching it and setting the image to be more transparent, the yellow shows up too
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #9  
Old 11-08-2009, 08:53 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Here are some screens to show what i mean, the code im using is:


PHP Code:
//#CLIENTSIDE
function onCreated(){

}
function 
onPlayerTouchsMe(){
  
dontblocklocal();
  
drawoverplayer();
  
setEffectMode(1);
  
setColorEffect(111.7);
  
setTimer(7);

}

function 
onTimeout(){
  
setEffectMode(1);
  
setColorEffect(1111);

order of the screens should be before touching the image, while in the image, and after leaving the image.

Ive tried a few different things, like using showimg, not including setEffectMode(1) on the timeout and stuff, but regardless of the timeout, when i touch it and it turns more transparent, thats when the yellow shows up.
Attached Thumbnails
Click image for larger version

Name:	beforetouching.png
Views:	278
Size:	141.9 KB
ID:	49810   Click image for larger version

Name:	inside.png
Views:	277
Size:	128.5 KB
ID:	49811   Click image for larger version

Name:	aftertouching.png
Views:	266
Size:	137.2 KB
ID:	49812  
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #10  
Old 11-08-2009, 08:58 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Looks like a problem with the image. I suggest you get yourself IrfanView and re-save the file, then try again.
Reply With Quote
  #11  
Old 11-08-2009, 09:10 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
Can you upload the image here?
__________________
Reply With Quote
  #12  
Old 11-08-2009, 10:47 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Try changing this.mode = 1;

I'm under the impression setEffectMode() changes the mode for setEffect which affects the entire screen, not setColorEffect.

When you use setColorEffect this is basically what happens:

PHP Code:
//#CLIENTSIDE
function setColorEffect(rgba) {
  
this.red r;
  
this.green b;
  
this.blue b;
  
this.alpha a;

So try using this instead.

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
setColorEffect(1110.7);
  
this.mode 1;

__________________
Quote:
Reply With Quote
  #13  
Old 11-08-2009, 11:18 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by fowlplay4 View Post
I'm under the impression setEffectMode() changes the mode for setEffect which affects the entire screen, not setColorEffect.
Sorry, wrong.
Reply With Quote
  #14  
Old 11-09-2009, 01:18 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Crow View Post
Sorry, wrong.
Well, never was a fan of mode then.
__________________
Quote:
Reply With Quote
  #15  
Old 11-11-2009, 03:39 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Still doing the same thing. For whatever reason, changing the alpha is showing up the trans in the image. Any other idea around it?
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #16  
Old 11-11-2009, 04:07 PM
Imperialistic Imperialistic is offline
graal player lord
Imperialistic's Avatar
Join Date: Apr 2007
Location: Florida
Posts: 1,094
Imperialistic is a jewel in the roughImperialistic is a jewel in the rough
Quote:
Originally Posted by sssssssssss View Post
but regardless of the timeout, when i touch it and it turns more transparent, thats when the yellow shows up.
Wouldn't that BE a timeout problem? I'm not much of a scripter but I quite remember having a problem like that.

Try asking someone the proper way to set the timer in it.
__________________
" It's been swell, but the swelling's gone down. "
Reply With Quote
  #17  
Old 11-11-2009, 06:30 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Cyril, I was on Armageddon earlier, also talking to Decus, and while doing so, I checked out that bridge, and it's working fine, not showing the yellow. Seems to be a problem with your computer (or maybe your locally saved image of that bridge). Try deleting the local copy of the bridge, then restart Graal and let it re-download it. See if it works. If it doesn't, try updating your graphics card drivers.
Reply With Quote
  #18  
Old 11-11-2009, 08:18 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
That was it. xD Oh man a two page post on something stupid. Oh man. xD
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #19  
Old 11-29-2009, 12:18 PM
Samposse Samposse is offline
Chopa Shopa !
Samposse's Avatar
Join Date: Nov 2008
Location: Norway
Posts: 87
Samposse is an unknown quantity at this point
Send a message via AIM to Samposse Send a message via MSN to Samposse
:o
__________________
Delitto :3

A
SERVER
UNDER
CONSTRUCTION !

feel free to ask me about delitto
Reply With Quote
  #20  
Old 12-02-2009, 07:22 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Actually decided to take it off a timer, and put it in x, y coordinates, to eliminate the use of timers. I have this, but now its not setting, any obvious reason why?

PHP Code:
//#CLIENTSIDE
function onPlayerEnters(){
  
setColorEffect(1111);
  
this.mode 1;
}
function 
onPlayerTouchsMe(){
  
dontblocklocal();
  
drawoverplayer();
  
setTimer(.05);
}

function 
onTimeout(){
  if (
player.x+1.5 in |1725| && player.y+2 in |1337|){
    
setColorEffect(1110.7);
    
this.mode 1;
  }else{
    
setColorEffect(1111);
    
this.mode 1;
  }
  
setTimer(.05);

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #21  
Old 12-02-2009, 07:58 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Since you set the mode in the player enters event, you don't need to keep setting it in the timeout but that's not the issue.

Have tried you placing player.chat = "tests"; in the loop to see if it's actually executing the code you want? You could also use my debugger class, and insert breakpoints instead.
__________________
Quote:
Reply With Quote
  #22  
Old 12-08-2009, 09:04 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Finally got time to come back to this. All it says on player is "out", which its in the correct coordinates, so I dont know why its not saying "IN".

PHP Code:
//#CLIENTSIDE
function onPlayerEnters()
{
  
setColorEffect(1111);
  
this.mode 1;
  
player.chat "START";
}
function 
onPlayerTouchsMe()
{
  
dontblocklocal();
  
drawoverplayer();
  
setTimer(0.05);
}
function 
onTimeout()
{
  if (
player.x+1.5 in |1725| && player.y+2 in |1337|)
  {
    
setColorEffect(1110.7);
    
this.mode 1;
    
player.chat "IN";
  }else
  {
    
setColorEffect(1111);
    
this.mode 1;
    
player.chat "out";
  }

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #23  
Old 12-08-2009, 09:09 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Try putting parenthesis' around

player.x+1.5 and player.y+2

like so:

if ((player.x+1.5) in |17, 25| && (player.y+2) in |13, 37|)

Nvm, that's not the issue but for clarity purposes I would.

Is this script on a gmap? because if it is you start dealing with coordinates in the 100s in some cases, a way to get around this would be to use relative coordinates like: this.x, this.x + 10, etc.
__________________
Quote:
Reply With Quote
  #24  
Old 12-08-2009, 09:12 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Still saying out and doing nothing.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #25  
Old 12-08-2009, 09:28 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Try displaying the coordinate values using echo or player.chat, so you can actually see what the values are, instead of just in and out.

I.e: player.chat = player.x SPC player.y;
__________________
Quote:
Reply With Quote
  #26  
Old 12-08-2009, 09:44 PM
Grey Grey is offline
Classic Developer
Grey's Avatar
Join Date: Mar 2007
Location: Wales, UK
Posts: 134
Grey will become famous soon enough
Send a message via AIM to Grey
If you're working on a GMAP those arent going to be the actual x and y of the player
Reply With Quote
  #27  
Old 12-08-2009, 10:04 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Personally, I would do something like this:
PHP Code:
//#CLIENTSIDE
function onPlayerEnters(){
  
setEffectMode(1);
  
setColorEffect(1111);
  
dontBlockLocal();
  
drawOverPlayer();
  
setTimer(0.05);
}

function 
onTimeout(){
  if (
player.x+1.5 in |this.x-1this.x+this.width+1| && player.y+2 in |this37|){
    
setColorEffect(1110.7);
  } else {
    
setColorEffect(1111);
  }
  
setTimer(0.05);

Then you can put it in a class and use it for other things like it.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #28  
Old 12-08-2009, 10:12 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
i've played around with the scripts on both a gmap and a level, on the level, the script worked fine, on the gmap, it didn't.
so, i'm guessing it's the x/y that needs to be compared to the x/y on the map.

i've heard of "getmapx/y()" but i've never used it, i suggest you play around with it
(between, u can use this.alpha to change the trans instead of setColorEffect() )

EDIT:
switch found out how to fix it, by setting the shape to the width and height of the img (i think).
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you

Last edited by Deas_Voice; 12-08-2009 at 10:24 PM..
Reply With Quote
  #29  
Old 12-08-2009, 11:43 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Deas_Voice View Post
switch found out how to fix it, by setting the shape to the width and height of the img (i think).
The level's NPC image was only set and not actually joined to the class. Then I did that so the clientside would work.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
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 06:36 PM.


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