[Question] My own story mission

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

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

Post Reply
User avatar
spin1/2
Posts: 288
Joined: Fri, 25. Nov 05, 11:58
x4

[Question] My own story mission

Post by spin1/2 » Sun, 17. Nov 19, 13:48

Hello folks,

I am not deep into X4 yet, because there are things that I miss. Good story missions is one of them and because of that I thought: Why you don't create one's own yourself?

But first I have to figure out are there possiblities in the mod-support to create such story missions?

My Questions:
  1. Can I do a text based communiction with NPC direct, over func and with intercom / email / letters?
  2. Are answers with multiple-choise posible?
  3. Can I include my own pictures to compensate the emotionless NPCs?
My next qusetions would be like "wich trigger-events are possible", "fly to this ...", "escape from this ...", "how can I spawn enemys" and so on. But before I dig into a lot of toturials I have to know is it worth it.

Thanks for your help. :)

User avatar
ElsonG
Posts: 15
Joined: Thu, 28. May 20, 05:50
x4

Re: [Question] My own story mission

Post by ElsonG » Thu, 11. Jun 20, 08:18

Hey, i was looking for a mod like this...
May i ask... Did you succed? If so maybe you can help?
I was wondering if is possible make a "companion mod", to tell an story myself too.
I was looking but so far didn't find the awnser...
I you are interested, know a thing or two on blender, i can make npc models and even, maybe, a ship....

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [Question] My own story mission

Post by euclid » Thu, 11. Jun 20, 15:30

Usually resurrecting a half year old thread is not in the best interest of anyone (especially when the poster has ceased activity ever since). However, this is an interesting case and hence I'll try to contribute rather than just lock the thread. ;-)

To answer some of the raised questions:
You can communicate with an NPC in various ways. If the NPC has already a corresponding script running (means you can hail or talk to him) then the MD event

Code: Select all

event_conversation_started conversation="default" />
allows all kind of action to be triggered. One of them is multiple-choice answers via "add_player_choice" which also has a nested option "add_player_choice_sub".
If it is a "new" NPC, i.e. one of your own creation, then you need to start a conversation (previous to the steps above) via

Code: Select all

<start_conversation actor="newNPC" conversation="MyConversation" type="unqueued" />
replacing the "default" by "MyConversation".
As for including your own (or any) picture, that should be possible with the defining files of the new NPC. But I never attempted anything in this direction and hence my help in this respect is rather speculative ;-)
Finally, once you have established an NPC/conversation, then all kind of things can be triggered via MD events.

Good luck with the mod!

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

hxsgame
Posts: 210
Joined: Thu, 4. Oct 18, 16:54
x4

Re: [Question] My own story mission

Post by hxsgame » Fri, 12. Jun 20, 17:53

euclid wrote:
Thu, 11. Jun 20, 15:30
Usually resurrecting a half year old thread is not in the best interest of anyone (especially when the poster has ceased activity ever since). However, this is an interesting case and hence I'll try to contribute rather than just lock the thread. ;-)

To answer some of the raised questions:
You can communicate with an NPC in various ways. If the NPC has already a corresponding script running (means you can hail or talk to him) then the MD event

Code: Select all

event_conversation_started conversation="default" />
allows all kind of action to be triggered. One of them is multiple-choice answers via "add_player_choice" which also has a nested option "add_player_choice_sub".
If it is a "new" NPC, i.e. one of your own creation, then you need to start a conversation (previous to the steps above) via

Code: Select all

<start_conversation actor="newNPC" conversation="MyConversation" type="unqueued" />
replacing the "default" by "MyConversation".
As for including your own (or any) picture, that should be possible with the defining files of the new NPC. But I never attempted anything in this direction and hence my help in this respect is rather speculative ;-)
Finally, once you have established an NPC/conversation, then all kind of things can be triggered via MD events.

Good luck with the mod!

Cheers Euclid
“once you have established an NPC/conversation, then all kind of things can be triggered via MD events.”
How to use NPC/conversation to triggered via MD events?
Please where can I find more documentation about this?

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [Question] My own story mission

Post by euclid » Sat, 13. Jun 20, 00:25

