so i was wondering how i best refer to a completed trade.
im working on a feature to enhance the x rebirth economy.
especially so by increasing immersion.
as part of that i want to give players a temporary tradeoffer subscription for the respective station on a successful trade. ( so keeping good trading relations with companies is rewarded with better cooperation ).
anyway how do I best check for said condition?
is there a trade cue that i can check for "complete"?
or will checking whether a player owned tradeship = buyerentity? and then refering to the station through the sellerentity work?
question about trading
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 585
- Joined: Thu, 26. Feb 04, 00:08
Manual player trades will trigger a cue that will write to the logbook that you could detect and fire another cue of your own. Station traders don't as far as I'm aware trigger anything that you could detect as a condition for firing a cue so it will be a bit more tricky, also you'd need to account for modded ships running custom trade scripts. One way might be to patch into the vanilla trade AI scripts in the section that signals a good trade, something like:
Then in your cue filter out all the trades you don't want and act on those that you do want.
Code: Select all
<signal_cue cue="my_cue" param="[this.ship, $tradingstation, $tradesuccess]"/>
Code: Select all
<set_value name="$tradingship" exact="param.{1}/>
<set_value name="$tradingstation" exact="param.{2}/>
<set_value name="$tradesuccess" exact="param.{3}/>
<do_if value="$tradingship.owner == faction.player and $tradesuccess == true">
award temp trade subscription at $tradingstation (pseudo code)
</do_if>
-
- Posts: 4
- Joined: Fri, 29. Oct 10, 02:33
great idea ^_^
i think ill add a new script "cooperation" with the params "trader" "station" and "friendlylevel"
so i've been skimming through trade.ship.xml and trade.station.xml and i think i understood most of the logic, still im not sure where to add this
been thinking to add this @ trade.ship.xml at the label "perform trade run"
it runs the script "trade.performtraderun" and returns the value $success
i think ill add a new script "cooperation" with the params "trader" "station" and "friendlylevel"
so i've been skimming through trade.ship.xml and trade.station.xml and i think i understood most of the logic, still im not sure where to add this
been thinking to add this @ trade.ship.xml at the label "perform trade run"
it runs the script "trade.performtraderun" and returns the value $success
Code: Select all
<diff>
<add sel = "??????????????">
<do_if value="$success"?>
<run_script name="'cooperation'" >
<param name="trader" value="" />
<param name="station" value="" />
<param name="friendlylevel" value="" />
</run_script>
</do_if>
</add>
</diff>