Building a station

Freeform discussion about anything related to modding Transcendence.
User avatar
DigaRW
Militia Captain
Militia Captain
Posts: 517
Joined: Thu Jul 30, 2015 3:10 pm
Location: The place where I belong
Contact:

How to... Spawn a station using dockscreen?

I mean if I destroyed a enemy station, then I want to replace it to friendly station like a Commonwealth station. Then I must to dock to destroyed stations, and there a few choices:
-Build
-Loot
-Jettison
-Undock

So then, how to make the Build button?
Download Transcendence mods from Reinvented Workbench Project!
Click this link!
JohnBWatson
Fleet Officer
Fleet Officer
Posts: 1452
Joined: Tue Aug 19, 2014 10:17 pm

Are you trying to figure out how to build a dockscreen? That can be figured out looking at the game's source code.

The particular function you're looking to create is pretty easy too. Look at Dynamic Systems to see how it's done - it's a core feature of that mod.
User avatar
DigaRW
Militia Captain
Militia Captain
Posts: 517
Joined: Thu Jul 30, 2015 3:10 pm
Location: The place where I belong
Contact:

No, I mean the Build button in abandoned station dockscreens. If we choose build button, then we can spawn a station to replace the old ones. Just like Korolov Shipping in Charon, the destroyed Korolov station will replaced with 'reconstructed' Korolov station after we destroy all Charon bases, but in this case we use the dockscreen to trigger it.
Download Transcendence mods from Reinvented Workbench Project!
Click this link!
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

I would suggest that ( since I did station spawns at one time ) that you balance the proposal using the talented arts of PM 's Ship rebuilding system ( as in PlayerShip Drones ):

you can generate a list of stations the player might desire : then the player must have, collect or Buy the needed materials to start the construction ( a construction fee might be needed if the Player doesn't have robots to do the job )

either way I think a ship that enters the system to dock at or 'hold near the station location while repairs are being done or constriction of a new station is going on would be a good option since many playerships don't have much of any crew to actually do the work....
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
JohnBWatson
Fleet Officer
Fleet Officer
Posts: 1452
Joined: Tue Aug 19, 2014 10:17 pm

DigaRW wrote:No, I mean the Build button in abandoned station dockscreens. If we choose build button, then we can spawn a station to replace the old ones. Just like Korolov Shipping in Charon, the destroyed Korolov station will replaced with 'reconstructed' Korolov station after we destroy all Charon bases, but in this case we use the dockscreen to trigger it.
If you're just looking to rebuild the destroyed station and set its sovereign to that of a friendly faction(or have the same friendly station be constructed regardless of the enemy station that is destroyed), it may be possible by altering the default abandoned screen. Be advised that docking won't be possible unless you give all of these stations a dockscreen.

Otherwise, you'd have to add a custom abandoned dockscreen to every enemy station that you'd like to make rebuild-able for your code to look okay and be maintainable.

I'd again advise you to look at how DySys did it. I think it'll help you a lot.
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Ok distracting myself from my probability midterm tomorrow but anyways there is an event that is run when every dockscreen is opened (forgot the name). In that event, add a switch that checks if it's the abandoned station dockscreen. Then in the generic abandoned station dockscreen (probably it's in the file named RPGDockscreens?), add the command to "Build Station" and then in that "Build Station" command you check for the old station's data like sovereign, position, etc. then sysCreateObj the station. You might have to add data onto the station so you remember the sovereign because I don't think you can get that normally.

If you go to IRC they will fill in all the blanks and give you details.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
NMS
Militia Captain
Militia Captain
Posts: 569
Joined: Tue Mar 05, 2013 8:26 am

The events are <OnGlobalScreenInit> and <OnGlobalPaneInit>. I think you want the second one because a screen can have multiple panes and you may want it to check when switching between panes, not just when switching to a totally different screen.
User avatar
DigaRW
Militia Captain
Militia Captain
Posts: 517
Joined: Thu Jul 30, 2015 3:10 pm
Location: The place where I belong
Contact:

Thanks a lot, but I'm gonna use my way first. I'll using &dsAbandonedStation, and it can be applied regardless enemy station or friendly station. If there's a trouble, I'll use your advices.

The dockscreen should look like this (I'm away from my PC, so I can't send the code).
>In abandoned station
-Loot
-Jettison
-Build
-Undock

