How do I have NPC go towards NPC with Variable = to 1?

0 favourites
  • 4 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • So I have a Family and with that family, I have variables set up like

    Carnivore

    Herbivore

    Omnivore

    If the NPC is a Carnivore I set the Carnivore Variable to 1 all other Variables 0

    If the NPC is a Herbivore I set the Herbivore Variable to 1 all other Variables 0

    If the NPC is an Omnivore I set the Omnivore Variable to 1 all other Variables 0

    [Im using pathfinding and line of site btw top down game]

    How can I get the carnivores and omnivores to go after the npc's with the herbivore variable that is = to 1?

    I was thinking something like this but it doesnt work

    gyazo.com/53eca3611f604689945e6a49388abdd6

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's actually much more complex than that, especially with only one family for all NPC types. Here, I made a little demo:

    dropbox.com/s/1zqazbbvfhnraqz/ChasingAnimals.capx

    This can be done easier (the picking part) if you make separate families for predator and prey objects. You can actually add the same object to multiple families, for example a Wolf sprite can be in Predators family and in NPC family. On Predators family you add instance variables only applicable for predators (for example, attack speed etc). On NPC family you can add more general variables, that apply to all NPCs, like health.

  • Thanks for your help man this is very helpful! Hey, question! Would you be willing to make me an advanced AI system for 50 USD? I can give you the details on discord or wherever you like

  • It depends on how advanced you want this AI to be. Please send the details to my email doperst2006 (at) gmail.com and I'll let you know if this can be done.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)