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 02-26-2015, 03:52 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
I personally don't think you can use alpha on text. If you convert the text to an image, you could do this. If it works with text, great. I'm sure it won't though...

HTML Code:
//#CLIENTSIDE
function onCreated(){
  this.dontblock();

   //So I set the image at the start - no need to keep re-drawing it.
  this.fimg = findimg(200);
  with(this.fimg) {
    x = screenwidth / 2;
    y = screenheight / 2 - 180;
    image = "block.png";
    alpha = 0;
    layer = 4;
    zoom = 2;
  }
  this.onTimeout();
}

function onPlayerEnters() {
  this.onCreated();
}

function onTimeout(){
  this.onCheckScreen();
  setTimer(0.05);
}

function onCheckScreen() {
  if (player.x in |this.x-10,this.x+10| && player.y in |this.y-5,this.y+5|) {
      //If the image alpha is less than one, increase it gradually.
    if (this.fimg.alpha < 1)
      this.fimg.alpha += 0.05;
  } else {
      //If they're not in the area and the alpha is greater than 0, decrease it gradually.
    if (this.fimg.alpha > 0)
      this.fimg.alpha -= 0.05;
  }
}
__________________
Reply With Quote
  #2  
Old 02-27-2015, 12:50 AM
Elk Elk is offline
Sr Marketing Strategist
Elk's Avatar
Join Date: Nov 2005
Location: Deerland
Posts: 3,829
Elk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant future
Send a message via ICQ to Elk Send a message via AIM to Elk Send a message via MSN to Elk Send a message via Yahoo to Elk
Quote:
Originally Posted by xAndrewx View Post
I personally don't think you can use alpha on text. If you convert the text to an image, you could do this. If it works with text, great. I'm sure it won't though...

HTML Code:
//#CLIENTSIDE
function onCreated(){
  this.dontblock();

   //So I set the image at the start - no need to keep re-drawing it.
  this.fimg = findimg(200);
  with(this.fimg) {
    x = screenwidth / 2;
    y = screenheight / 2 - 180;
    image = "block.png";
    alpha = 0;
    layer = 4;
    zoom = 2;
  }
  this.onTimeout();
}

function onPlayerEnters() {
  this.onCreated();
}

function onTimeout(){
  this.onCheckScreen();
  setTimer(0.05);
}

function onCheckScreen() {
  if (player.x in |this.x-10,this.x+10| && player.y in |this.y-5,this.y+5|) {
      //If the image alpha is less than one, increase it gradually.
    if (this.fimg.alpha < 1)
      this.fimg.alpha += 0.05;
  } else {
      //If they're not in the area and the alpha is greater than 0, decrease it gradually.
    if (this.fimg.alpha > 0)
      this.fimg.alpha -= 0.05;
  }
}
Thats the exact script im using for my transitional things, i would use it but i dont know of a way to have it fade out after a while and not being called again

i dont want the alpha to be 1 constantly while in the area, it has to just trigger once and fade out until the entire area is touched again basically


the above method works with this.chat but i havent figured out a way to do it with findimg in combination with alpha
__________________
iEra IGN: *Elk (Darkshire)
iCla. IGN: *Elk (Darkshire)
iZone IGN: *Elk (Darkshire)




Reply With Quote
  #3  
Old 02-27-2015, 03:37 AM
khortez khortez is offline
PrototypeX
khortez's Avatar
Join Date: Dec 2008
Posts: 91
khortez will become famous soon enough
Quote:
Originally Posted by xAndrewx View Post
I personally don't think you can use alpha on text. If you convert the text to an image, you could do this. If it works with text, great. I'm sure it won't though...

HTML Code:
//#CLIENTSIDE
function onCreated(){
  this.dontblock();

   //So I set the image at the start - no need to keep re-drawing it.
  this.fimg = findimg(200);
  with(this.fimg) {
    x = screenwidth / 2;
    y = screenheight / 2 - 180;
    image = "block.png";
    alpha = 0;
    layer = 4;
    zoom = 2;
  }
  this.onTimeout();
}

function onPlayerEnters() {
  this.onCreated();
}

function onTimeout(){
  this.onCheckScreen();
  setTimer(0.05);
}

function onCheckScreen() {
  if (player.x in |this.x-10,this.x+10| && player.y in |this.y-5,this.y+5|) {
      //If the image alpha is less than one, increase it gradually.
    if (this.fimg.alpha < 1)
      this.fimg.alpha += 0.05;
  } else {
      //If they're not in the area and the alpha is greater than 0, decrease it gradually.
    if (this.fimg.alpha > 0)
      this.fimg.alpha -= 0.05;
  }
}
you can use alpha on text, i have a mini system on testbed that uses alpha to fade in/fade out for it
Reply With Quote
  #4  
Old 02-27-2015, 03:57 AM
Restraint Restraint is offline
NaS
Join Date: Jan 2014
Posts: 21
Restraint will become famous soon enough
Quote:
Originally Posted by khortez View Post
you can use alpha on text, i have a mini system on testbed that uses alpha to fade in/fade out for it
Also 100% certain. I've done it before on UN way back in GS1 and the script is still around to this date.

Enter a city on UN for the first time and you'll see a message the top, "Welcome to <Town>!" - it fades in and fades out.
__________________
Hi. I'm NaS!
Reply With Quote
  #5  
Old 02-27-2015, 04:24 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 xAndrewx View Post
I personally don't think you can use alpha on text.
Why would you not be able to do that
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 02:41 AM.


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