How do I test two same object types same variables

0 favourites
  • 5 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • I have all NPCs in my game under the same family and they all have a faction variable so to speak and I need them to only injure each other during attack sequences if the faction variables are different. How do I go about this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Create another family with the same objects in it, compare between the two families.

  • But then all my variables like their stats and such don't carry over to the additional family very practically unless I'm not aware of something.

    EDIT: I guess what I could do for melee attacks is the same thing I did for the projectiles and make melee collision objects and put faction values in them and create them for melee hits.

  • You're right, that was more or less a shot in the dark since I can't check it myself. In that case, you'll need to make liberal use of the "Pick nth instance" event from the system object, which will pick a specific instance of an object type from the list of picked objects of that type. To compare variables between objects of the same type when multiples are picked, you can access variables of a specific object by specifying an index in parenthesis after the object name, like:

    Sprite(0).MyVar = Sprite(1).MyVar, do some thing[/code:yku2dx5n]
  • I tried that, I think the (#) part is literal IID values. So it finds instances #1 in the entire layout when you put 0, #2 when you put 1, etc. The melee collision box idea works fine and is better than testing my whole sprite because melee attacks are restrained to a specific region now.

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