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 04-05-2012, 02:51 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
WallBlocking Serverside??


I don't understand why there does not have to be anything blocking in the way, yet it keeps returning blocking...
Does onwall not work serverside / in a class?

Currently I have it commented off as shown below or it would just keep turning around.

PHP Code:
function onTimeout(){
  if (
this.mode == WALK) {
    if (
players.size() > 0) {
      
setTimer(.1);
    }
    else {
      
setTimer(0);
    }
    
this.to_check findnearestplayer(this.xthis.y);
    
temp.newx this.vecx(this.dir) * this.mov_speed;
    
temp.newy this.vecy(this.dir) * this.mov_speed;
    
//this.chat = this.x SPC this.y SPC "New is" SPC new_x SPC new_y;
    
this.count--;
    if (
this.count 0) {
      if (
this.ani != "sl_animal_cow-walk") {
        
setcharani("sl_animal_cow-walk",null);
      }
      
temp.testx newx 1.5 vecx(this.dir);
      
temp.testy newy vecy(this.dir);  
      
/*
      if (checkBlockedTile(testx,testy)){
        this.dir = (this.dir + 2) % 4;
      }   
      */      
      //else {
        
this.newx;
        
this.newy;
      
//}
    

PHP Code:
function checkBlockedTile(xValueyValue) { //Check if tile is not walkable 
  
if (onwall(xValueyValue) || onwater(xValueyValue)) {
    
this.chat "test";
    return 
true;
  }
  else {
    
//this.chat = "not blocking";
    
this.chat "yesy";
    return 
false;
  }

__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #2  
Old 04-05-2012, 03:00 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
Onwall only checks a single pixel. Use onwall2(posx,posy,width,height);
Reply With Quote
  #3  
Old 04-05-2012, 03:02 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by DustyPorViva View Post
Onwall only checks a single pixel. Use onwall2(posx,posy,width,height);
It sets off both water and wall,
should I only have it check walls?

onwall2(xvalue,yvaluse,16,16); ?

Is it counting it self a wall?

I tried onwall(xvalue+.8,yvaluse+.8);
but that didn't seem to work haha..
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #4  
Old 04-05-2012, 03:22 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
Quote:
Originally Posted by Devil_Lord2 View Post
It sets off both water and wall,
should I only have it check walls?

onwall2(xvalue,yvaluse,16,16); ?

Is it counting it self a wall?

I tried onwall(xvalue+.8,yvaluse+.8);
but that didn't seem to work haha..
PHP Code:
if (!onwall2(newx,newy,3,4)) {
  
// proceed with walking

Onwall2 width and height is in tiles. Just adjust the 3 and 4 to the specific size of the cow, especially for each direction where the NPCs proportions change.
Reply With Quote
  #5  
Old 04-05-2012, 03:23 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by DustyPorViva View Post
PHP Code:
if (!onwall2(newx,newy,3,4)) {
  
// proceed with walking

Onwall2 width and height is in tiles. Just adjust the 3 and 4 to the specific size of the cow, especially for each direction where the NPCs proportions change.
Alright! I shall see if this works, thank you for now!


I've tried both ways with no luck.. testx and y, and newx and y
I can now understand why Zodiac doesn't have wall checking. x.x;;

PHP Code:
if (this.count 0) {
      if (
this.ani != "sl_animal_cow-walk") {
        
setcharani("sl_animal_cow-walk",null);
      }
      
temp.testx newx 1.5 vecx(this.dir);
      
temp.testy newy vecy(this.dir);  
      
/*
      if (checkBlockedTile(testx,testy)){
        this.dir = (this.dir + 2) % 4;
      }   
            
      else {
        this.x = newx;
        this.y = newy;
      } 
      */
      
if (dir == && !onwall2(testx,testy,3,4)) {
        
this.newx;
        
this.newy;
      }
      else if (
dir == && !onwall2(testx,testy,5,4)) {
        
this.newx;
        
this.newy;
      }
      else if (
dir == && !onwall2(testx,testy,3,4)) {
        
this.newx;
        
this.newy;
      }
      else if (
dir == && !onwall2(testx,testy,5,4)) {
        
this.newx;
        
this.newy;
      }
      else{
        
this.dir = (this.dir 2) % 4;
      } 
    } 
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz




Last edited by Devil_Lord2; 04-05-2012 at 03:39 AM..
Reply With Quote
  #6  
Old 04-05-2012, 03:36 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
I didn't use testx for a reason, newx would have sufficed lol. The only position you need to check is its intended(new) position. The testx/testy stuff is for onwall use, because as it was previously mentioned, only checks a single pixel; so typically you'd center the check in the player and then offset the check by half the size of the player. There's no reason to do any of that more complicated checking here.

I feel this is an instance of you using preexisting code and hacking it up but not actually being aware of what any of it does. Examine what you're doing logistically and this sort of stuff will make sense.
Reply With Quote
  #7  
Old 04-05-2012, 03:42 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by DustyPorViva View Post
I didn't use testx for a reason, newx would have sufficed lol. The only position you need to check is its intended(new) position.
Either way it has mad cow and keeps changing directions. D:

PHP Code:
    temp.newx this.vecx(this.dir) * this.mov_speed;
    
temp.newy this.vecy(this.dir) * this.mov_speed;
    
//this.chat = this.x SPC this.y SPC "New is" SPC new_x SPC new_y;
    
this.count--;
    if (
this.count 0) {
      if (
this.ani != "sl_animal_cow-walk") {
        
setcharani("sl_animal_cow-walk",null);
      }
      
temp.testx newx 1.5 vecx(this.dir);
      
temp.testy newy vecy(this.dir);  
      
/*
      if (checkBlockedTile(testx,testy)){
        this.dir = (this.dir + 2) % 4;
      }   
            
      else {
        this.x = newx;
        this.y = newy;
      } 
      */
      
if (dir == && !onwall2(newx,newy,3,4)) {
        
this.newx;
        
this.newy;
      }
      else if (
dir == && !onwall2(newx,newy,5,4)) {
        
this.newx;
        
this.newy;
      }
      else if (
dir == && !onwall2(newx,newy,3,4)) {
        
this.newx;
        
this.newy;
      }
      else if (
dir == && !onwall2(newx,newy,5,4)) {
        
this.newx;
        
this.newy;
      }
      else{
        
this.dir = (this.dir 2) % 4;
      } 
    } 
Quote:
Originally Posted by DustyPorViva View Post
I feel this is an instance of you using preexisting code and hacking it up but not actually being aware of what any of it does. Examine what you're doing logistically and this sort of stuff will make sense.
I feel the exact same way since there really isn't any other way to learn onwall..

Honestly I didn't even know why one would use the function for onwall check when you could do it in the original code, but either way it would not work so I kept the original baddy format.

If I knew how to do serverside onwall support my pet system would have been finished 6 months ago. Since onwall was the only thing missing.


Anyway, all I wanted was the random walking and wall check. Apparently that doesn't work sadly and so far nothing has fixed it, once again like my pet system, I'll leave it alone for a while. x.x;;


Oh sorry, yeah I missed a part, I know what is going on up until why it keeps thinking it hits a wall. I've tried debugging it and onwater and onwall keep going off over and over and over.

I mean I haven't had it check the tiles and have it chat which tiles are being checked, but I also feel I should not have to go that far.. D:
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz




Last edited by Devil_Lord2; 04-05-2012 at 03:53 AM..
Reply With Quote
  #8  
Old 04-05-2012, 03:58 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
It's never too far to debug your own code when you're encountering a problem.
Reply With Quote
  #9  
Old 04-05-2012, 04:05 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
I can give you a video of me debugging it if you'd like. It takes the tile in front of it, the x and y, and still says that it is water and wall tile... From there I don't understand how one could debug it further, it sounds like a server error..
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #10  
Old 04-05-2012, 04:14 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
Well a lot of the problem is coming from you Frankenstein scripts together. For example, you're using an enumerator, and I'm almost positive you have no idea what that is or how to use it. An enumerator for something this simple(with two modes) is kind of a waste. You're also not prefixing some variables correctly, or at all, indicating they're copied from the GS1 scripts, and you're showing signs of using things that you have no idea what their actual purpose is.

Learning from existing code is not wrong. In fact, it's how I learned, and the only way some people like myself can learn. However you're not learning anything. You're jumping right from having no scripts of your own, to pasting in existing scripts together to get what you desire, then not knowing why all of this stuff you're not familiar with isn't working. You need to take a step back and analyze what the hell you're actually doing and working with. You're using scripts and formulations that you have no idea what they actually do, and if you did you'd probably see what the problem is.

Yes, Graal documentation is poor but the gscript wiki is still decent enough to use while analyzing existing scripts and learning from them. Once you analyze the scripts you're using and figure out why they're doing what they're doing, and come to an understanding of how your script functions, you'll have a much easier time progressing.
Reply With Quote
  #11  
Old 04-05-2012, 04:22 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by DustyPorViva View Post
Well a lot of the problem is coming from you Frankenstein scripts together. For example, you're using an enumerator, and I'm almost positive you have no idea what that is or how to use it. An enumerator for something this simple(with two modes) is kind of a waste. You're also not prefixing some variables correctly, or at all, indicating they're copied from the GS1 scripts, and you're showing signs of using things that you have no idea what their actual purpose is.

Learning from existing code is not wrong. In fact, it's how I learned, and the only way some people like myself can learn. However you're not learning anything. You're jumping right from having no scripts of your own, to pasting in existing scripts together to get what you desire, then not knowing why all of this stuff you're not familiar with isn't working. You need to take a step back and analyze what the hell you're actually doing and working with. You're using scripts and formulations that you have no idea what they actually do, and if you did you'd probably see what the problem is.

Yes, Graal documentation is poor but the gscript wiki is still decent enough to use while analyzing existing scripts and learning from them. Once you analyze the scripts you're using and figure out why they're doing what they're doing, and come to an understanding of how your script functions, you'll have a much easier time progressing.
I didn't paste my whole script since I don't really want anyone taking them lol.. Enumerators "which I talked about on the learn to script school"
http://scriptingschool.forumotion.co...-and-constants

are just constant strings / variables.. I was only using it as a cool looking topic header.

Anyway, uploading the error which still makes no sense and I still feel is a server error...
I found a stupid solution which you can see my debugging process.. and a crazy idea.


95% complete
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #12  
Old 04-05-2012, 04:27 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
This is something you could probably just switch over to clientside and see if the issue persists, and debug/refine the code there. This would be preferable since you can debug with easier methods, such as displaying images/polygons at the collision checks for visual reference, etc.
Reply With Quote
  #13  
Old 04-05-2012, 04:29 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by DustyPorViva View Post
This is something you could probably just switch over to clientside and see if the issue persists, and debug/refine the code there. This would be preferable since you can debug with easier methods, such as displaying images/polygons at the collision checks for visual reference, etc.
I believe it worked clientside but I don't remember lol..
I went past that after some reason.. My memory isn't too great.
Check the video, it seems like the type of grass is blocking...
Still makes no sense to me.. :c

I don't know how to use polygons and not sure how images would help checking o.o;;


Video is up... for some reason the grass is blocking and I still don't know why..
I mean, would it be appropriate to do
PHP Code:
 if (checkBlockedTile(newx,newy) && tile[newx,newy] != 533){
        
this.dir = (this.dir 2) % 4;
      } 
Seems like something that shouldn't need to be done..


PHP Code:
      if (checkBlockedTile(newx,newy) && tiles[newx,newy] != 511){
        
this.dir = (this.dir 2) % 4;
      } 
Well it works now, wasn't the type of solution I was expecting but whatever...
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz




Last edited by Devil_Lord2; 04-05-2012 at 04:42 AM..
Reply With Quote
  #14  
Old 04-05-2012, 04:46 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
Post your tileset?
Reply With Quote
  #15  
Old 04-05-2012, 04:51 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
*Advisory Warning
This is the Shaded Legends tileset, and is meant to be used only on Shaded Legends as far as I know. By posting this image I am not giving the right for anyone to use it on other servers.



So, here is the tileset, type0, yet it walks on fences and says water every once in a while... I don't think it can walk on ... I don't know it just confuses me and I still think it is a server thing..

Oops wait that is my type1, let me change that lol..
That isn't the one being used hold on.

-EDIT-
The tileset being used is posted.
I'm overall just confused now lol.. It shows water sometimes randomly, and I think the +1.5 and stuff wasn't needed and is checking slightly further than needed.
Attached Thumbnails
Click image for larger version

Name:	sl_tiles1.png
Views:	114
Size:	604.8 KB
ID:	54484  
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



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:48 AM.


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