Problem with "set_faction_relation" in my custom game-start.

The place to discuss scripting and game modifications for X Rebirth.

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

kewlpatate
Posts: 9
Joined: Fri, 29. Nov 13, 18:50

Problem with "set_faction_relation" in my custom game-start.

Post by kewlpatate »

Hi,
I'm trying to make a custom gamestart for myself with a random faction relation but I have a issue with the set_faction_relation. It's work like that, but if I remove the comment the script fail. Any idea why ?

[code]
<do_all min="4" max="6">
<set_value name="$Faction" exact="$NormalFactionsCopy.random"/>
<!--<set_faction_relation faction="faction.player" otherfaction="$Faction" value="$Relation"/> -->
<add_encyclopedia_entry type="factions" item="$Faction.id" />
<remove_value name="$NormalFactionsCopy.$NormalFactionsCopy.indexof.{$Faction}}"/>
</do_all>
[/code]
Last edited by kewlpatate on Wed, 30. Mar 16, 21:19, edited 2 times in total.
w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans »

What's $Relation set to?
kewlpatate
Posts: 9
Joined: Fri, 29. Nov 13, 18:50

Post by kewlpatate »

<set_value name="$Relation" exact="0.0032"/>

I have try with all sort of value instead of $Relation. Nothing.
w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans »

Hm. That's odd.

<set_faction_relation faction="faction.player" otherfaction="$Faction" value="$Relation"/>

should work then.

Only other thing I could think of is if it couldn't set $Faction properly. But in that case, add_encyclopedia_entry shouldn't work either.
kewlpatate
Posts: 9
Joined: Fri, 29. Nov 13, 18:50

Post by kewlpatate »

Any special hidden rule with cue/actions in the structure ? I'm pretty new at modding so maybe It's a structure problem.
w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans »

nothing i could think of that applies here. only really relevant thing would be where $NormalFactionsCopy is stored, and then only if the snippet you posted is in a different namespace. if you didn't change namespace anywhere, and that's somewhere in the same hierarchy as, and is run after, wherever $NormalFactionsCopy is initialized, you should be fine. am assuming that $NormalFactionsCopy is a list of factions?
kewlpatate
Posts: 9
Joined: Fri, 29. Nov 13, 18:50

Post by kewlpatate »

[code]
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="Setup_Gamestarts_Psysoft" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<!-- SETA&JD -->
<cues>
<cue name="Setup_Add_SetaJD" module="psysoft_start">
<conditions>
<event_cue_signalled cue="md.Setup.GameStart"/>
</conditions>
<actions>
<add_inventory entity="player.entity" ware="ware.inv_timewarp" />
<upgrade_object_by_macro object="player.primaryship" macro="macro.unit_player_ship_jumpdrive_macro" exact="100"/>
</actions>
</cue>
<!-- Open up all Jumpgates -->
<cue name="Setup_Open_Gate" module="psysoft_start">
<actions>
<signal_cue cue="md.Setup.Open_Jumpgates_Lib"/>
<cancel_cue cue="md.Setup_DLC2.HomeOfLightMovie_Setup"/>
</actions>
<!-- Relations -->
</cue>
<cue name="ConfigRelations" module="psysoft_start">
<conditions>
<event_cue_signalled cue="md.Setup.GameStart"/>
</conditions>
<actions>
<set_value name="$NormalFactions" exact="[faction.plutarch,faction.heartofalbion,faction.beryll,faction.leddaindustrial,faction.wholesomefoods,
faction.nolimits,faction.albionenergy,faction.argongovernment,faction.jonferson,
faction.aquarius,faction.chow,faction.frantonpharma,faction.sonraenergy]"/>
<set_value name="$Relation" exact="0.0032"/>
<set_value name="$NormalFactionsCopy" exact="$NormalFactions.clone"/>

<do_all min="4" max="6">
<set_value name="$Faction" exact="$NormalFactionsCopy.random"/>
<set_faction_known faction="$Faction" known="true"/>
<!-- <set_faction_relation faction="faction.player" otherfaction="$Faction" value="$Relation"/> -->
<add_encyclopedia_entry type="factions" item="$Faction.id" />
<remove_value name="$NormalFactionsCopy.{$NormalFactionsCopy.indexof.{$Faction}}"/>
</do_all>
</actions>
</cue>
</cues>
</mdscript>
[/code]
kewlpatate
Posts: 9
Joined: Fri, 29. Nov 13, 18:50

Post by kewlpatate »

Well, I don't know what have done but It's working now... 3h of research... Well thx for your help :)
w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans »

yeah. posting code on the forum does that sometimes.
User avatar
YorrickVander
Posts: 2774
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander »

Out of interest, were you doing REFRESHMD between changes and testing? I've noticed in the past that this fails in some nested/decision making instances and restarting game makes the code work.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.
kewlpatate
Posts: 9
Joined: Fri, 29. Nov 13, 18:50

Post by kewlpatate »

I only use notepad++ and restarting the game each time. I suppose REFRESHMD is something from the Dev tools ?

My guest is, I prolly forgot a /> somewhere and I have fix it while posting ;)

Return to “X Rebirth - Scripts and Modding”