Scap's Forum Posts

  • Thank you for your answer! With your help I could to do it. I tried the "for each" but it didn't work properly in my situation, but therefore I learned the properly use of compare instance function. So, the solution very easy now:

    Conditions:

    • On left button clicked on Builder decrease icon (minus button)
    • NPC Compare instance variable: NPC; "function" equal to "builder"
    • Pick a random NPC instance

    Action:

    • NPC Instance variable: Set value "function" to "idle"

    Finish. Now when I want to reduce only the amount of Builders (or other units) I can do it perfectly.

    Previously, my problem was that when I want to reduce this ones, not just the type of selected units amount were decreasing (now: Builders) instead, the other ones as well (for example: Woodcutters amount too).

    Anyway, now working properly!

  • Hello,

    Basic situation: I have an npc sprite with an instance variable (name: function). I can change this variable with buttons on the screen (woodcutters + - and builders + -). This variable decide what kind of unit will be the npc. For example, I have six npc with "idle" inst. variable. I add two "woodcutters" and three "builders" and one unit stay "idle". I can decrease the unit number with the minus button.

    The problem: When I use one of this button, not only the actual unit type reduced, but also to the other type. I try to explain you with this:

    This is my units:

    • W W B B B W // The first two Woodcutters and after three Builder and finally one Woodcutter again.
    • I want to decrease the builders now, so I use the "Builder -" button. What going to happen?
    • This: W W B B B I // I as Idle, this is the basic function.
    • I wanna to get this result: W W B B I W // As I don't need three builder I have to reduce on two, but I can't isolate only the builders.

    I don't know how pick a value between the builders without the woodcutters. First I have to isolate the builders and after I need to pick a value between the three builders and give this number (IID?) to a global variable. I tried a lot of solution but a always I got something problem. I tried every "pick" condition. Actually I don't know what should I do more. Any idea?

  • Thanks! The PickedCount was the missing part. The pick by comparison didn't work.

    I had to use the "pick by evaluate" It's working correctly now

    • pick by evaluate:

    Obj: NPC

    Expression: NPC.Function = "Woodcutting"

    • Set global variable

    Npc.PickedCount

  • Hi,

    I have one npc type with a "function" instance variable. This variable consist a basic "idle" value. I have six in this npc type.

    I can change their instance variable one by one if I want. So, if I change 4 units inst vari instead of idle to woodcutting I remain 2 npc with idle and 4 with woodcutting inst vari.

    Now, I want to counting that how many woodcutter units I have at this moment and write in a global variable.

    I don't know how should I do this because I need a number to "set global vari", but have no any number except the 6 npc. How can I count how many woodcutters and idle units I have?

    I tried this method:

    Conditions:

    • Every thick
    • Pick nth instance >>> Object: NPC >>> Instance: npc.Function = "woodcutting"

    Actions:

    • Set global variable >>> ??????

    Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • jojoe Of course I need these templates! Unfortunately I couldn't send a PM for you because I didn't reach the 500 reputations yet and until I haven't this amount (or more) not possible the PM sending. So, If you can send me one with these templates. Im sure it's going to be very useful for me! Thank you.

  • Thanks guys it's working! I can separately control the units now if I want it. I used the Pick random instances and Nth instance. I don't know the array yet, but i will learn it as well meanwhile I make this game.

    Thanks for the exemples, I check this ones and try to learning more I'm sure that I will be more "beginner" questions in the future which will connect to this project. I hope you guys will help me next time too. Thanks!

  • Hello,

    I wanna to make a kind of strategy game, but I stuck at one point because I can't control the units separately.

    For example, I have four unit and one of these ones have to go to cut a tree. In my game I can not do the "select one unit and send to the tree" method! I just select the tree and marking as cutting and after one (or more) unit automatically depart in direction of the tree and will cut it. Of course not the cutting the point, only the control over my units.

    So, the main problem that all worker units start do it instead of only one. How should I solve this problem? Something about the UID/IID? I don't know...

    Each units have a unique IID number. Somehow I should use it, but I don't know how should I give an order/action to only one unit.

    Condition:

    • If I clicked a tree

    Action:

    • A unit with IID 4 (or a random units) start to cut the tree meanwhile the others stay calm.

    Please help me I really need the solve it's an essential step! Or any tip/idea?

    Thank you all!

  • Thank you!

    It's a good idea and almost working. I had to change some parameters. My next problem with this, that the ship not too precise and not go throught the object every time. I don't know what can it be the problem. Sometimes almost precise, sometimes not. That's why the enemy spaceship fire or hit or not.

    I did some print screem action because I thought it's interesting.

    The lines the ship 'footprint', the red part the 'shoot range'. I did every test 60 second and I didn't change nothing.

    1 Hit, 15 fault

    16 Hit , 0 fault

    10 Hit, 5 fault

    Nothing change among the test, just I click on restrat. I did a lot of test not just three. The result is same. Sometimes not precise with many fault and a lot os test quite precise and some avarge same the third picture.

    Thanks again, the result is not bad, I can use your idea. I'm just curious why can this be...

  • Hello

    I'd like to do that the enemy's spaceship go toward one of mine object (ship, building ...) and shoot when it close to one. If this ship reach my object need to go forwad in order to do a new attack cycle. So the ship reach this object go forward and if it's far enought have to turn away and back to go to my object (begin again the cycle, re-attack).

    However this idea is not working as I guess the basic movements (bullet, pathfinding ...) unsuitable for this method. I can to do that the npc fire if it's close enought and it's go forward toward the object but the bullet behaviour can't turn away, the patfinding if should turn, the firt thing what do it stop, and just afterthat turn away to object. I drew a picture for the ease of understanding.

    Any idea?

    Red arrow, top right - Enemy ship, npc

    Green dot, center - Object

    Greenish yelow line - Enemy movement

    1. Go forward toward object (I can to do it)

    2. Movement continue meanwhile starting fire (I can to do it)

    3. It reached the object but must not stop, just should to go foward (how?)

    4. Turn away to object like on the picture. Must not stop! (I have no more idea how can I do it ...)

    5. Fire again while reach the object. Same as 2. (I can to do it) (Meanwhile we're in the cycle/turn 2.)

    6. Go throught the object whitout stop. Same 3. step.

    Etc etc... again and again.

    Thank you!

  • Hello,

    So, I have a room with walls and the npc can walking inside of course. In the room there are solid block walls. That's why, the npc can't go through the walls, for exemple to the other room. But I (the player) can building doors on the walls if I want it. I would build walls where I want on the walls. (Otherwise it will be a top-view game). The problem is the npc won't go through the door because under the door there located the part of wall. The player can build the door anywhere on the wall.

    You can imagine this situation as a problem of the river (as wall) and the bridge (door). I'd like to build a bridge above the river. Of course the npc doesn't go through the river and he's need a bridge. I can build a bridge anywhere part of the river. I was build a bridge but the npc couldn't walk through this, as the river stayed under the bridge and this one have a solid behavior and it overwrited the basic non-solid behavior of the bridge for some reason. I don't know why. The bridge on upper layer than the river.

    I need a simple solution. I hope you understood what I want and the situation as well. Thank you!

  • Thanks! Meanwhile I realized this solution

  • Hello

    So, I have some instance variables in my spaceship sprite (weapon_1_ammo, weapon_2_ammo ...) and I want to write out my ingame screen.

    I don't want to use global or locale variables for this. The 'set text' function is can't use instance vari of my ship. It's just can use the global and locale vari.

    Is there something solution for this?

  • Thanks but I don't open it. My program version is 173. This file will save with 175.

    If the "script" of this file not too complex may be enough a picture about the script for me.

  • Hello

    In my game the player move in "snap to grid" style (top view game). I mean it move one frame/grid to another one.

    Of course in the game there are walls. The walls must be solid as the player can't through walls. So the hero stop when he collisions the walls.

    But he doesn't do it. I think because I don't use movement behaviors. Just I use a simple "if a key is pressed set position to ....". It perfectly works, just it doesn't stop in front of the wall. I tried add a movement behaviors and set the "default controll" is "no". The result is: Stop front of the wall, just when I move left (for exemple) and the player collision the wall, he began to "climp" along the wall.

    I upload my game, maybe it will help you. Thanks!

    I think write here and I ask you, because I have no more idea...

  • Thanks! Your solutions is worked!

    ------

    Global number: snapY = 22

    Global number: snapY = 20

    Set position to + Create object:

    Mouse.X - (Mouse.X%snapX)

    Mouse.Y - (Mouse.Y%snapY)

    Thanks!