Objects ignoring triggers?

0 favourites
  • 8 posts
From the Asset Store
Game Triggers is as versatile as a Swiss army knife, and will be a great resource for any type of game you're creating.
  • I'm not sure why but everything works fine until i have about over 4 instances of the object in which case it starts to ignore my triggers

    This is my trigger for changing the sprite animations (based off of object 'states' which i set based off of certain parameters)

    and this is my trigger for states

    so there are 2 big problems im getting here that are on and off

    1. you can see where there are objects that have collided into the blue squares when they are not suppose to, they are suppose to be within a set distance (less than 500 but more than 60) yet they kept going. They also are not in the proper state and arent triggering the animation presumably becasue of state

    2. here you can see that there are 2 objects that are the correct distance and they also have the correct state (checked in debugger) yet the animation is incorrect?

    help would be greatly appreciated

  • The first "Pick Adventurer where distance..." condition here is wrong. You haven't picked an enemy yet, so you are comparing distance to only one enemy instance (first instance with IID=0, which could be on the other end of the layout).

    I suggest you use "for each" loop:

    Adventurer state not equal "inCombat"
    For each Adventurer
     Enemy pick nearest to Adventurer
     System Is between values: distance(enemy.x, enemy.y, adventurer.x, adventurer.y) between 60 and 500
     ----> Adventurer set state "inCombat"
    

    .

    If you have lots (hundreds) of enemies and adventurers, calculating distances between them may be a bit slow. In this case you can use Line Of Sight behavior - it works faster than distance() expression.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The Events where you Change Animation they look very confusing I'm not sure if you misunderstood the how it works the (Else) but here is the translation of your events and see for yourself if that is what you intended to do.

    Event(62)Pick any AdventurerSprite.AnimationName = Class & "_AtKR" >>>> And do nothing

    Event(63) Else: (Every time that you cannot find any AdventurerSprite at all Playing = Class & "_AtKR") Pick all the sprites that meet the condition (Sprite = Attacking & Sprite.aAngle <= 19) and set their Animation to Class & "_AtKR"

    So here you have a problem while it finds at last 1 of them meeting these three conditions

    Sprite = Attacking

    Sprite.aAngle <= 19

    AnimationName = Class & "_AtKR"

    The else it will never Run

    ==============================================

    For the rest of the events set attacking & in combat they are confusing swell. the best thing is to explain in simple words what you trying to do exactly and someone here will help you with the Logic

  • tarek2, I believe the "Else" event will be executed is there are no instances of AdventurerSprite (picked by parent events) with animation Class & "_AtKR".

  • tarek2, I believe the "Else" event will be executed is there are any instances of AdventurerSprite (picked by parent events), which have animations different from Class & "_AtKR".

    dop2000

    For what I know the (Else) only Runs when the Parent Event is False so as longs it finds at last 1 of them with animation = Class & "_AtKR" the (Else) it will never Run, but now you make me wonder I will run some test to make sure is right as I posted really quick & I might be wrong

  • tarek2

    Yeah, sorry, I realized my mistake and updated my post, but you had already commented on it :)

    .

    Yes, the "Else" will not run if at least one picked instance has Class & "_AtKR" animation. So the event should probably look like this:

    Pick AdventurerSprite with animation NOT EQUAL to Class&"_AtKR" 
    -> AdventurerSprite set animation Class&"_AtKR"
    
  • tarek2

    Yeah, sorry, I realized my mistake and updated my post, but you had already commented on it :)

    .

    Yes, the "Else" will not run if at least one picked instance has Class & "_AtKR" animation. So the event should probably look like this:

    > Pick AdventurerSprite with animation NOT EQUAL to Class&"_AtKR" 
    -> AdventurerSprite set animation Class&"_AtKR"
    

    No problem mate :)

    I agree Putting the Else on those situations is very confusing it made me doubt for a bit haha

    I will leave a capx showing what we were talking about to raikoification so he can understand it better as it can be really hard to understand

    Capx: https://www.dropbox.com/s/neryqc35djepnnp/%28Else%29%20Problem.capx?dl=0

  • > tarek2

    > Yeah, sorry, I realized my mistake and updated my post, but you had already commented on it :)

    > .

    > Yes, the "Else" will not run if at least one picked instance has Class & "_AtKR" animation. So the event should probably look like this:

    >

    >

    > > Pick AdventurerSprite with animation NOT EQUAL to Class&"_AtKR" 
    > -> AdventurerSprite set animation Class&"_AtKR"
    > 

    No problem mate :)

    I agree Putting the Else on those situations is very confusing it made me doubt for a bit haha

    I will leave a capx showing what we were talking about to raikoification so he can understand it better as it can be really hard to understand

    Capx: https://www.dropbox.com/s/neryqc35djepnnp/%28Else%29%20Problem.capx?dl=0

    i will look into the capx file and try a for each loop when i get home, thanks

    for the else statement the reason its set up the way it was is because if the event is always true (while state = attacking) it will constantly set the animation to class_AtkR making it stuck on the first frame. So then I made a else function based off of what the current animation is so on the first run it would trigger the animation, and subsequent runs it would simply do nothing as the animation was already playing.

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