Arroslin's Forum Posts

  • 7 posts
  • Create a sprite object and set initial visibility to invisible (but during debugging set it to visible). Pin this object to player hands. Then create a variable and give it a name say mineAmount. Your tools ‘mining amount’ that the player equips will overwrite this variable mineAmount.

    Next disable that sprite object collision and each time you click (playing the mine animation) that sprite objects collisions are enabled and later disabled. On this sprite object collides with tree or rock subtract that amount from tree or rock variable and or add to amount of resources your player collected.

  • Those that are familiar with Rex's Plugins probably know the advantages of using them as well as how powerful those plugins can be if you understand how to use them.

    The following link is where you can download Rex Plugins,

    c2rexplugins.weebly.com/map.html

    When you go to download a plugin, you will see the following,

    Click on the “Plugin” to download the plugin, “ACE table” to view basic documentation about the plugin, and “Sample capx” to download a sample project to see how to use the plugin.

    When you click on “Sample capx” to download a sample project to see how the plugin is used, it directs you to a download page only to find that the file does not exists as illustrated in the image above.

    Since there is no discrete documentation on how to use the Rex Plugins and “Sample capx” files are missing, for all of the Rex Plugins, how do you find out how to use each of the Rex’s Plugins? Without going though a method of trial and error on testing how each of the plugins work.

    In addition, if those “Sample capx” files do not exists on Rex’s directory does that mean that all those “Sample capx” files are all files gone forever?

    Tagged:

  • Hello again and sorry for the long reply. The demo that dop2000 sent works just need disable the Behavior of the Turret Rotate that is,

    Followed by this is the code of what to use and how and what not to do in order for things to work.

    Next is an image of how things looks.

    Next I have a question regarding the selection of target. See the highlighted code where the condition is,

    On Right Clicked "Red_Unit"

    THEN

    Set the value Targetted of the "Red_Unit" to 1 (which is True and 0 is False) AND Find a Path to the "Red_Unit".

    By Find a Path to the "Red_Unit" in this case what I am trying to implement is find the location of the "Red_Unit" and compute a distance away from the targetted "Red_Unit".

    An easier illustration of problem trying to be solved is visually described as follows,

    Where the green box around the "Red_Unit" indicates the distance away from the "Red_Unit" at which the "Blue_Unit", if "Blue_Unit" is Selected AND Right Button Clicked "Red_Unit", must stop moving towards the "Red_Unit".

    Thank you for reading and sorry for the long reply. A possible solution to this problem would be very much appreciated.

  • Thank you for your help and clarification. Here are the results illustrated by the next following images below. The idea that dop2000 proposed works. Now the problem with this idea is its usability.

    By usability, meaning that if we were to extend this idea to designing a unit combat system a new problem will arise. To discuss this problem I will first describe the new changes made to the project.

    The “Blue_Unit” now has an additional Behaviour; Turret and the “Red_Unit” has a new Instance Variable called “Targetted” of Type Number. A new Sprite has been added called “Bullet” with a single Behavior Bullet. The following image below illustrates the new game scenario setup.

    Now this problem is similar as to that problem first discussed in this thread, which was how to have a single unit that is selected AND has LOS to a specific object, have that specific object change its animation.

    The problem is of course unit combat system design. What I want to be able to do is,

    If a “Blue_Unit” is NOT moving AND has LOS to “Red_Unit”

    THEN

    Set the value of the “Red_Unit” Targeted to 1 AND add this “Red_Unit” as target.

    If a “Blue_Unit” is moving OR (has NOT LOS to “Red_Unit” AND “Blue_Unit” is NOT moving)

    THEN

    Set the value of the “Red_Unit” Targeted to 1 AND this “Red_Unit” as target.

    If “Blue_Unit” is Shooting

    THEN

    Spawn a Bullet

    The following image below illustrates a simple example of this combat system.

    Currently with this, nothing happens that is the “Blue_Unit” does not Spawn a Bullet. Overall why am I asking this and what I am getting arises from this story where I have had tried a more complicated variation of this combat system.

    Initially I had a family (Units_A) where this family contained,

    “Blue_Unit_0”, “Blue_Unit_1”, “Blue_Unit_2”, … “Blue_Unit_n” , where n is a positive integer.

    “Red_Unit_0”, “Red_Unit_1”, “Red_Unit_2”, … “Red_Unit_n” , where n is a positive integer.

    And so on with different colors and numbers.

    This family (Units_A) would contain the following instance variables,

    Unit_ID of type Number

    Health of type Number

    Damage of type Number

    And so on with different instance variables that could be change for each individual unit in this family.

    This family (Units_A) would contain the following behaviors,

    Pathfinding, LineOfSight, Turret

    Moving the desired units given a set of player restrictions on the screen was easy to setup as the conditions were simple. Once a combat system was required to be implemented this is where problems arise. The main problem was family member identification.

    With family member identification the problem is how do you know if for example “Blue_Unit_0” has LOS to a current “Red_Unit_1” and not to another units relating to its family. The solution for this may be quite simple that is create a copy of that family call is Units_B.

    To follow along what I am describing follow the following link attached below to a game that I am currently designing where there is an attached Template of the game.

    construct.net/en/free-online-games/lifetime-human-war-4211/play

    But creating another copy of the original family presents again a similar problem of unit identification. In some cases this idea works but in this thread not. I have followed these discussion forums links to which are attached below.

    construct.net/en/tutorials/understanding-picking-respect-333

    construct.net/en/forum/construct-2/how-do-i-18/recognizing-individuals-47138

    These threads and discussion discuss issues similar to this thread which brought me to nowhere. As such the next thing I tried is what I am doing now that is create a skeleton structure which will take on future assigned values. That is replacing the function of family with one sprite. Here I am trying to get a simple combat system of units to work between one another.

    Again thank you for reading this thread and any future help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have two different Sprites called “Blue_Unit” and “Red_Unit”. Where the “Blue_Unit” has two Behaviors; Pathfinding and LineOfSight, one Instance Variable called “Selected” of Type Number, and two Animations "Selected" and "Unselected". The “Red_Unit” has no Behaviors, no Instance Variables, and two Animations caleed "Seen" and "Unseen".

    The problem that I am having is when a “Blue_Unit” is Selected AND has Line of Sight (LOS) to “Red-Unit” I want to change the animation of the “Red_Unit” to “Seen”.

    That is I want to indicate to the player, that the currently selected “Blue_Unit” that has LOS to the “Red_Unit”, that the “Red_Unit” is seen by the selected “Blue_Unit”.

    The next following images attached below illustrate a simple setup of the scenario being described above.

    The idea that has been described at the beginning of this discussion Forum and illustrated by the preceding images works perfectly fine if and only if there exists one instance of “Blue_Unit” on the layout. Once this idea gets extended to multiple instances this approach no longer works.

    The result is quite simple I have one unit (call it “A”) and multiple instances of it (copies of the unit “A”). Also I have multiple copies of another unit (call it “B”). When I select one unit “A” out of the many copies of itself AND unit “A” has LOS to unit “B” change the animation of unit “B” to what I specify.

    Note that if unit “A” is selected but does not have LOS to unit “B” do not change the animation.

    With that I have stated my problem and what is the result that I want. I hope to hear from you guys suggestions, comments, and possible a practical solution to this problem.

    Thank-you for reading this thread.

  • The thought of using famlilies I have tried issues that I came accross were that AI would not be able to identify its Own vs Opponent Armies and would combat it own self. Cell is just an invisible gameobject that exsities behind each building (Roads, Farms, Mines, and Castles). To which Player and Bots set their armies to.

    Player and AI objects are the same because they are Armies that the Player decideds to select. Since I do not know what the player selects out of the possible combination I had to create those possibilies.

    What distinguishes them from being Player and AI is on start of game a global variable exists called "PlayterSelect" when player choses an Nation and enters the game, the AI for that nation is disabled and Player controler is enabled. So basically since there are 11 Nations I had to create 11 Player Control and AI systems, all which are consited of copied and pasted code with different conditions for each other Nation and different actions.

    Unfortnately, the line of sight (LOS) was the easiet way creating the AI system in the first place. As for use pick nearest army or something similar I do not clearly understand what you mean by that, because there is nothing like that I mangaed to find on the internet.

  • Good day to all who is reading this.

    I am designing a Turn Based Strategy (TBS) game called "LifeTime of Human War" you can play this game on Construct 2 -> Arcade -> Strategy Games, there you can see what the game is about and how it is played.

    The game is operational but in the designing of this game I am facing two major problems with Player and AI maintenance. To see the issue in the image files below.

    The Player Control and Fight Army

    The AI Control and Fight Army

    As you can see in order for the game to work, it is required to program each individual sprite (in this case Army), their conditions and actions according to what triggers those events to occur. This required an immense amount of copy and paste the same code and rewriting them according to each of the sprites needed conditions.

    And as seen in the game and the code images provided above, it is an ineffective and inefficient way of designing this game, as this raises maintenance issues.

    I have tried using families but AI would fight it own self. Tried creating invisible objects that would attach itself to each AI every other turn and another for the Player, but that raised issues in destroying that invisible object to pinned to sprite and issues with game resource management.

    So, basically I am stuck with this issue of maintaining my code in being efficient. Any help or suggestions would be greatly appreciated, an example of your solutions would also be of great use in designing this game.

    Thank-you for reading this and really would appreciate your help.

  • 7 posts