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
  #1  
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
  #2  
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
  #3  
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
  #4  
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
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 06:40 PM.


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