varying mission screen descs query

Freeform discussion about anything related to modding Transcendence.
Post Reply
relanat
Militia Captain
Militia Captain
Posts: 816
Joined: Tue Nov 05, 2013 9:56 am

Fri Feb 01, 2019 2:45 am

Finally got a mission working. Having trouble with the screen descriptions.

A custom system (Iotant) in the Network mod has only two stations, a custom Korolov station and a Charon stronghold. The mission only happens in this system and is available unless the Charon station has been destroyed. This is the only station of this type and the mission only happens once.

The mission is to get a custom weapon from the destroyed Charon station and return it to the Korolov station.

The desired result is to have:
1. a neutral screen description if the mission can't start because the Charon station has been destroyed, it would read something like "You see people busy at their consoles". This would also show after the player declined the mission,
2. a favorable one if the player successfully completes the mission,"Well done on the mission." and
3. a third if the player fails the mission because they stole the weapon, "Get out, thief."

Not sure how to do this.

Currently the Korolov station launches the mission using this code. This is the only mission with the attribute 'D789KorolovIotant'.

Code: Select all

<DockScreens>
	<Main>
		<Panes>
			<Default descID="descDefault">
				<Actions>
					<Action id="actionCommandCenter" default="1">
						(rpgMissionAssignment {
							missionCriteria: "n +D789KorolovIotant;"
							noMissionTextID: 'descNoMissions
							maxPerStation: 1
							})
					</Action> etc.
There is a text ID in this dockscreen which currently appears if the mission can't run and after the mission has run, either successfully or not.

Code: Select all

<Text id="descNoMissions">
	TODO: 'No missions' text.
</Text>
This could be set to the neutral screen description but would need to change after the mission had run.

Any ideas on how to do this?


Also, although not relevant here, is there some way of differentiating between missions that fail for different reasons? eg, if the mission fails because the owner object is destroyed vs the mission fails because a target ship gates out.
Attachments
NetworkKorMission01 from 46.xml
(14.86 KiB) Downloaded 22 times
Stupid code. Do what I want, not what I typed in!

giantcabbage
Militia Lieutenant
Militia Lieutenant
Posts: 102
Joined: Thu Apr 07, 2011 9:05 pm

Fri Feb 01, 2019 1:51 pm

The best way to do this is with the new rumor system - see Raisu Station for an example.

In this case you would put the neutral response into the stations descNoMissions. Then create appropriate rumors for the success / failure case of the mission. In the Raisu example this section in the GetRumor event:

Code: Select all

(= (msnGetProperty gSource 'ownerID) (objGetID (@ gData 'stationObj)))
	(if (msnGetProperty gSource 'isSuccess)
		{
			attributes: 'commonwealthHabitat
			priority: 10000
			dialogID: 'descMeetingHallHappy
			}
		)
Will return a rumor if we’re docked at the mission owner (i.e. Raisu) to display the descMeetingHallHappy text with a very high priority.


Other ways you could get a similar result are:
  • Create a dummy mission (i.e. one with just briefing text, but no actual mission). For examples see Heretic00 or Antarctica01. Note both of these were written before the rumor system was added.
  • Alternatively you can put code into the descNoMissions element. However, this is a bit messy as you end up with mission code in the station object. Or you can set station data as done with the Commonwealth Agriculture mission (again this should probably be replaced with a rumor in a future update)
relanat wrote:
Fri Feb 01, 2019 2:45 am
Also, although not relevant here, is there some way of differentiating between missions that fail for different reasons? eg, if the mission fails because the owner object is destroyed vs the mission fails because a target ship gates out.
Just set some additional data on the mission when the appropriate failure occurs. e.g. Raisu can be failed if the station is destroyed and sets a different state if the player is responsible. Likewise the Battle arena missions have two failure states: playerLeft or playerKilled

NMS
Militia Captain
Militia Captain
Posts: 545
Joined: Tue Mar 05, 2013 8:26 am

Fri Feb 01, 2019 5:23 pm

How are you determining if the player stole the weapon? If you detect it when it happens, you could fail the mission. Or maybe use an OnCanDebrief event. See http://wiki.kronosaur.com/modding/xml/missiontype. If you want the overall result (reward, etc.) to be the same, but just have different text for a particular part of the mission depending on some stored data, you can use code in the appropriate mission text.

relanat
Militia Captain
Militia Captain
Posts: 816
Joined: Tue Nov 05, 2013 9:56 am

Thu Feb 07, 2019 2:39 am

I used the rumors event with a success and failure option. Works very nicely. Thanks. (Bulky code; I'll condense it later.) I had thought of putting "code into the descNoMissions element" but, as you say, it didn't seem like a good idea.

Code: Select all

(switch
 	(!= (msnGetProperty gSource 'nodeID) (sysGetNode))
 		Nil
  
 	(and (eq (msnGetProperty gSource 'ownerID) (objGetID (@ gData 'stationObj)))
		(msnGetProperty gSource 'isSuccess)
	)
 			{
 			attributes: 'D789KorolovIotant
 			priority: 10000
 			dialogID: 'descCommCenterHappy
 			}
 		)

   	(and (eq (msnGetProperty gSource 'ownerID) (objGetID (@ gData 'stationObj)))
 		(msnGetProperty gSource 'isFailure)
	)
 			{
 			attributes: 'D789KorolovIotant
 			priority: 10000
 			dialogID: 'descCommCenterFailure
 			}
 		)
 )
Couple of questions.

In the attributes field of the above code, where is this attribute being searched for? In the mission, the station or in Language elements?

I didn't think this could be done as I assumed gSource (the mission object) would be cleared at completion.
What mission information is available after the mission has completed, for how long and is it available out of system.
I assume all msnData is cleared somewhen but it seems as if mission properties are saved forever. Is this correct?

One last one. How does Raisu Station select the &msRaisuStation; mission? The dockscreen has this code:

Code: Select all

(rpgMissionAssignment {
	missionCriteria: "n +commonwealthHabitat;"
	.....
but the mission doesn't have the 'commonwealthHabitat' attribute.

Code: Select all

<MissionType UNID="&msRaisuStation;"
	name=	"Liberate Raisu station"
	attributes=	"commonwealth, special, deliveryMission"
	.....
I thought that only missions with the specified attributes could be run.

How are you determining if the player stole the weapon?
It is rather clunky.
If 1. the Charon station is destroyed,
2. the weapon isn't still in that station (it gets added on destruction) and
3. the player doesn't have it in the hold
4. when they dock at the owner station;
then the player is assumed to have stashed it somewhere with the intention of keeping it.
That causes mission failure and sets 'msnData 'playerStoleWeapon' to 'True'.
The mission also fails if the owner station is destroyed.
I haven't differentiated between the two causes yet and will possibly use 'msnDestroy' instead if the station is destroyed.
If you want the overall result (reward, etc.) to be the same, but just have different text for a particular part of the mission depending on some stored data, you can use code in the appropriate mission text.
Thanks. That's helpful. The plan is to have a different intro or briefing if the player has already been blacklisted by Korolov. That'll do it.
Last edited by relanat on Sun Feb 10, 2019 12:59 pm, edited 1 time in total.
Stupid code. Do what I want, not what I typed in!

giantcabbage
Militia Lieutenant
Militia Lieutenant
Posts: 102
Joined: Thu Apr 07, 2011 9:05 pm

Thu Feb 07, 2019 8:08 pm

With rumors the attributes elements determines which stations will display the rumor. For example, the Black Market station has a GetRumors event which always returns a single rumor with the commonwealthPub attribute. This can be displayed by any station which requests commonwealthPub rumors (generally this is done with the same criteria as missions)

When a dockscreen calls rpgMissionAssignment the function will attempt to:
  1. Display an active mission at the station (i.e. mission the player has accepted)
  2. Display an open mission at the station (i.e. mission has been created, but player has not yet accepted it)
  3. Create a new mission which matches the missionCriteria
  4. Display a rumor which matches the rumorCriteria (or missionCriteria)
  5. Display the noMissionTextID
When displaying a rumor the engine will call GetRumors on all active stations in the system and on ALL mission objects (open, active, success, or failure), in addition to GetGlobalRumors on all types. These are filtered to select only those which match the appropriate criteria then one is randomly selected (weighted by the rumor priority)

See Mission and Rumor Locations for a list of the current criteria used by stations
relanat wrote:
Thu Feb 07, 2019 2:39 am
I didn't think this could be done as I assumed gSource (the mission object) would be cleared at completion.
What mission information is available after the mission has completed, for how long and is it available out of system.
I assume all msnData is cleared somewhen but it seems as if mission properties are saved forever. Is this correct?
All player missions are kept - once the player accepts a mission the object will remain accessible even after completion.

Normally the only time a mission object is destroyed is for non-player missions (i.e. player never accepted them) which have been completed somehow - e.g. the Korolov Destroy stronghold mission will proceed as a non-player mission if you decline it. However, you can get the game to record non-player missions too by setting recordNonPlayer="true" for the mission type.
One last one. How does Raisu Station select the &msRaisuStation; mission? The dockscreen has this code:
[snip]
I thought that only missions with the specified attributes could be run.
The Raisu station mission is not created by the rpgMissionAssignment function. Instead it is created in the OnGlobalSystemStarted event. This event is often used for missions which need to be created before the player docks at the appropriate station. Once the mission has been created the rpgMissionAssignment will display it regardless of the missionCriteria

Note - if you have multiple screens offering different missions at the same station then you need to use displayCriteria to make sure the created missions only display in the correct screen - see St Katharines which uses displayCriteria to keep the university and hospital missions from interfering with each other.
That causes mission failure and sets 'msnData 'playerStoleWeapon' to 'True'.
The mission also fails if the owner station is destroyed.
I haven't differentiated between the two causes yet and will possibly use 'msnDestroy' instead if the station is destroyed.
Both cases should be treated as mission failure. Just set appropriate mission data so you can tell why the mission was failed. Setting playerStoleWeapon for one case is fine.

relanat
Militia Captain
Militia Captain
Posts: 816
Joined: Tue Nov 05, 2013 9:56 am

Mon Feb 11, 2019 7:52 am

Thank you very much for taking the time to document this info. It is invaluable and greatly appreciated.
Also the links you have supplied have really helped to understand the code more.

And now I know why random rumors are appearing in a Commonwealth Fleet mission I'm working on!
Stupid code. Do what I want, not what I typed in!

Post Reply