Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #16  
Old 07-30-2011, 01:14 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by DustyPorViva View Post
I was thinking Bezier Curves combined with my above method O.o though I imagine that would be just as taxing.
It's not so taxing if done right. For known paths between things, you put preset nodes. That way, you only have to A* to get to one of the nodes. After that, you can put preset paths in place for NPCs to follow to their destinations.

Example: you have a road between two towns. A NPC gets distracted by a bunny and gets lead of the road a bit. The NPC only needs to A* (if necessary) to get onto the nearest node on the road. Once on he is set.

Can use a quick tool online to put all these node paths in easily enough. Depending on the realism you want, may need the occasional diversion around a player /object but other than that it's nice enough.
Reply With Quote
  #17  
Old 08-21-2011, 07:40 PM
Televangelist Televangelist is offline
Registered User
Join Date: Aug 2011
Posts: 21
Televangelist is on a distinguished road
Interesting! Pardon me, but I have a noob question...

how difficult would it be to have an 'if interrupted on the path' condition? The guy plots out the path, the guy tries to move along the path, and if for some reason he's blocked along the way, he takes a certain action?
Reply With Quote
  #18  
Old 08-23-2011, 01:12 AM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Quote:
Originally Posted by Televangelist View Post
Interesting! Pardon me, but I have a noob question...

how difficult would it be to have an 'if interrupted on the path' condition? The guy plots out the path, the guy tries to move along the path, and if for some reason he's blocked along the way, he takes a certain action?
Shouldn't be a problem.
__________________
Testbed user: I figured since I can never find any scripters it was time to take desperate measures...and...TEACH MYSELF 0.0
Reply With Quote
  #19  
Old 07-04-2012, 01:41 AM
DeCeaseD DeCeaseD is offline
Registered User
Join Date: Jan 2008
Posts: 247
DeCeaseD will become famous soon enough
Don't disregard my post actually! Lol. For some reason, when I try to make an NPC move, it always returns error: blocking, no matter the x/y input or it's origin x/y.. Anyone know the cause of this? Could it be because I'm trying to place it on a gmap? Also, it doesn't only work with pics1 type tiles, does it.. ?

Come to the conclusion that it's neither of the things I mentioned. Anything else it could be.. ?

Posting my class code for reference:

PHP Code:
function onPlayerchats() 
{
  if ( 
player.chat == "/destroy" && player.account == "DeCeaseD"destroy();
}

//#CLIENTSIDE
function onCreated() 
{
  
this.join("astar");
  
showCharacter();
  
  
this.plyr findnearestplayer(this.xthis.y);
  
  
moveTothis.plyr.xthis.plyr.y);

Also, note that I am placing these NPC's using a class spawner, and not actually adding them to the level via level editor. Could this be what's wrong?

Last edited by DeCeaseD; 07-04-2012 at 02:07 AM..
Reply With Quote
  #20  
Old 07-04-2012, 03:07 AM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
You need to configure either newtilesetlevels or newtilesets in serveroptions to let the server know which levels are using type 1 tiles.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #21  
Old 07-04-2012, 03:16 AM
DeCeaseD DeCeaseD is offline
Registered User
Join Date: Jan 2008
Posts: 247
DeCeaseD will become famous soon enough
Quote:
Originally Posted by xXziroXx View Post
You need to configure either newtilesetlevels or newtilesets in serveroptions to let the server know which levels are using type 1 tiles.
Not sure how to configure either of the things you mentioned Ziro. :P
Reply With Quote
  #22  
Old 07-04-2012, 03:26 AM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by DeCeaseD View Post
Not sure how to configure either of the things you mentioned Ziro. :P
Example:

PHP Code:
newtilesetlevels=myfirstlevel.nw,mysecondlevel.nw,mylevels_ 
If your entire server is type 1, you can just set newtilesets=true though.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #23  
Old 07-04-2012, 04:57 PM
DeCeaseD DeCeaseD is offline
Registered User
Join Date: Jan 2008
Posts: 247
DeCeaseD will become famous soon enough
Oh okayy.. well played good sir! But, apparently this is not the problem as the NPC is still returning "Error: Blocking!"
Reply With Quote
  #24  
Old 07-04-2012, 07:50 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by DeCeaseD View Post
Oh okayy.. well played good sir! But, apparently this is not the problem as the NPC is still returning "Error: Blocking!"
Try it in a type 0 level and see if it works.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #25  
Old 07-04-2012, 08:10 PM
Hezzy002 Hezzy002 is offline
Registered User
Join Date: Jul 2011
Posts: 247
Hezzy002 is a jewel in the roughHezzy002 is a jewel in the rough
You should use A* with waypoints and a navigation mesh instead of tiles, it's less intensive and looks better, although it creates some manual labor for the person creating the level. Maybe you could fall back to tiles if there are no waypoints in the area.
Reply With Quote
  #26  
Old 08-13-2012, 08:06 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
awesome xx
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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


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