So I'm breaking my head for like 5 hours now... Trying to do something that maybe is simple but i can't make it happen.

I would like to buy/hire NPCs with the new npc buy function, and make them give me resources every x amount of hours.

So what i have done so far:

1) I make a new combatant with buy price and I Setup the shop, having the compatant there ready to be bought.
2) I made a research that every 60 seconds it gives me 50 wood for example.
3) I have the research cost at X amount of gold.
4) trying to make an event to add the research tree on the bought combatant

so now i need to:

Buy the Combatant, and not having him chase me or anything, he can just stay in a spot in the village, but i want to have the 50 wood every night on a warehouse, and every morning to be asked if i want to pay the x amount of gold so the combatant to go to work. Also if i press no, i want to be able to go talk to him and pay him so he goes to work anyway.

Any directions towards this result? thank you.
  • I made something like this without using combatants, if you want to try a different setup:

    - set up a fake purchaseable item that can add a variable like bool "woodman = yes"
    - on the village scene create a prefab that can be shown (interact) only f the variable is positive, like an event npc
    - set up time / day settings
    - when you speak to the event npc, check if the player has enough gold, in that case remove gold form inventory and set another variable. I think you could use a object variable here but also a global one like "woodmanStartedWork = yes" can make the job properly
    - When you speak again to the npc, you check time of the day, if the working hours have passed and the second variable was positive (the player had paid the fee) you reset the variable and gather the wood.
    More or less like this, i hope it can be helpful. :)
  • Buying a combatant is probably not what you're looking for. @Kaemalux way seems the better option to use.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • ok thank you @Kaemalux ! will try this and get back to you :)
  • edited January 2017
    I couldn't make what Kaemalux said.

    I create an Inventory item, and set to add a variable woodman? and check value?

    also "when you speak to the event npc, check if the player has enough gold, in that case remove gold form inventory and set another variable. I think you could use a object variable here but also a global one like "woodmanStartedWork = yes" can make the job properly"

    I made a game event, having the check gold node, but " but also a global one like "woodmanStartedWork = yes" " I really can't understand it :S

    some more clarifications if possible
    Post edited by dlevel on
  • bump, cannot make it work :/ I m totally stuck on the event creation so i can choose what material i would like the NPC to gather for me, and how to make it happen overall.

    I am ok with the woodman=yes part etc. but after that I m totally stuck.
  • edited February 2017
    Maybe I can help you with this. This doesn't seem like something worth breaking a sweat over :)

    After you buy the woodman and trigger the woodman bool to true, go talk to the woodman in your scene. If you want to choose what kind of woods you want the woodman to do, in the woodman's event, it should be something like this. I created a pseudo event to help you visualize it. I have not tested it yet to see if it works or not, but from my experiences, this would be what I would usually do in a situation like this.

    image

    The fork variable node is for checking to see which woods you choose.
    woodmanStartedWork = 1 is yew and 2 is oak.

    Of course, the above will only let the woodman give you the woods if you talk to him, no matter if the time is already passed.

    To automatically make him give you the woods without talking to him, just create an auto global event that check the variable fork to see which woods should be given to you, and then check the time. If time is successful, add the wood to your inventory or wherever, and after that make the woodmanStartedWork float to 0.

    To make the woodman automatically ask you if you want him to go get some woods in the morning, just create another auto global event. This global event is exactly like the event in the picture above. Of course, since you only want this event to pop up once every morning, just set a requirement to only pop up during that certain time.

    That's the gist of it. If you are still stuck on a part, let me know.
    Post edited by Shadow_Fire on
  • once again you are very helpful @Shadow_Fire ! thank you! Will try this today :)
  • Yeap it seems to work! so about the time, should i just go with if hours greater than 23, add to inventory? or is there a better way?
  • That's usually the best solution :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • perfect, thank you all for this, its a start of a big feature of my game :)
  • edited February 2017
    Now I might be asking a lot, but is it possible to have a log check which workers i have hired and a count down to the next "shipment" ??? :D
    Post edited by dlevel on
  • Hm, well, yeah ... somewhat.

    You'd need to add this information to your log text with variable text codes - you'd need to add a log text for each worker, learning it with the rest of the worker setup you're already doing after buying it.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Ok i'll be honest, i do not know where to start :) do i learn the log after i start the hiring? time countdown ? from the same event? just a heads up so i ll start from the right point :)
  • Depends on when you want the player to be able to view this information. E.g. if you only want it after telling the worker what to do, learn the log text in that event (and forget it if the worker isn't working).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • yeap I made it to the point that i have the menu screen and when i hire the worker i see it on the menu, but i cannot make the time left before delivery to work, any idea?
Sign In or Register to comment.