0 Favourites


  • I'm making a game about hexagons. There's a group called "People" which contains every hexagon, and they have their UIDs and an instance variable "faction", and each faction is a number, not a string. There's also a grid called FactionRelations, where each faction has an x value and a y value. For example, faction 2 is outlaws, and faction 0 is commoners. Then, to make them hit each other, I set the grid's coordinates X2 and Y0 to "hostile" (1 in my case), making them able to attack each other.

    And I did that: I have an event that sets the values X0Y2 and X2Y0 to 1. And, people attack each other with projectiles. So, when the player character is creating a projectile, it spawns it, sets the projectile's NPCUID variable to its own UID. There's also a second event, "Projectile: On created", which sets its faction variable to the faction value of the NPC that spawned it. And it knows which NPC it should set itself to, because it picks the People object whose UID is equal to its NPCUID variable. Well, that doesn't work. The player's faction is 2, but he can hurt himself with the projectile, and can't hurt others (a beautiful metaphor for the life of a criminal in a perfect utopia, but I still have to do a game). So I did an event that sets the Sword projectile's frame to its faction variable. Turns out that it's 0, not 2. So I screwed around, and, turns out the event where the NPCUID is taken from the Player works, but not the "On created" one. So, I disabled the picking event. It worked, the faction is 2, you can hurt people to your heart's content. However, the Sword does that because it has no specific People object to get its variables from, so it just chooses the first People object ever created, which is the player. But I want the NPC to be able to use weapons, too, and do that according to THEIR OWN faction and will instead of the players. So, what exactly happened here? The events are in the Common Sense and the Shooting groups, or may be in no group at all. There's not that many events so I'm not bothering to give a screen right now.

  • Bah-bumparoo

  • Bump

  • Bomb

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • THREE..




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