How do I make copies of one object use events independently?

Get help using Construct 2

Post » Sat Jun 17, 2017 8:41 pm

Message: iBarin can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hi everyone, I often get stuck with events and their order of execution but now I lost any idea whats wrong.

I'm making realtime hot-seat game on the grid (like bomberman, but with creeps).
When player attack NPC , battle menu(battle_tag) appears over and copy player/enemy parameters into a separate array (array_battle).

The battle is automatic: each side deals damage with its speed (takes from the array)
Sides hit each other's health until one of them is over, then the menu is removed and the player can move on.

The problem is that there are several live players in the game who can start fights at any one time.
Right now I can't make so that one event is performed for each object(battle_tag) separately.
I tried several options, and in the latter it turns out that one battle is waiting for the previous one to be end.

Thats how I do it now http://i.imgur.com/HHAyxBF.png
*without FOR EACH event run only for one object.

file: dropbox.com/s/fzl73ofdn9e9y27/homm_test.capx?dl=1
Just move at enemes in one time (W for PL1 and left arrow for PL2). At debug you can see rusults in array_battle.
B
7
Posts: 5
Reputation: 287

Post » Sun Jun 18, 2017 11:35 am

You can group the enemies with an instance variable same goes for players. Lets say you have 3 players and 15 enemies, you can set the first player and 5 enemies with an instance variable one, and in the event sheet where you call the event add one more condition player id == 0 && enemies id == 1, and for the second group add another event with those ID's set to 1.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Sun Jun 18, 2017 1:36 pm

Message: iBarin can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
imhotep22 wrote:You can group the enemies with an instance variable same goes for players. Lets say you have 3 players and 15 enemies, you can set the first player and 5 enemies with an instance variable one, and in the event sheet where you call the event add one more condition player id == 0 && enemies id == 1, and for the second group add another event with those ID's set to 1.


Thanks for reply!
I think I did it in that version already. When I spawn battle menu (battle_tag) i write number of player to instance variable. I use this number to select right colomn in array.

here pic of creating this object. http://i.imgur.com/B8rTkY5.png

What I see: event condition fits to exact battle, but somehow while it works it cant be used for another copy of object.

Or I didnt get you right?
B
7
Posts: 5
Reputation: 287


Return to How do I....?

Who is online

Users browsing this forum: chrisinfinger, Yahoo [Bot], YoHoho and 17 guests