Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: heavygunner on December 31, 2018, 12:18:00 PM

Title: How to find Who killed who ?[SOLVED]
Post by: heavygunner on December 31, 2018, 12:18:00 PM
Hi !

Working on a small Topdown shooter game. Let's say there is 5 players shooting each others and dying. In this case, how to find Which player killed a player?

What I planned is, duplicate the buller object and tag each of them with player's reference.

is there any other ways to do it ?
Title: Re: How to find Who killed who ?
Post by: Thore on December 31, 2018, 12:33:42 PM
Nope.

1. When bullet spawns, get owner of bullet (the player).
2. When bullet hits, store player it hit.
3. Send both info over to a score keeper, e.g. using the event info, set event data pair.  Depending on mechanics, only when kill, every time etc.

Compute that data in the score keeper. Make yet another FSM that gets that data from score keeper, and updates the UIs.

Title: Re: How to find Who killed who ?
Post by: djaydino on January 02, 2019, 06:14:43 AM
Hi.
You can also have a fsm on the bullet with a (int or string) variable.
On spawning the bullet use set fsm string/int. and give it the player name or nr that spawned the bullet.

on impact get the variable to know from who the bullet was.


Side note: for the bullets you should use pooling, do not create/destroy its bad for performance.
Title: Re: How to find Who killed who ?
Post by: heavygunner on January 09, 2019, 05:57:10 AM
Hi.
You can also have a fsm on the bullet with a (int or string) variable.
On spawning the bullet use set fsm string/int. and give it the player name or nr that spawned the bullet.

on impact get the variable to know from who the bullet was.


Side note: for the bullets you should use pooling, do not create/destroy its bad for performance.
Nope.

1. When bullet spawns, get owner of bullet (the player).
2. When bullet hits, store player it hit.
3. Send both info over to a score keeper, e.g. using the event info, set event data pair.  Depending on mechanics, only when kill, every time etc.

Compute that data in the score keeper. Make yet another FSM that gets that data from score keeper, and updates the UIs.

Thank you for the inputs.
Finally, Did it.

BTW, I increased Players count to 10. Is it okey to add 100 Bullets to Pool ? Each Player will have different rifles.

:)
Title: Re: How to find Who killed who ?
Post by: djaydino on January 09, 2019, 09:23:43 AM
Hi.
It kinda depends on how many bullet a player can shoot before they are disabled again.

You can set 'can grow' to be sure not to run out of bullets.

but if there would be like 4-5 bullets max per player, i would set maximum to 50 and have 'can grow' as a fail save.

Things that are loaded in the scene use memory, so for mobile it would be more important not to have to much bullets loaded.