Fastloop Spread Value question
I left behind the Spread Value problems I was having for a while and made great progress in other areas of my project. Now I am returning to it a second time and I wanted to ask a question concerning where I'm stuck. I have never solved the issues surrounding the usage of this function of MMF, but the more I read (and read, and re-read) the more I gradually come to understand it relative to my current program.
At the moment I have a setup where I am using fastloops to calculate physics for the NPCs in my game. I believe this is the area that is interrupting my successful use of Spread Value for NPC instances. Below you can see my current script for my NPCs gravity.
http://www.creathcarter.com/site_media/misc/npcFL.jpg
I didn't annotate the events because I don't think it matters, I just want to better understand the conditions applied.
After reading about more Spread Value usage on the Wiki, I want to ask how I can combine ^that^, with this -
Always
-- Spread Value 1 in "ID" of Enemy
-- Start Loop "AI" 'nObjects("Enemy")' times
On Loop "AI"
+ Value "ID" of Enemy = 'loopindex("AI")+1'
-- { perform the actions we specify }
Specifically, where does the fastloop for gravity fit into there? Do I use something like this?
On Loop "AI"
+ On Loop "gravity"
+ Value "ID" of Enemy = 'loopindex("AI")+1'
+ AlterableValue Condition
-- { perform the actions for NPC gravity }
Obviously that won't work, so could someone better explain this function? Thank you for helping someone who is completely in over their head.
Re: Fastloop Spread Value question
It's possible the fastloops have nothing to even do with why my Spread Value does not appear to be working, as one of the NPCs detector objects correctly follows each of its assigned NPC, while the other detector does not.
I posted the actual file with all unnecessary code stripped out over here:
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=93896#Post93896
In case someone wants to take a look at the actual code.
Re: Fastloop Spread Value question
Sometimes the Spread value action must be used in a separated Event. In this case:
Always
-- Spread Value 1 in "ID" of Enemy
Always
-- Start Loop "AI" 'nObjects("Enemy")' times
Re: Fastloop Spread Value question
First of all, use spread value 0 and you won't need to add 1 to the Value = Loopindex event.
To make it work with your gravity loop, use:
* Always
-- Spread Value 0 in "ID" of Enemy
* Always
-- Start Loop "AI" 'nObjects("Enemy")' times
* On Loop "AI"
+ Value "ID" of Enemy = 'loopindex("AI")'
-- Start Loop "gravity" X times
* On Loop "gravity"
+ Value "ID" of Enemy = 'loopindex("AI")'
-- { perform the actions for NPC gravity }
Re: Fastloop Spread Value question
Fast loops mess up object instance selection and backburner actions such as spread value. Put them in separate events.
Quote:
Originally Posted by Francois
This is not a bug, this is how the action routines are coded. I perform several loops of actions. The first exploration of the actions, calls all the actions, including the one shot actions like loops, sound etc., and the object oriented actions for the first object to be explored.
Then the next loops explores the remaining object oriented actions for the other objects, including the spread actions.
So if you want your spread action to be executed before, just duplicate the line of events.
Re: Fastloop Spread Value question
Thank you very much for all the replies. I will spend some time with all this feedback and see if I can make some more sense of it.
Re: Fastloop Spread Value question
- deleted for the sake of all mankind -