hxsgame wrote:
Fri, 12. Jun 20, 17:53
How to use NPC/conversation to triggered via MD events?
Here an example taken from the AutoTrader script:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<mdscript name="EuclidsAutoAltTrigger" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
	<cues>
		<cue name="EuclidsTradeMenusIni" instantiate="true" namespace="this">
			<conditions>
                             <event_conversation_started conversation="default" />
				<check_all> 
				 <check_value value="event.object.controlled?" />
				 <check_value value="event.object.controlled.isclass.ship and event.object.controlled.isplayerowned and (event.object.command.value == command.wait or event.object.command.value == null) and (event.object.commandaction.value == commandaction.flying or event.object.commandaction.value == null)" />
				</check_all>	
                       </conditions>
			 <actions>
		    <do_if value="event.object">
					<signal_cue_instantly cue="md.EuclidsAutoTraderAlt.EuclidsATinit" param="event.object"/>
				</do_if>
			  <do_else>
				 <cancel_cue cue="EuclidsTradeMenusIni"/>
			  </do_else>
			 </actions>
		</cue>
	</cues>
</mdscript>
The trigger event here is the start of a conversation. The check_all bracket is just a series of additional conditions. More important, to answer your question, is the next part after the do_if. It signals another MD script. Notice the prefix md in the call of the cue: md.EuclidsAutoTraderAlt.EuclidsATinit. The above example works only on an NPC you can hail or talk to face-to-face. However, there is a neat trick to start a conversation without any NPC involved. The basic scheme is like this:
<conditions>
<event_some event />
</conditions>
<actions>
<do_if value="event.param2 == what ever makes the even valid for you - this is optional">
<start_conversation actor="player.computer" conversation="EuclidsEcoTestMenu" type="unqueued" />
</do_if>
</actions>
The catch here is to use the player.computer to start a conversation. You do not need to have a "real" NPC unless you're planning the player to meet him/her in person.
Please where can I find more documentation about this?
I strongly recomment to unpack the game files and then check the MD and the scripts folder. You can learn a lot just by looking at the vanilla scripts. Do not hesitate to post any specific coding questions here. The modding community is very helpful ;-)

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

hxsgame
Posts: 210
Joined: Thu, 4. Oct 18, 16:54
x4

Re: [Question] My own story mission

Post by hxsgame » Sat, 13. Jun 20, 02:30

euclid wrote:
Sat, 13. Jun 20, 00:25
hxsgame wrote:
Fri, 12. Jun 20, 17:53
How to use NPC/conversation to triggered via MD events?
Here an example taken from the AutoTrader script:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<mdscript name="EuclidsAutoAltTrigger" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
	<cues>
		<cue name="EuclidsTradeMenusIni" instantiate="true" namespace="this">
			<conditions>
                             <event_conversation_started conversation="default" />
				<check_all> 
				 <check_value value="event.object.controlled?" />
				 <check_value value="event.object.controlled.isclass.ship and event.object.controlled.isplayerowned and (event.object.command.value == command.wait or event.object.command.value == null) and (event.object.commandaction.value == commandaction.flying or event.object.commandaction.value == null)" />
				</check_all>	
                       </conditions>
			 <actions>
		    <do_if value="event.object">
					<signal_cue_instantly cue="md.EuclidsAutoTraderAlt.EuclidsATinit" param="event.object"/>
				</do_if>
			  <do_else>
				 <cancel_cue cue="EuclidsTradeMenusIni"/>
			  </do_else>
			 </actions>
		</cue>
	</cues>
</mdscript>
The trigger event here is the start of a conversation. The check_all bracket is just a series of additional conditions. More important, to answer your question, is the next part after the do_if. It signals another MD script. Notice the prefix md in the call of the cue: md.EuclidsAutoTraderAlt.EuclidsATinit. The above example works only on an NPC you can hail or talk to face-to-face. However, there is a neat trick to start a conversation without any NPC involved. The basic scheme is like this:
<conditions>
<event_some event />
</conditions>
<actions>
<do_if value="event.param2 == what ever makes the even valid for you - this is optional">
<start_conversation actor="player.computer" conversation="EuclidsEcoTestMenu" type="unqueued" />
</do_if>
</actions>
The catch here is to use the player.computer to start a conversation. You do not need to have a "real" NPC unless you're planning the player to meet him/her in person.
Please where can I find more documentation about this?
I strongly recomment to unpack the game files and then check the MD and the scripts folder. You can learn a lot just by looking at the vanilla scripts. Do not hesitate to post any specific coding questions here. The modding community is very helpful ;-)

Cheers Euclid
Thank you very much for your answers.
I will be start trying(ง •̀_•́)ง

Post Reply

Return to “X4: Foundations - Scripts and Modding”