Page 1 of 1

spawn model based on conditional?

Posted: Tue Jun 21, 2011 2:24 am
by Mic
In the structure

RepeatSpawnX: Repeat "Iterate X"
OnIteration
ZExpression
SpawnModel TestMod1


how do you do

if(x < 15)
{
SpawnModel TestMod1
} else{
SpawnModel TestMod2
}

Can it be done within the Project tree or is it an edit xml thing? Hints would be fine :-) TIA,

Mic.

Posted: Tue Jun 21, 2011 5:55 am
by Mic
Excellent. Got it.

Posted: Tue Jun 21, 2011 6:26 am
by Mic
k :) did this with a Condition "Is Iteration < 15?" and an OnTrue SpawnModel 1 with an OnFalse SpawnModel 2. Now I want to add a 3rd Model.

Do I have to

Condition "Is Iteration < 10?"
OnTrue
SpawnModel1
OnFalse
OnCondition "Is Iteration < 20?"
SpawnModel2
OnFalse
SpawnModel3

or can I get to these Components with code in a ZExpression as in

if( Iteration < 10 ) {
spawnModel(Model1)
} else if( Iteration < 20 ) {
spawnModel(Model2)}
else if( Iteration <= 30 ) {
spawnModel(Model3)}

Thanks,

Mic

Posted: Tue Jun 21, 2011 8:32 am
by VilleK
You can use the createModel-function that was introduced in 2.0.

It is only documented here at the moment because the documentation wiki is slightly outdated.

good reading - thanks

Posted: Tue Jun 21, 2011 4:18 pm
by Mic
Is there any info on some of the options that show up under Add Component? Stuff like CallComponent etc? As always TIA.

Posted: Tue Jun 21, 2011 6:54 pm
by VilleK
If you see a component or property that is not documented on the wiki then search for it on this forum and you'll find help. Nothing has been added that hasn't been discussed on these forums first.

For instance info about CallComponent can be found here.

I should really update the wiki but unfortunately I find writing documentation very boring. Which is a shame because if it's not documented no one will use the features of course, but still this is a hobby project I'm doing for fun so things I find boring tend to be postponed :) . For these reasons volunteers willing to help update the wiki is highly welcomed.

Posted: Tue Jun 21, 2011 7:42 pm
by Mic
thanks - I know all the info is out there somewhere - just having a little difficulty finding it at the moment