fremachuca's Forum Posts

  • awesome, the indexof expression worked. here is how I fixed it:

    thanks for the help blackhornet!

  • And how could I stop the loop?

  • Hey there evryone.

    Im having a little problem with my code here.

    This is what i have:

    I have a simple 6 slot inventory system going on. This piece of code checks if the inventory is not full (has at least 1 slot free) Basically if any value in X is 0, it means that slot is empty. The thing is, that it works in a weird way.

    I add items to the inventory until all 6 slots are used. The code runs and sets "inv_full" to true. Everything great over there. The problem is that if I delete any slot, other than the last one, It doesnt set the "inv_full" back to false. As soon as I delete the last slot (last X value in the array) than it sets "inv_full" to false.

    Ideas???

  • Hey there Jomo. Im really interested in your asset.

    One thing I would like to know is how do you handle large quantities of text?

    Also it would be great if you could shared the tutorial pdf you have.

    It would be great to have an idea of how the workflow works.

  • sorry about that. it does work! i probably deleted the "set state to wiaitng" when trying to ctrl+drag it to another event.

    anyway, any good reads on "trigger once"? (other than the obvious tutrials in the site) cause im getting lots of unexpected results when using it.

    specifically when the code comes back to the "trigger once" event again and again. it seems that after the event runs 1-2-3 times it just stops working.

  • Doesn't work. With the state = idle event the timer keeps starting every tick. so the timer never gets to 3.

    If i place a trigger once on the first event, it runs but after going back to idle for the first time it stays stuck there.

    Im really not sure but it seems like I REALLY REALLY REALLY didnt understand how Timers and Trigger Once work. They always give mixed results when I use them in my project.

    I fixed everything going for something completely different.

    You can see that trigger once is disabled on the last event. If I enable it, it breaks the code at some point.

    **I read somewhere that trigger once only works after 10 seconds of being used, is that correct??

  • I tried using for each as the top event with events 1 and 2 from the first posts image as sub events, but it didnt help.

    This is the closest i got to something working.

    But still. After running the first sequence of events (idle>random>moving>startTimer>onTimer>idle)

    some of the enemies will just stay idle forever, others will create a new timer on the second sequence of events but than just stay idle forever at the end of that. And some will even just stay moving forever, never going back to the idle state.

    soooooo lost.

  • Hey there everyone.

    This is the code I currently have.

    what i expect to happen:

    1 - "enemy01" is idle, creates a random value for each "enemy01" instance, waits 3 seconds and than starts moving again.

    2 - When "enemy01" starts moving again a timer starts ticking for each instance with the random value from step 1 as the duration.

    3 - When the timer reaches its duration, it would activate making that "enemy01" instance go back to idle, restarting the process for that "enemy01" instance.

    3b - The other "enemy01" instances would continue counting the timer until each reached its duration, restarting the process for each one of them.

    BUT what happens is:

    1 - "enemy01" is idle, creates a random value for each "enemy01" instance, waits 3 seconds and than starts moving again.

    2 - When "enemy01" starts moving again a timer starts ticking for each instance with the random value from step 1 as the duration.

    3 - When the FIRST timer (the one with the lowest duration) reaches its duration, it activates ALL timers (even though the timer on each "enemy01" instance has a different tag based on the instances UID). The "enemy01" instance that had the lowest duration goes back to step 1. All the other "enemy01" instances just go straight to step 2 starting the timer again, but not going back to idle and creating a new random value.

    Ideas????

  • i switched the order of the 2 conditions, putting the "is takingDamage" before the "X is takingDamage".

    this seems to have solved the problem. cant seem to reproduce the "bug" anymore.

    anyone care to explain whats up??

  • this is the code i have.

    what it does is when the enemy collides with the player attack he goes into a "takingDamage" state.

    when he enters the "takingDamage" state, i run once a tint on the enemy and after 1 second untint him and then exit the taking damage state by setting "takingDamage" to false.

    as soon as "takingDamage" is false he goes back to walking, being idle, etc.

    the problem is that if he gets hit again right as he is getting out of the "takingDamage" state (a specific moment between events maybe? where code hasnt been completed yet?)

    he sets the "takingDamage" to true again, but just stays stuck there, without running anything inside the "is takingDamage".

    since he doesnt run anything inside this condition he will be stuck there forever. (never setting "takingDamage" to false again)

    any ideas?

  • ("X Is canAttack" is running about 60 times a second, and resetting the timer)

    YES.

    fixed it by adding another bool:

    thanks for the help!

  • still no luck.

    i simplified it to make it obvious how it should (or I expect it to work)

    this code gives me mixed results. sometimes it waits 1 second so i can attack again. sometimes it resets immediately and i can keep bashing the button attacking a million times (ignoring the 1 second cooldown)

    ----

    I also tried the timer behavior. for some reason it doesnt get called??

    what happens is i attack the first time and never can attack again (as if the timer never happened)

  • this is the code i have.

    basically what i want is to have a cooldown of 1 second on the attack (so the player cant keep bashing the button)

    what happens is sometimes it works, sometimes it resets the "p_SwordAttackCooldown" variable immediately without waiting 1 second. any ideas????

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads

    good to know this is already working!!

  • This pricing isn't really accurate, as you can also sign up for Unity's subscription service, which now has no set time limit on how long you have to sign up for. So, you could create your entire project in Unity, for free, and only sign up for the subscription to push it out to platforms outside of OSX/Windows/Linux. I've easily saved thousands of dollars using their subscription service instead of buying each major release outright, as was required previously.

    could you point out to where you heard/saw this!? if i go right now to the buy tab in the unity site, and choose the subscription, i get this:

    "A subscription runs for a minimum of 12 months and is available via the Online Store."

    if you choose the TERMS tab:

    "The minimum commitment period for a subscription is 12 months. You cannot cancel your subscription before its expiry date."