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-27-2015, 04:58 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
Gonna try it

is this the correct negation of player xy in xy?

HTML Code:
if (player.x !in |this.x-10,this.x+10| && player.y !in |this.y-5,this.y+5|) {
__________________
iEra IGN: *Elk (Darkshire)
iCla. IGN: *Elk (Darkshire)
iZone IGN: *Elk (Darkshire)




Reply With Quote
  #2  
Old 02-27-2015, 05:43 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 Elk View Post
Gonna try it

is this the correct negation of player xy in xy?

HTML Code:
if (player.x !in |this.x-10,this.x+10| && player.y !in |this.y-5,this.y+5|) {
You can't negate in like that, try:

PHP Code:
if (!(player.x in |this.x-10this.x+10| && player.y in |this.y-5this.y+5|)) { 
(If you could, you'd probably want to use || instead of && by De Morgan's laws. Unless I'm misinterpreting what you're trying to do.)
__________________
Reply With Quote
  #3  
Old 02-27-2015, 06:46 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 cbk1994 View Post
(If you could, you'd probably want to use || instead of && by De Morgan's laws. Unless I'm misinterpreting what you're trying to do.)
|| = or
&& = and

player.x != player.y 8-D

Ok now I tried this, but it isnt fading in nor fading out, just permanently onscreen

PHP Code:
//#CLIENTSIDE
function onCreated(){
  
dontblock();
  
layer 2;
  
temp.fimg findimg(375);
  
fimg.screenwidth 2;
  
fimg.screenheight 180;
  
fimg.text "Era Underground Complex Level 2";
  
fimg.layer 8;
  
fimg.zoom 2;
  
fimg.style "bc";
  
fimg.textshadow true;
  
fimg.shadowcolor = {0,0,0};
}
function 
onTimeOut() {
  
checkArea();
  
setTimer(0.05);
}
function 
checkArea() {
  if (
player.x in |this.x-10,this.x+10| && player.y in |this.y-5,this.y+5|) {
    if (!
this.showed) { // If the image hasn't been displayed since their last entrance
      
this.showed true// Flag it as displayed
      
onFadeIn(); // Start fading in
    
}
  } else {
    if (
this.showed) { // If it was displayed already
      
this.showed false// Unset it, since they're no longer inside
    
}
  }
}
function 
onFadeIn() {
  if (
player.x in |this.x-10,this.x+10| && player.y in |this.y-5,this.y+5|) {
    
this.img.alpha += 0.05// 0.05 is a placeholder, it will take num * 20 seconds to fully fade in, so @ 0.05 it will take 1 second
    
if (this.img.alpha 1) { // If it isn't fully visible yet
      
scheduleEvent(0.05temp.namenil); // THIS 0.05 is not a placeholder, it is the tick rate of graal - this will "loop" the fade in
    
} else {
      
onPause(3); // '3' is up to you, it's how long it will appear to "hang," this creates the "pausing"
    
}
  } else {
    
onFadeOut(); // If the player left the area, stop fading in and start fading out instead
  
}
}
function 
onPause(timeLeft) {
  if (
player.x in |this.x-10,this.x+10| && player.y in |this.y-5,this.y+5|) {
    if (
timeLeft 0) {
      
scheduleEvent(0.05temp.nametimeLeft 0.05); // Keep counting down if the player is inside and there's time left to pause.
    
} else {
      
onFadeOut(); // Once time runs out, fade out
    
}
  } else {
    
onFadeOut(); // If player isn't still in area, pre-maturely fade out.
  
}
}
function 
onFadeOut() {
  if (!(
player.x in |this.x-10,this.x+10| && player.y in |this.y-5,this.y+5|)) {
    
this.img.alpha -= 0.05// Lower the alpha back down, remember: this 0.05 is a placeholder
    
if (this.img.alpha 0) { // While it's not 0 yet
      
scheduleEvent(0.05temp.namenil); // Keep looping to decrease it
    
}
  } 
// No need to put an else {} here to check if they re-enter the area. If they re-enter the area, this will fail and onFadeIn() will be called by checkArea()

__________________
iEra IGN: *Elk (Darkshire)
iCla. IGN: *Elk (Darkshire)
iZone IGN: *Elk (Darkshire)




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.