Page 1 of 1
Applying random rotation to features
Posted: 12 Aug 2015, 04:45
by The Yak
The only method I know of is to compile the features within mapconv and set rotation to -1. This works, but I was really hoping to avoid compiling features in for my next map and applying them via lua. Is there a better way to do this?
EDIT: -1 not -0
Re: Applying random rotation to features
Posted: 12 Aug 2015, 09:29
by PicassoCT
Code: Select all
if ( FeatureDefs[FID].customParams.randomrotate ) then
Spring.SetFeatureDirection(featureID, math.random(-1,1), 1, math.random(-1,1))
end
From Forb s Feature placer? You need to set randomrotate in customParam
Re: Applying random rotation to features
Posted: 12 Aug 2015, 12:16
by Beherith
The Yak wrote:The only method I know of is to compile the features within mapconv and set rotation to -0. This works, but I was really hoping to avoid compiling features in for my next map and applying them via lua. Is there a better way to do this?
Just a minor correction: -1, and not -0.
Re: Applying random rotation to features
Posted: 12 Aug 2015, 16:29
by Forboding Angel
PicassoCT wrote:Code: Select all
if ( FeatureDefs[FID].customParams.randomrotate ) then
Spring.SetFeatureDirection(featureID, math.random(-1,1), 1, math.random(-1,1))
end
From Forb s Feature placer? You need to set randomrotate in customParam
I only made feature place standalone, it is entirely Smith's work.
Re: Applying random rotation to features
Posted: 12 Aug 2015, 20:14
by PicassoCT
All i ever wanted, is to see you two fight to the death.. is that asked too much. Cant you just take credit and run with it?
Re: Applying random rotation to features
Posted: 12 Aug 2015, 23:48
by The Yak
PicassoCT wrote:Code: Select all
if ( FeatureDefs[FID].customParams.randomrotate ) then
Spring.SetFeatureDirection(featureID, math.random(-1,1), 1, math.random(-1,1))
end
From Forb s Feature placer? You need to set randomrotate in customParam
>Search spring wiki for customParam
-No Results
>Search FP_featureplacer.lua for customParam
-No Results
Can we dumb down the explanation here? I don't know what I'm supposed to do with this information.
Or am I supposed to be adding that code snippet to FP_featureplacer?
My features are already set to -1rotation and they definitely aren't random.
Re: Applying random rotation to features
Posted: 13 Aug 2015, 07:17
by PicassoCT
you write a Table called customParams into the FeatureDef
Code: Select all
...
customParams={
randomrotate =true
}
...
Re: Applying random rotation to features
Posted: 13 Aug 2015, 23:58
by smoth
This isn't for use in mapconv
the custom param is for a deeper setting in the random rotation.
Mapconv doesn't DO rand rotation with that param. You can write some gadget to read all features, remove them and replace them randomly if you want.
What I am assuming you want is something like the random rotation feature in feature placer which was when you placed a feature you enabled this setting and the feature could rotate cardinal(n,s,e,w) or actually random. ANY CUSTOM PARAM is not part of spring but part of another lua.
Give me a clearly defined requirement and I could probably shart this out in an hour(time given for testing) for you.
Re: Applying random rotation to features
Posted: 16 Aug 2015, 06:47
by The Yak
That sounds great smoth. I'm going to make an initial release first once springfiles returns to life. I'll be in touch about what I exactly want later.
Re: Applying random rotation to features
Posted: 16 Aug 2015, 19:01
by smoth
Cool, I'll be here