Hey, GiL, I'm trying to wrap my head around this, but can't come to a solution. I want to have something like woodcutting, where I go up to a tree, use the sword to chop at the tree for a while until a log appear in my Inventory. How do you suggest I go about it?
I'd suggest using an event with start type Key Press and In Trigger enabled. This way, the event can be started when the player stands near the tree (i.e. in the trigger of the event) by pressing a key.
In the event, you could use an Object Game Variable to count the times the player chopped the tree and add a log to the inventory when it exceeds a certain number of times (and reset the counter again).
You can see a similar use of object game variables in one of the latest game tutorials here.
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!
Hey GiL. My woodcutting project was using 2.0.1, but now that I've updated it to 2.1.8, it stopped working. So I did a little test. In my event, it will simply trigger a dialogue that said the tree has been chop. Added this to the tree. Whenever I tried chopping this tree, nothing happen. If I change the event type to Trigger Enter or Interact, the event will happen, but if I do it as Key Press and In Trigger enabled, and tried pressing the key in front of the tree, nothing happen. I was just wondering if there's anything wrong with the Start type Key Press.
Did a quick test - Key Press is working fine on my end. Check if your input key is still set up correctly.
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!
Yeah, I've checked and it's set up correctly. I noticed something weird. Upon pressing the input key, the cutting animation will be play, but the event won't start (tree won't cut), but if in the animation section I leave the animation name blank and press the input key, the event will start, but the animation won't be playing (since I deleted it). This will only work if the in trigger is disable though. If it is enabled, even leaving the animation name blank won't make the event start.
I think I'll need a demo project to see what's going on.
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!
Here's what's going on: - the same key that starts the event also fires the base attack - the base attack blocks player controls - the event can't start because the controls are blocked Enabling In Blocked Controls in the Event Interaction will solve that problem :)
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!
Oh, I saw that box, but everytime I was about to enable it to check, I kept telling myself nah it couldn't be that. Thanks a lot for the explanation, GiL. I know what I did wrong now.
In the event, you could use an Object Game Variable to count the times the player chopped the tree and add a log to the inventory when it exceeds a certain number of times (and reset the counter again).
You can see a similar use of object game variables in one of the latest game tutorials here.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
That works perfectly.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
- the same key that starts the event also fires the base attack
- the base attack blocks player controls
- the event can't start because the controls are blocked
Enabling In Blocked Controls in the Event Interaction will solve that problem :)
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!