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

0 favourites
  • 3 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • 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 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.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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. 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?

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