Mooreel's Forum Posts

  • 11 posts
  • Reluctantly I did it now the (very) ugly way... How to optimise that, i was sure in construct someone manages that with 2 conditions or so ;- )

  • Thank you.

    It sounds awfully much effort for a very simple condition. The goal is that if a unit is in range of another unit which has a different isfriendly value of this unit, the fight animation is played.

    I try this now for 2 days and cant get it done :- (

  • Hello,

    I have 2 families, Enemy, Friendly with the same objects in each of them (Soldier, Catapult in example)

    How can I create a catapult of family Friendly? I hoped for something like "Enemy.Catapult" but i cannot find something like that in the manual or tutorials.

    If I cannot create (same) objects for different families, I do not understand why I would ever use two families if I have to dynamically create objects in the game.

    Many thanks

    Nico

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The instance variable defines whether they are friendly, so you create the object and set its variable as such. Families are used to stop repeating events that apply to all members of a family, as seen in the logic if Friendly is in range of Enemy, which replaces if Friendly Soldier is in range of Enemy, if Friendly Catapult is in range of Enemy etc

    as a poster before suggested to introduce a second family for enemies i thought i could get rid of the extra variable for isFriendly. Why do i need two families then if i cannot spawn an object as part of a certain family?

    Many thanks

    Nico

  • Thanks so much for your reply.

    Am i doing something fundamentally wrong? The Create object by name (via system) doesnt allow to spawn it from a certain family. I want to avoid having friendly objects and enemy objects (as this could add up and the units do not differ in terms of features).

    I added objects into these two families. I cannot use the same family variables again and the objects in enemy will have features of the objects in Friendly Family...

    My hope is i dont need to create features for Enemy units and Friendly units as the units are the same (features and behaviours), just the direction of the movement is different..

    My best case would be to have something like the below:

    Create Soldier of family Friendly

    Create Soldier of family Enemy

    Friendly in <range> of Enemy: Fire animation etc...

    Many thanks for your help

  • I understand but in my case i need to know if an object is "Enemy" family or "friendly" family. So how can i spawn an object specifically of the ENemy family or friendly family?

    Thanks

    Nico

  • Thank you very much,

    yes this is something I played with. The odd thing is that I cannot create the same variable names on Family level.

    Means I would need to introduce a second set of family instance variables now, this was something i wanted to avoid.

    Also, if i dynamically create such new units now, how can i create an object of a certain family if it is in two? System.CreateObject doesnt allow a selection of Family.Object?

    Many thanks

    Nico

  • Is there any elegant solution for this (I assume very common) problem?

    How can I check conditions between two objects of same family without looping through uids or all objects

  • Hi again,

    i am afraid that didnt work (they pass through each other), what am i doing something wrong?

    Thanks

    Nico

  • Can't you just compare it like this:

    is in range and variable is NOT equal to self.variable ----> attack

    Then both your own and the enemy units will attack all units that doesn't have the same "team variable".

    Interestingly it is not possible to compare the current Unit boolean to self.<boolean> - it only works with numbers/self so i will change to a 0/1 instance variable setup then

    Many thanks!

  • Hi everyone,

    I am currently playing around to create a simple game where the player can create units that run from the left to the right to hit the enemy.

    Setup: multiple unit types(soldier, catapult etc..) in one family "Unit". An instance variable isEnemy is tagging such units as coming from the opponent.

    How can I check that a Unit attacks if another Unit in range and this Unit is an enemy? As soon as I have checks on x variable <Unit.BBoxLeft-Unit.Range Units> & condition <Unit is not friendly> the units start to attacking immediatly after spawning.

    I read the tutorials but I really hoped to avoid checking unit against all object types/uuids or saving evyerthing in local variables somehow.

    Any tips?

    Many thanks

    Nico

  • 11 posts