Adding custom character to ship at game start

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

DonOctavioDelFlores
Posts: 7
Joined: Sun, 23. Nov 14, 08:34
x3tc

Adding custom character to ship at game start

Post by DonOctavioDelFlores »

Hi all.

Just started modding yesterday, i´m doing a game start. The problem is, i want to add to my ship, as crew members, custom characters that i added to characer_macros.xml.

I saw that theres is a <people> element available at the <ship> node, but didnt manage to make it work by calling <macro ="character">. My intuition tells me that i need to create a "entity" in a md script during startup, but i dont know were to look for functions/commands and parameters available. I´m going blind without documentation, xsd´s help a little, but are too confusing. There is an "api reference" somewhere?

Any help would be appreciated.
aidebob
Posts: 3
Joined: Fri, 28. Nov 14, 20:59
x4

Re: Adding custom character to ship at game start

Post by aidebob »

DeadlyDa's Young Gun gamestart adds a pilot to your ship in its MD script:

viewtopic.php?f=181&t=431991
DonOctavioDelFlores
Posts: 7
Joined: Sun, 23. Nov 14, 08:34
x3tc

Re: Adding custom character to ship at game start

Post by DonOctavioDelFlores »

I saw that, in fact, that mod was the inspiration to start.

Code: Select all

				<!-- Add Pilot to Player Ship -->
				<find_ship name="$PlayerShip" owner="faction.player" space="player.zone" multiple="false" />
				<create_control_entity name="$NewPilot" object="$PlayerShip" post="controlpost.aipilot" >
					<select race="[race.teladi]" tags="tag.aipilot"/>
					<owner exact="faction.player"/>
				</create_control_entity>
The problem is that i couldn´t find documentation on what those variables are, what parameters does this method accepts. I did some digging and some experimentations but with no success.

Are the Xsd´s the only kind of documentation for this api? The answer may be there somehere, but is hard to look at.
User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13486
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Adding custom character to ship at game start

Post by euclid »

DonOctavioDelFlores wrote: Sun, 27. Dec 20, 21:02 ..............
Are the Xsd´s the only kind of documentation for this api? The answer may be there somehere, but is hard to look at.
AfaIk yes, the xsd are the only source. You also want to check the existing xmls for example on how to use a particular command. I'm using AstroGrep to find a specific expression in files.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Return to “X4: Foundations - Scripts and Modding”