How do I make my players not shoot themselves?

0 favourites
From the Asset Store
Players follower. use it for anything which follows the player
  • So, I'm making a fighting game, with gun pickups and stuff like that. The guns are all in a family together just called "Weapons". I have it so that when a player picks up a weapon, it gets pinned to the closest player. Some guns are small enough that the hitboxes are within the players, so that when the bullets are fired from the gun, they just shoot the player holding the gun. Basically, I want the bullets (and gun) to know which player is shooting, so they can ignore damage dealt to that player. It's probably a simple fix, but nothing I have tried has worked so far. (I've mostly just been trying to assign an ID to the player and then have instance variables for the gun and bullet that get assigned to whatever that is, but it's not working)

  • When a player shoots, assign the bullet a variable which is the UID of the player.

    For bullet on collision with player to do damage, add a condition 'player.UID does not equal bullet.variable'

  • But how can I make the bullet know which player is shooting the gun?

  • Because when you assign the bullet variable the UID of the player then this is the owner of the bullet and the person who shot it.

  • No, I mean how can I set it to player UID if there are two players, and it doesn't know which one is shooting it

  • Well how do determine who shot it? Usually depends on which control input the shooting... What are you doing to have the bullet come out at the correct location?

  • I'm using a behavior add on called jj_weapon which has an easy "shoot" thing that uses whatever bullet instance you set it to, so I have it so that it activates the nearest weapon (because of families that works) to the player, which is always the one they are holding.

  • So you are picking a player in the event which is expected and all you need, then when you run the action it assigns the player UID

  • I'm still confused, if you could show me a visual representation that would be nice.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Where's the visual representation of your events ?

  • This all the weapon pickup related stuff, and the damage system is the most basic possible (on collision with player, remove damage from player health variable blah blah blah)

  • Ah ok can't assist then, I don't know how that third-party plugin works I just use what Construct has to offer.

  • Is there anyone who can help me that you know of?

  • I would just be lazy and do this.

  • Bump cuz it's been a while in case anyone else wants to take a crack at it

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