How do i add wares to a trader
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
-
- Posts: 345
- Joined: Tue, 7. May 13, 16:07
How do i add wares to a trader
this might be a stupid question but i have bin googling and looking in this forum but i cant seem to find the right anwer. so please can someone tell me how i add new wares to a trader.
i made a new missile but i cant add it to the trader. i know it has to do with the NPC_Itemtrader.xml but i cant make heads or tails of that one.
also how do i calculate range and Acceleration Time for the T file.
i made a new missile but i cant add it to the trader. i know it has to do with the NPC_Itemtrader.xml but i cant make heads or tails of that one.
also how do i calculate range and Acceleration Time for the T file.
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
think you're looking for md\Setup.xml. this bit:
from cue name="Start"
problem is, i'm pretty sure that cue only ever runs once per game, so adding to that list will require a new game start. you could patch it in, but that could break horribly if a new game update is ever done and that cue were also patched by the update. compatibility issues if anyone else ever patches the same cue as well. without patching, think you should be able to just add your new missile into that list.
that's from assets\fx\weaponfx\macros\missile_player_guided_light_macro.xml
edit: sorry, forgot you wanted range. that's defined by the acceleration, speed, and lifetime of the missile. acceleration and speed are defined on the missile engine. in this case, assets\props\EngineSystems\macros\engine_missile_player_guided_l_macro:
forward acceleration is 270 m/s^2, up to a top speed of 775 m/s, and the missile lasts for 12 seconds. missile accelerates for 2.87ish seconds in which it travels (if my math is correct) around 1112 meters. cruises for 9.13 seconds at top speed, so max range is around 8188 meters.
Code: Select all
<set_value name="md.$ArmsDealerLists" exact="
[
[
[ware.spe_ammo_dumbfiremissile, 20, 40, 90],
[ware.spe_ammo_dumbfiremissile_h, 8, 16, 70],
[ware.spe_ammo_guidedmissile_l, 18, 36, 90],
[ware.spe_ammo_guidedmissile, 16, 32, 80],
[ware.spe_ammo_guidedmissile_h, 6, 12, 70],
[ware.spe_ammo_swarmmissile, 4, 8, 70],
[ware.spe_ammo_swarmmissile_h, 2, 4, 60],
[ware.spe_ammo_torpedo, 2, 4, 50],
[ware.spe_ammo_empmissile, 0, 0, 0],
[ware.spe_ammo_torpedo_02, 0, 0, 0]
]
]
"/>
problem is, i'm pretty sure that cue only ever runs once per game, so adding to that list will require a new game start. you could patch it in, but that could break horribly if a new game update is ever done and that cue were also patched by the update. compatibility issues if anyone else ever patches the same cue as well. without patching, think you should be able to just add your new missile into that list.
sorry, not sure what you mean. do you mean the range and acceleration time of the missile? that should be in the asset macro of the missile. something like:ADMNtek wrote:also how do i calculate range and Acceleration Time for the T file.
Code: Select all
<missile amount="1" lifetime="12" guided="1" icon="player_weapons_secondary_starflash" retarget="1" selfdestruct="1" />
edit: sorry, forgot you wanted range. that's defined by the acceleration, speed, and lifetime of the missile. acceleration and speed are defined on the missile engine. in this case, assets\props\EngineSystems\macros\engine_missile_player_guided_l_macro:
Code: Select all
<acceleration forward="270" reverse="270" strafe="360" pitch="180" yaw="180" roll="180" />
...
<speed forward="775" reverse="0" strafe="0" pitch="360" yaw="360" roll="360" />
-
- Posts: 345
- Joined: Tue, 7. May 13, 16:07
my setup.xml now look like this is that correct.
and thanks for the other info cant believe i didn't come up with that .
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<diff>
<add sel="/mdscript/cues/cue[@name='Start']/actions/set_value[@name='md.$ArmsDealerLists']">
<set_value name="md.$ArmsDealerLists" exact="
[
[
[ware.spe_ammo_swarmmissile_jericho, 25, 50, 80],
]
]
"/>
</add>
</diff>
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
my md's rusty, but i think that'll replace the lists of all arms dealers so they'll only ever sell your missile. come to think of it, this should be more like what you wanted:
placed in a file called "ADMNtek_init.xml" in the md folder. that should add your missile to all Arms Dealer lists once, regardless of whether it's a new game start or an existing game. should be compatible with any mods that add missiles as well, unless they overwrite the entire list. in the last case, you could just make sure that your cue loads after the incompatible mod.
could also make it so that it checks every time a game starts to see if your missile was already added and, if not, add it. let me know if you want to go that route.
not the only way to do this, of course, and not sure if it's the best way. but should work.
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="ADMNtek_init" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="init_MissileTraders">
<conditions>
<check_any>
<event_cue_completed cue="md.Setup.Start"/>
<event_game_loaded/>
</check_any>
</conditions>
<actions>
<do_all exact="md.$ArmsDealerLists.count" counter="$i">
<append_to_list name="md.$ArmsDealerLists.{$i}" exact="[ware.spe_ammo_swarmmissile_jericho, 25, 50, 80]"/>
</do_all>
</actions>
</cue>
</cues>
</mdscript>
could also make it so that it checks every time a game starts to see if your missile was already added and, if not, add it. let me know if you want to go that route.
not the only way to do this, of course, and not sure if it's the best way. but should work.
-
- Posts: 345
- Joined: Tue, 7. May 13, 16:07
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
think you have to add your missile to the player ship macros. those are in assets\units\player\macros\unit_player_ship_a_macro.xml, unit_player_ship_b_macro.xml, and unit_player_ship_c_macro.xml. (no idea why there are three of them.) under <slot ref="weaponconnection3"> and/or <slot ref="weaponconnection4">.
and don't forget to register your missile macro in index\macros.xml.
and don't forget to register your missile macro in index\macros.xml.
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
one for each possible starting CP (during the Game the Ship Macro will remain unchanged, jut the CP Macro is swapped - but this way the starting CP is defined)w.evans wrote:think you have to add your missile to the player ship macros. those are in assets\units\player\macros\unit_player_ship_a_macro.xml, unit_player_ship_b_macro.xml, and unit_player_ship_c_macro.xml. (no idea why there are three of them.)
there is btw also a fourth one with a slightly diffrent name (i think it was build)
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
-
- Posts: 345
- Joined: Tue, 7. May 13, 16:07
i did currently look like this. i tried with just one and with both connections.
and i have this in my macros xml
Code: Select all
<diff>
<add sel="/macros/macro/properties/weapons">
<slot ref="weaponconnection3">
<cycle index="11" ref="missile_player_swarm_jericho_macro" />
</slot>
<slot ref="weaponconnection4">
<cycle index="11" ref="missile_player_swarm_jericho_macro" />
</slot>
</add>
</diff>
Code: Select all
<diff>
<add sel="/index">
<entry name="missile_player_swarm_jericho_macro" value="extensions\JerichoMissileMod\assets\fx\weaponfx\macros\missile_player_swarm_jericho_macro"/>
<entry name="engine_missile_player_swarm_jericho_macro" value="extensions\JerichoMissileMod\assets\props\EngineSystems\macros\engine_missile_player_swarm_jericho_macro"/>
<entry name="wrs_jericho_macro" value="extensions\JerichoMissileMod\assets\wares\macros\wrs_jericho_macro"/>
</add>
</diff>
Last edited by ADMNtek on Wed, 28. Sep 16, 22:48, edited 2 times in total.
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
Code: Select all
<diff>
<add sel="/macros/macro/properties/weapons/slot[@ref='weaponconnection3']">
<cycle index="11" ref="missile_player_swarm_jericho_macro"/>
</add>
<add sel="/macros/macro/properties/weapons/slot[@ref='weaponconnection4']">
<cycle index="11" ref="missile_player_swarm_jericho_macro"/>
</add>
</diff>
or you could shorten the paths to:
Code: Select all
<diff>
<add sel="//slot[@ref='weaponconnection3']">
<cycle index="11" ref="missile_player_swarm_jericho_macro"/>
</add>
<add sel="//slot[@ref='weaponconnection4']">
<cycle index="11" ref="missile_player_swarm_jericho_macro"/>
</add>
</diff>
-
- Posts: 345
- Joined: Tue, 7. May 13, 16:07
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
did you use an existing save from before starting experimenting? maybe you made a mistake initially where the cue triggered but didnt do anything, saved afterwards and now you load a save where this cue is complete and doesnt trigger again?
anyway, best post all you have currently, so we dont have to guess into the blue
anyway, best post all you have currently, so we dont have to guess into the blue
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
-
- Posts: 345
- Joined: Tue, 7. May 13, 16:07
i tried it on several saves. including some from long befor i even started with this.
this is the current version.
https://drive.google.com/open?id=0B-hvX ... VdPY1IxcFk
this is the current version.
https://drive.google.com/open?id=0B-hvX ... VdPY1IxcFk
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
which part doesn't work when loading? can't buy your missile at traders? they won't load at the Skunk? they don't work? or they don't do what you expected them to?
i suspect the first, but would be good to confirm.
if the first, would you be willing to work with a save from before you started working on the mod? (also possible to fix if not, but just a tiny bit more complicated.)
i suspect the first, but would be good to confirm.
if the first, would you be willing to work with a save from before you started working on the mod? (also possible to fix if not, but just a tiny bit more complicated.)
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
another idea: did you change the Zone after adding the Mod? because the Traders are created on Zone change with their Inventory based on the Values you changed - but if they are Already created they wont update, so you have to change the Zone after adding the Mod...
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
-
- Posts: 345
- Joined: Tue, 7. May 13, 16:07
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
-
- Posts: 345
- Joined: Tue, 7. May 13, 16:07
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
i would guess a <patch_macro object="player.primaryship"/> in the actions of your ware adding script might help
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
-
- Posts: 345
- Joined: Tue, 7. May 13, 16:07
you might think that but nope nothing. or i added it wrong.
tried it like this
and like this
tried it like this
Code: Select all
<mdscript name="ADMNtek_init" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="init_MissileTraders">
<conditions>
<check_any>
<event_cue_completed cue="md.Setup.Start"/>
<event_game_loaded/>
</check_any>
</conditions>
<actions>
<do_all exact="md.$ArmsDealerLists.count" counter="$i">
<patch_macro object="player.primaryship"/>
<append_to_list name="md.$ArmsDealerLists.{$i}" exact="[ware.spe_ammo_swarmmissile_jericho, 25, 50, 80]"/>
</do_all>
</actions>
</cue>
</cues>
</mdscript>
Code: Select all
<mdscript name="ADMNtek_init" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="init_MissileTraders">
<conditions>
<check_any>
<event_cue_completed cue="md.Setup.Start"/>
<event_game_loaded/>
</check_any>
</conditions>
<actions>
<patch_macro object="player.primaryship"/>
<do_all exact="md.$ArmsDealerLists.count" counter="$i">
<patch_macro object="player.primaryship"/>
<append_to_list name="md.$ArmsDealerLists.{$i}" exact="[ware.spe_ammo_swarmmissile_jericho, 25, 50, 80]"/>
</do_all>
</actions>
</cue>
</cues>
</mdscript>