Applying random rotation to features

Applying random rotation to features

Discuss maps & map creation - from concept to execution to the ever elusive release.

Moderator: Moderators

Post Reply
User avatar
The Yak
Posts: 351
Joined: 20 May 2012, 05:36

Applying random rotation to features

Post 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
Last edited by The Yak on 12 Aug 2015, 18:21, edited 1 time in total.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Applying random rotation to features

Post 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
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Applying random rotation to features

Post 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.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Applying random rotation to features

Post 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.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Applying random rotation to features

Post 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?
User avatar
The Yak
Posts: 351
Joined: 20 May 2012, 05:36

Re: Applying random rotation to features

Post 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.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Applying random rotation to features

Post by PicassoCT »

you write a Table called customParams into the FeatureDef

Code: Select all

...
customParams={
randomrotate =true
}
...
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Applying random rotation to features

Post 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.
User avatar
The Yak
Posts: 351
Joined: 20 May 2012, 05:36

Re: Applying random rotation to features

Post 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.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Applying random rotation to features

Post by smoth »

Cool, I'll be here
Post Reply

Return to “Map Creation”