How do I Subtract Instance variables from other Instance variables?

0 favourites
  • 2 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I Have a family of 3 objects (weapon) each with different Instance variables(IV). I have another object that will subtract that number from its own health.

    I set up the events to work where:

    family weapon - over lapping object- Subtract the familyweapon.objecttypename.IV# from other object.

    However you cannot do this, the instant variable cannot be traced back through the FAMILYgroup.

    only the familygroup.IV for that family are allowed to be put in.

    really i was looking for a solution where I could say this whole family.IV# subtracts from another family.IV# and I want to find the specific instance variable of those objects in the family, Not the actual family.IV#

    A solution to this was to store the numbers with global variables, then assign corresponding names to them matching the objects. then the object's name could be stored on overlapping events, then checked on global variables to get the right number. Then my mathematical calculations would be complete.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want to find a specific object then you should be using the object, not the family. The object will still use the IV. If it's a weapon overlapping an enemy for example I'm not sure why you need the specific object though so family is fine? Sounds like you did some overthinking here, if it's simply weapon overlaps enemy then you do weapon overlaps enemy, set enemy.health minus weapon.damage

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