Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?
There is an event for this Pick or Count > 'Pick "Object" at random'!
There are some fastloop articles here that show a way of picking objects based on an ID value (using spread value). That's probably the best way of handling this.
Just had a look, here are some that helped me a lot:
You mean you want to iterate through your objects?
If all you want is for an object to be picked according to its value, for example pick only the object with Value A of 1, we just insert:
"Alterable Value A("object") = 1"
into the conditions of an event. This will narrow down selection of the objects to only the ones with Value A = 1. If it might occur that MORE then 1 object could have value of 1, just add a "Pick Object at random" below it on the conditions list.
If you want to have a single specific event apply to ALL objects, according to their alterable value A, in such a way as it will not work by simply having one generic event, its a bit more complicated. For example, if all you needed to do was add 1 to the value A of all objects, you'd just need the event
"Add 1 to alterable value A
In any generic condition event, like "always. However, if you wanted to do something more complex, like attach ANOTHER object to that object, like pin the tail of a donkey object onto a donkey (I'll refer to the two objects as Tail and Donkey respectively, then), than its a bit more work.
Say you have 10 copies of Donkey, and 10 copies of Tail, and each one is ordered 1,2,3,4,5,6,7,8,9,10 in their value A, and you wanted to pin each to the respective owner. If you just did:
*Value A of "Tail" = Value A of "Donkey
=Set Pos(Tail) to Pos(Donkey)
It WOULD NOT work. Instead, only it would probably do something odd like pin every single tail onto the same donkey (the newest copy of it). This obviously isnt what we want.
Instead, whatyou gotta do is iterate through the objects; Use a fast loop to check each pair.
*Always:
=Start Loop Trigger 0 for (# of Tails) Loops
*On Loop Trigger 0
+Value A(Tail) = Position(Loop 0)
+Value A(Donkey) = Position(Loop 0)
=Set Position of Tail to Pos(Donkey)
The downside of this is that we're using an entire alterable value of both objects for no purpose but indexing a loop. In MMF you get 26 values, so its not really a problem, but in TGF you only get 3. In the possibility that you do not need a specific tail attached to a specific donkey, and they can be interchanging positions at any point with no repercussions, we can use random object picking. In loops where ur just iterating through a single object to do a complex function, unlike those where you're pinning together two objects, this can be very very helpful:
*Always:
Set Donkey Flag 1 Off
Set Tail Flag 1 Off
*Always:
=Start Loop Trigger 0 for (# of Tails) Loops
*On Loop Trigger 0
+Tail Flag 1 is Off
+Donkey Flag 1 is Off
+Pick a Tail at Random
+Pick a Donkey at Random
=Set Position of Tail to Pos(Donkey)
=Set Tail Flag 1 On
=Set Donkey Flag 1 On
^I have no idea if thats what you're asking, but it certain is good to know either way!
All I want to do is something that would be extremely simple to do in a real programming language.
I want so that when the Hero Collides or Overlaps the Active Platform, that Platform which the character is overlapping becomes the main focus point of the group which all platforms are in.
The goal is to keep TGF's group feature from glitching up on me.
I've figured out that if you use positional code, along with grouping code, it tends to only set the position for one type of active in the group. There are oddities with how it interprets code dealing with groups. Some code that logically you'd think would need to be set as for the entire group of actives, in fact needs to be set for only one of them to get it to work for all, alot of strangeness that I need a way to normalize.
I did actually get the Groups to work now, but at the cost of my positioning code for the Hero to stay with the Moving Platform as it moves. And even then, I'm not sure how stable it will be. So now that you know the specifics, is there a good solution to this problem ?
Anyone out there understand what I mean ? ... the spread value feature is nice and all .. but could someone Please explain how to make it so when the character is overlapping an active object, that becomes the one chosen for the code to work for ?
There has to be a way. If I knew how, then I could probably get my initial code clear down to 3 events.
Thanks Pixelthief, but those methods only work if I was using just one active type, but how do I spread the values across many completely different actives with different movement schemes ?
I'm beating my head against the wall over this ... isn't there anyone who can help ?
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?