Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Distracted NPC Patrols

Gamescolar

Villager
Xy$
0.00
Good day!

Is there a way for a patrolling NPC to approach an event?

Ex: placing a slab of meat on the floor will cause the roaming wolf to approach it, hence giving the player a chance to sneak through.

If there is an existing script or an actual method in the engine, point-outs are very welcome.

Thank you!

Best regards,
Gamescolar Dev. Group
 

Gamescolar

Villager
Xy$
0.00
Hey thank you for the response,

It's a pretty interesting script, but upon checking, I'm afraid it only affects how an event chases the player.

I'm thinking if we could adjust that to have the event chase another event:
Like how a moving monster would chase a moving NPC, or a roaming wolf would run after a piece of meat that the player can leave on the floor.

But thanks for the input! :)
 

Kit Ramos

Villager
Xy$
0.00
well glancing over the script I see they make use of $gamePlayer variable to track the player
if you did something like
var ev = $gameMap.events(event_id); ev=ev[0];
then the variable ev would have all the same kind of information that $gamePlayer has only the information is for the event instead of the player so then you could go though and replace all the calls to $gamePlayer with variable ev and it the plug in should then think that event is the player and have the stuff chase after it.
Just two things to keep in mind:
  1. you need to use the id number that shows up in the upper left corner not the name of the event.
  2. unlike $gamePlayer the varable ev (or whatever variable name you use) will only have local scope so you will want to make sure to recreate it every time you exit the current scope and head into a different one. alternatively you could make a new global variable at the start and load it up the same way but lot of people frown on that due to the fact making new global variables comes with it's own set of less then obvious gotchas
 

Gamescolar

Villager
Xy$
0.00
That is an interesting play to the script! Upon reviewing, it is feasible!

Thank you for your input. It's a great help. So far, we were able to get the script moving as intended thanks to both of your suggestions. :D The event now chases after the marked event instead of the player hahaha.

We'll try to post any relevant problems that we need help with should any arise.

Thank you once again!
 
Top