1. Hey! Guest! The 33rd GMC Jam will take place between May 23rd, 12:00 UTC (Friday noon) and May 27th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

GMS 2 [Solved] How will you handle troop teams?

Discussion in 'Programming' started by SeirLord Games, May 15, 2019 at 4:04 PM.

  1. SeirLord Games

    SeirLord Games Member

    Joined:
    Sep 30, 2016
    Posts:
    58
  2. SeirLord Games

    SeirLord Games Member

    Joined:
    Sep 30, 2016
    Posts:
    58
    Okay, I was thinking about something that should work:

    For example we have the following;
    - IA1 -> Team 1
    - IA2 -> Team 1
    - IA3 -> Team 2

    Then when the IA1 creates soldiers, it will create obj_soldier_1, where 1 is the team number. This object will have the variable 'ia', which will be equal to IA1, this allows the soldier to interact with the IA1 and vice versa.

    And the same with the IA2, it will create obj_soldier_1, with the difference of the variable 'ia', which will be equal to IA2.

    Then we have IA3, which will create obj_soldier_2.

    This allows obj_soldado_1 to make 'instance_nearest' of soldiers that are not from their team without problem.

    It's easier than I thought, I leave this here in case someone has the same question or serves you.

    A greeting!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice