Posts by 4burner

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.

    Holy Balls, I fixed it!

    For those in the future doing a search and this comes up:

    Instead of the loop being as described in the first post, there are two major changes; Firstly, instead of running a ForEach loop with an additional Greater/Less than condition, it just runs as ForEach (active, in this case Button), do X. This got rid of the scoping issue with only a certain set of the Actives being referenced. Secondly, instead of that ForEach loop bring triggered in the same core Loop set, the above Loop structure simply sets a certain Flag to On, with another condition below the Events simply being if Flag 0 is On, run the ForEach.*

    *It's actually not that simple. I had to add another layer of extrapolation in that the loop sets Flag 0 on, another condition then checks for Flag 0 activation and sets Flag 1 on, toggles 0 off, and then a third event picks up Flag 1's status and runs the ForEach then. Yeah, I don't get it either.

    Thanks for listening ;)

    Attempted Fix #2

    Instead of running the ForEach loop to determine Highest ID in the core loop, I separated it by having the loop set a flag on, and then in the natural cycle of events, the flag triggers the ForEach loop, thus scoping the latest batch of Special Buttons and not just the newest created. So now it's picking up on the highest value, which is good, but the other problem still remains; When going from a high ID to a low ID (By clicking a unit with say 6 total special rules to then clicking on a unit with only 3) the high ID remains from the previous set, thus setting the Animation to exactly what it was. This doesn't happen when going from low to high, so actually hrm maybe it's event order on the comparison loop...

    Pertinent info:

    -Swapping the order of the button loops narrows down this issue. I swapped Self/Cast loops and now the MaxID return is only ever the highest of the buttons created in the cast loop, if there are any.

    -If I add a simple bit of code to the ForEach loop Set Effect -> Inverted, it applies it to every button, regardless of which loop created the button.

    -When I add a bit of code Add 1 to Global Value A if ID is Greater/To B if equal or lower, the global values only increase by 1 each time I click - I assumed this would increase by 1 for every button that is higher/lower or equal.

    This is doing my head in haha.

    Attempted Fix #1:

    Instead of having the ForEach loop include the comparison, the ForEach loop now is;

    ForEach SpecialTrayButton.Active "MaxID"
    -> Set InfoTray.Active AltVal TempAnimation to SpecialTrayButton.Active AltVal ID
    -> Run Loop "SpecialTrayAnimationCompare"

    On Loop "SpecialTrayAnimationCompare"
    + InfoTray.Active AltVal TempAnimation IS GREATER THAN InfoTray.Active AltVal AnimationSize
    -> Set InfoTray.Active AltVal AnimationSize to InfoTray.Active AltVal TempAnimation
    -> Set InfoTray.Active AltVal TempAnimation to 0

    On Loop "SpecialTrayAnimationCompare"
    + InfoTray.Active AltVal TempAnimation IS LESS THAN InfoTray.Active AltVal AnimationSize
    -> Set InfoTray.Active AltVal TempAnimation to 0

    Still the same outcome, however. Hrmm. So I think maybe it is still somehow working with the old ButtonActives, rather than running the loops on the newly created set. But that doesn't explain why it works perfectly in other situations. Real noodle scratcher.

    So, as generally happens immediately after I hit post, I think I've figured it out. Looking at this loop:

    ForEach SpecialTrayButton.Active "MaxID"
    + SpecialTrayButton.Active AltVal ID is GREATER THAN InfoTray.Active AltVal AnimationSize
    -> Set InfoTray.Active AltVal Animation Size to SpecialTrayButton.Active AltVal ID

    Does the Bold part of the event break scope, and only ever compare the ID AltVal of the newest created button? Since the Self category is run second, and therefore the button will always be freshest, that would explain it...

    Hola team.

    So I have a basic setup involving a few actives that are created/destroyed/updated dynamically, as follows:

    Player Clicks Unit
    -> Run loop UpdateInfoTray
    (amongst other loops, but this is the one that's being odd, and it's executed last and doesn't involve any other moving parts previously scoped/referenced)


    On Loop UpdateInfoTray:

    -> Set InfoTray.Active AltVal OnScreen to 1 (Brings it onto the screen as opposed to hiding it offscreen - no problems here)
    -> Set InfoTray.Active AltVal AnimationSize to 0 (Resets, ready to receive new value, is having slight issues)
    -> Start Loop "SpecialTray Clear" 1 time
    -> Start Loop "SpecialTray CastUpdate" X times
    -> Start Loop "SpecialTray SelfUpdate" X times
    -> Start Loop "SpecialTray EffectUpdate" X times (X in all these loops references a different object's alt val that's keeping track of total number of each category)
    -> Run Loop ForEach SpecialTrayButton.Active "MaxID"

    -----------

    On Loop "SpecialTray Clear"
    -> Destroy SpecialTrayButton.Active

    On Loop "SpecialTray (Cast/Self/Effect)Update" (they all work the same)
    -> Create SpecialTrayButton.Active
    -> Set SpecialTrayButton.Active AltVal ID to (Loop Index)
    -> Set SpecialTrayButton.Active AltVal Index to (value from a different object gotten via index reference, basically the button's "type"
    -> Set SpecialTrayButton.Active AltVal Category to 1/2/3 (Depending on Cast/Self/Effect loop running)

    ForEach SpecialTrayButton.Active "MaxID"
    + SpecialTrayButton.Active AltVal ID is GREATER THAN InfoTray.Active AltVal AnimationSize
    -> Set InfoTray.Active AltVal Animation Size to SpecialTrayButton.Active AltVal ID


    SO.

    As I follow this through, there are two things that aren't happening that should be, and I think it's down to weird scoping ala Vol's recent (and excellent) article.

    What should be happening is, if a Unit has NO Button Actives created, there should be no ID greater than 0, thus the animation value on the Tray object should remain 0. However, I suspect that scoping weirdness is keeping Buttons alive during this loop process, because the first time clicking from a Unit that has say 3, to a unit with 0, the Animation Value remains the same. If I click it again, this time with the Button actives destroyed already ie not in the same loop set, it remains at 0.

    Second issue, is that during the ForEach loop, the ID picked up for the Animation Value on the tray is not always the highest ID on the button Actives. Specifically, it will pick the Highest ID from the objects in the SELF loops, ignoring any button active ID's from the CAST loops. Can't figure out why this is, and I'm guessing it has something to do with scoping again - but it doesn't seem the be the same 'legacy actives' issue from above. The reason I think that is because going from a Unit with say 6 SELF buttons to 3 works fine - If the old buttons were still in scope at this stage, surely the animation value would stay at the highest ID, which would still be 6.

    So. Plan of attack? What's the glaringly simple thing I'm missing here? Appreciate the time spent reading.

    Basically -

    User clicks on Active Object A
    -> Set Alterable String A (Active.Object B) to Alterable String A (Active.Object A)

    It doesn't work. The Expression editor doesn't let it go through, calling it a Syntax Error.

    "Unit Type( "P2 Unit Inner" )" is the exact wording in the editor, because Alterable String A has been renamed to Unit Type. I've tried it without the ""'s ("Please enter a text expression"), I've tried adding Str$() in and around the value, and nothing.

    What glaringly simple thing am I missing here?

    Hi Team;

    Currently working on a top down wargame. Your dudes and dudettes are represent by Active objects called Units and Mobs - the Mobs being the individual figures within the overall Unit. So one specific Unit, when referenced, encompasses both the Unit Active, and each Mob Active that is part of that Unit collective. Following along? Here's a visual; Please login to see this link.

    These Mobs have stats, and occasionally special rules. Also, the Unit itself has a list of stats and special rules independent of the Mobs, and will also inherit stats and special rules from the Mobs within it. A quick example of this inheritance is how far a Unit can move on any given turn - This is worked out by iterating through the Move stats of the Mobs within the Unit, and selecting the (s)lowest, representing a Unit being only able to move cohesively at the speed of the slowest member of the group.

    Similar to this, the Special Rules will often be Inherited by the Unit. Because individual Mobs don't take action - the Unit does - this means that if you wanted to cast an ability that a Mob has, you select the Unit, and the relevant casting option will appear. For example - The Orderguard Battalion Commander has an ability called Rally. Whilst the specific Mob representing the Commander is alive, the Unit can cast Rally in the relevant phase. If the Commander is removed as a casualty, the Unit can no longer cast the ability, and it won't appear when the Unit is selected.

    Since the Specials list is modular, I have devised a way to iterate through and refresh the list of Specials any given Unit has at any time. That part is relatively straight-forward.

    Here's where it gets tricky. The Specials themselves are contained within a large (and expanding) index, with each Special having a corresponding ID#. Also, this index, and therefore the Specials themselves are divided into 3 categories; Cast, Self, and Effect. Cast is an ability you cast ala Rally above. Self is a Passive ability that triggers automatically. Effect is the -result- of a casting, generally speaking. For example;

    Telemetry (ID#199) is a CAST. This Unit, as an action, can cast Telemetry on an Enemy Unit. (Will give the target Unit Special ID#201 Telemetry (2) - See below)
    Telemetry Link (ID#200) is a SELF. Units with this Self gain +1 to Hit Enemy Units marked with Telemetry.
    Telemetry (2) (ID#201) is an EFFECT. It does nothing to the Unit directly, but grants a bonus to Units with the above Self when they target this Unit.

    Now - I have all this data collated into an Array. The X index is a reference to each Unit (IE Unit#3's Specials are written to Array X=3), the Y index is the Specials Index itself (So if there's a value in Y=200, that tells me the Unit has the Self "Telemetry Link"), and the Z index is simply player 1 and 2.

    When it comes to actually programming the game, I don't want the values referenced from the Array, but from the Actives. This is so the flow remains consistent throughout the Engine - The Array is for hard data and doesn't get changed or referenced directly - for the most part - everything is done with the Alt Vals of the Active Objects. So I've got Alt Vals 100-399 of the Units reserved for the Specials. The Engine reads through the Specials Array, and writes the Values to the Unit Alt Vals. 101-199 is for Casting Options, 201-299 is for the Self specials, and 301-399 for Effects. 100,200, and 300 are value holders that tell me how many Special values are actually written for any given Unit. So if a Unit had 3 Effects on it currently, Alt Val 300 will read 3. This is done for a number of reasons, most importantly so that when it comes time to bring up a Unit's info in the display, I can construct the loops in such a way that I know that Casting options are always in 101-199, etc etc.

    And so we come to the actual question! When iterating through the Specials array, and putting the values into the relevant AltVal sections, you may have noticed that they are not in order. So it's not like Effects are Index190-240, there are entries from all 3 categories scattered throughout the Index. Which means that I have unfortunately come up with no better option of writing to the AltVals other than individually having a loop for each Index entry. Example:

    On Loop "Special 199"
    -> Write Value 199 to AltVal 101+(value of AltVal 100)
    -> Add 1 to AltVal 100

    On Loop "Special 200"
    -> Write Value 200 to AltVal 201+(value of AltVal 200)
    ->Add 1 to AltVal 200

    On Loop "Special 201"
    -> Write Value 201 to AltVal 301+(Value of AltVal 300)
    -> Add 1 to AltVal 300

    So there are only 3 loops really, which differentiate where values should be written to, but since I can't run the same loop for a range I have to specify each individual value and run the write version of the loop. So I have ended up with something like 260 Events, which does not seem at all efficient.

    I am curious if someone can think of a better method for this. As a caveat, I can't change the Index values, because they are data that has been created wayyyyyyy back in the Army selection and creation screens - a lot of the pregame stuff also uses these values and therefore they are set in stone.

    Thanks all. If I can clarify anything, please let me know. This took way too many attempts to make it readable and even then I don't know how successful I was. ;)

    Sort of like acceleration? I've never messed with the physics engine in Clickteam, but a spaceship game I cobbled together for Ludum Dare one time had an acceleration modifier. Basically if desired speed was greater than current speed, every X milliseconds add (Accelerator Counter Value) to current speed. Upgrades could increase said counter, resulting in faster/slower acceleration.

    I'm probably way off the mark here. But "Thrust power" sounds like acceleration as far as I can read into it. At least, in this context.

    Had this same issue with a game I was making that relied on the creation/firing of actives for the AI pathfinding. It all obviously went to hell when the AI went off-screen and would then stop pathfinding. Never did find a way around it before switching gears to the current project, so I'd be keen to get to the bottom of this issue also.

    Global Objects don't automatically appear in the other frames - you have to have the same object in all frames you want it to appear in. Correct me if I'm wrong here, but the functionality of global means it will keep it's state from one frame to the next if it appears in both - that's the gist, anyway.

    As an example, I have an array in my current project called InGameArray that has data written to it in frame 1. The object itself appears in Frame 1 and 2, so when I load into frame 2 from frame 1, all the data remains.

    Make sense?