>Build
-Build station A
-Build station B
etc.

>Build station A (Check if player have enough items and credits, if not then show "No Build" pane)
-Next (Then remove "required" items and cash from player, after that replace the station and force undock).

Well, I'm not gonna using vanila station. I'll using the mod station for itself.
Download Transcendence mods from Reinvented Workbench Project!
Click this link!
User avatar
Xephyr
Militia Captain
Militia Captain
Posts: 857
Joined: Fri Dec 14, 2007 1:52 am
Location: Orion Arm, Milky Way
Contact:

What you're trying to do isn't really all that complex.

Under the <Default> pane in your dockscreen, include this:

Code: Select all

							<Action name="Build" key="B">
							(block nil
							(sysCreateStation &stStationUnderConstruction; (sysVectorPolarOffset gSource (random 0 359) 1))
							(objdestroy gsource)
							)
							</Action>
If you want to preserve the items or other data on the old station then you'd have to handle that too, though.
Project Renegade (Beta) : "The Poor Man's Corporate Command!"
Real programmers count from 0. And sometimes I do, too.
relanat
Militia Captain
Militia Captain
Posts: 941
Joined: Tue Nov 05, 2013 9:56 am

Check out the SantaClausBox mod http://xelerus.de/index.php?s=mod&id=1358. It spawns heaps of stations and the code is easier to understand than GODMod. (Although I haven't checked it, it's gotta be easier than GODMod. :lol: )

Other than that use scrAddAction to add to an existing dockscreen if you don't want to overwrite them (I'm pretty sure you know this, it's for newer modders).
Stupid code. Do what I want, not what I typed in!
relanat
Militia Captain
Militia Captain
Posts: 941
Joined: Tue Nov 05, 2013 9:56 am

Oops, a quick search of Semesta IGC shows no scrAddAction. My bad. Assumptions...never good.

You can use scrAddAction to add an action to the righthand side of an existing dockscreen without overwriting them. See TranscendentGeek's topic called "Using ScrAddAction To Change Dockscreens Without Overwrting" in Modding Reference for a great explanation on how to use it.
Stupid code. Do what I want, not what I typed in!
User avatar
DigaRW
Militia Captain
Militia Captain
Posts: 517
Joined: Thu Jul 30, 2015 3:10 pm
Location: The place where I belong
Contact:

Thanks, I'll try it.
And now, I have a problem with "required material".
Example:
To build the station, it need 8 titanium ore and 10000 credits.

Code: Select all

(block (switch)
(setq gItem (objRemoveItem gPlayership &itTitaniumOre; 8))
(setq gCost (plyCharge gPlayer 10000))
It's correct?

BTW, I was working a new mods.
Download Transcendence mods from Reinvented Workbench Project!
Click this link!
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Try this

Code: Select all

(block Nil
	(and
		;check requirements
		(geq (count (objGetItems gPlayership "* +unid:&itTitaniumOre;;")) 8)
		(geq (plyGetCredits gPlayer) 10000)
		)
		;build the station
		(block Nil
			;remove the ore and the credits
			(objRemoveItem gPlayership &itTitaniumOre; 8)
			(plyCharge gPlayer 10000)
			;build the station here 
			(......)
			)
		(plymessage gPlayer "not enough items!")
	)

The problem with your code is that it always goes through whether the player has the items or not. Here at least the player is warned that they don't have the items.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
DigaRW
Militia Captain
Militia Captain
Posts: 517
Joined: Thu Jul 30, 2015 3:10 pm
Location: The place where I belong
Contact:

After finishing End-Year Exam, I finally can continue this upcoming mod project.
But still, have a problem with this.
Then, what solution for this thing?
Attachments
Here is the code
Here is the code
Codes.jpg (100.12 KiB) Viewed 7303 times
Here is a problem.
Here is a problem.
Problem.jpg (137.93 KiB) Viewed 7303 times
Download Transcendence mods from Reinvented Workbench Project!
Click this link!
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1190
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

 I think the problem is that &itTitaniumOre; is a type, not an item, and George is a little inconsistent about just which functions allow you to substitute one for the other. Instead of:

Code: Select all

(objRemoveItem gPlayerShip &itTitaniumOre; 4)
 Try this:

Code: Select all

(objRemoveItem gPlayerShip (itmCreate &itTitaniumOre;) 4)
 See if that fixes things.
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
Post Reply