fun with sysHasAttribute

This is a moderated forum that collects tutorials, guides, and references for creating Transcendence extensions and scripts.
Post Reply
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

sysHasAttribute is not a tricky function but it has a cool potential.

With it can make random systems themed systems. In the OnGlobalSystemCreated of your adventure just check what kind of system it is with sysHasAttribute and if so go through and replace things that do not belong with that theme with stuff that does belong. (this is just begging for filter)

Now think of it easy to make themed systems, weapons convention type of system, a residential type system, Sung dominated type system only limited to what kinds of themes you can think up.

Just a note I would make a list of attribute replacing function pairs so you can add new ones without worrying about breaking the old themes.
Crying is not a proper retort!
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

Yes, it could do that- but it also can retrieve information about the system for you, and be useful in making linking decisions.

Have you tried putting multiple attributes in there? I was wondering if we could add some finer details such as "newBeyond, tradeLane" then be sure that every tradeLane system gets a trade station-

I was also thinking that we could alter the system elements to incorporate these specialty station calls- kind of like they get a Primary station- every random system could get a Trade station (if it isn't used, we swap it for a random.. easy!)
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

multiple attributes should be fine but I don't know how I feel about a tradeLane or giving them primary stations specifically. Making the game less random blah blah blah.
Crying is not a proper retort!
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

umm... hello? Have you looked at a system design element recently?

Here, I will make it easy on you- this is a current snip, it was also in 098d:

Code: Select all

			<!-- Primary Station (90% chance) -->

			<RandomLocation probability="90" locationCriteria="++LifeZone,*planet">
				<RandomStation stationCriteria="*friendly,*primary"/>
			</RandomLocation>
Every random system gets a 'primary' station 90% of the time, Betel. That doesn't really detract from the randomness.

You go ahead and start coding some system altering scripts. It gets painful quick. It is better to use the system design element, imho.
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

90% is not 100% plus I would rather make one little function per new system than X system descriptions (where X is the amount of types of system the theme could appear in and that will grow as the game grows) each with the potential for errors.

How hard is it to filter out all stations that don't fit the theme and replace them with a random station that does. Remember each theme has separate code these are not long functions. (you might want a replace station helper function though)
Crying is not a proper retort!
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

Here's the thing- rather than conceptualize it to death, I already did a lot of work towards this goal in 098d. Scripting is slow. Searching out and destroying existing objects is inefficient.

Is there now a way to filter a list of stations to build? There wasn't in 098.

However-

You are so confident that it's a great idea- so do it.
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

um filtering was perfectly doable in .99 it is just faster now.
Sorry Periculi but I find that attitude rather bad who are you to say what is a good idea just because you did it the old way (and do it yourself wow I can't believe you said that)?

Anyway that is just a distraction from the topic at hand. Uses for these functions are what this series is all about and maybe inspire new people to start modding the "harder" mods. :)
Crying is not a proper retort!
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

I am planning on making a mod that needs to replace the closest planet to the sun with a station (actually a group of stations), is there a nice way to do this?
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

is it for a specific system or just in general?

but anyway all you need to do is (in OnGlobalSystemCreated)
get the nearest planet to the star (a variant of the closest mineable asteroid in the filter thread)
then get its position
then destroy it
then place the stations you want at that location
Crying is not a proper retort!
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

It is for every system. Thanks alot. I've got to look at that filter function more closely.
Post Reply