Greetings Everyone
So it looks, that we cannot have a "player only weapon" ?
If that is true, that is an extreme downgrade. Don´t misunderstood. I´m playing "X" for eternity. But: the whole universe consists of the same 3 shields, weapons and engines ? Really ? Billions of ships? Where is the fun from "pimp up my ship"? If i´m a smuggler, I put four engines on my ship and maybe only one weapon and so on. For me that is a very important thing. Even nowadays you have little cars and 800 PS. That is absolut ridicolous. So i am trying to find a wayout of that desaster (if it´s true).
General idea: Spacesuitlaser and Spacesuitrepairlaser as a ship weapon (and of course direct editing in the savegame). So in my dumb idea normally no spaceship can have a SpaceSuitLaser as a weapon.
I took the mod from the author="iforgotmysocks" (Improved Repair Laser) and changed some things.
Especially repair 0 is important, because than it´s a real weapon. I went out in space and my TeladiPlayerShip was destroyed in 5 seconds.
So it is working. In the shipinfo i can see the damage 20.000MW. But the range is not working. It is still by one km and not ten km. In the ship i flew 1km to an asteroid and could also destroy him. But 2km? No, not working.
So what is wrong ? I am only copying the numbers and codes, if i find a MOD, what i can use. I have no idea of diff and so on.
First Test - adapting Repairlaser of the spacesuit:
<?xml version="1.0" encoding="utf-8"?>
<diff>
<replace sel="//bullet/@range">10000</replace> no
<replace sel="//damage/@hull">20000</replace> is ok
<replace sel="//damage/@repair">0</replace> is ok
</diff>
<!--
<macros>
<macro name="bullet_spacesuit_repairlaser_01_mk1_macro" class="bullet">
<component ref="bullet_spacesuit_repairlaser_01_mk1" />
<properties>
<bullet speed="800" lifetime="4" range="25" icon="weapon_repairlaser_mk1" maxhits="1" ricochet="0" restitution="1" scale="1" attach="1" />
<reload time="4" />
<damage hull="2" repair="1" />
<effects>
<impact ref="impact_spacesuit_repair_01_mk1" />
<launch ref="muzzle_gen_s_repair_01_mk1" />
</effects>
<sounds>
<ambient ref="wpn_beam_repair" />
</sounds>
<weapon system="weapon_repair" />
</properties>
</macro>
</macros>
-->
Second Test: the real laser or the spacesuit; sadly only working as in the real game - why ? But i can fire it form the ship.
Because it is a real weapon, i don´t have to change repair 0.
<?xml version="1.0" encoding="utf-8"?>
<diff>
<replace sel="//damage/@hull">1024</replace> no
<replace sel="//bullet/@speed">8192</replace> no
<replace sel="//bullet/@range">8192</replace> no
<replace sel="//reload/@time">1</replace> no
</diff>
<!--
<macros>
<macro name="bullet_spacesuit_laser_01_mk1_macro" class="bullet">
<component ref="bullet_spacesuit_laser_01_mk1" />
<properties>
<bullet speed="800" lifetime="1" range="200" icon="weapon_handlaser_mk1" maxhits="1" ricochet="0" restitution="1" scale="1" attach="1" />
<reload time="4" />
<damage hull="1" repair="0" />
<effects>
<impact ref="impact_gen_spacesuit_laser_01_mk1" />
<launch ref="muzzle_gen_spacesuit_laser_01_mk1" />
</effects>
<weapon system="weapon_standard" />
</properties>
</macro>
</macros>
<!--
--------------
Savegame-Editing
</connection>
<connection connection="con_weapon_01">
<component class="weapon" macro="spacesuit_gen_repairweapon_01_macro" connection="weaponcon_01" attacker="[0x1fdc7]" attackmethod="hitbybullet" attacktime="46158.832" attackership="[0x1fdc7]" shipattacktime="46158.832" lastshottime="49327.895" id="[0x1c5dd]">
.....
</connection>
<connection connection="con_weapon_02">
<component class="weapon" macro="spacesuit_gen_laser_01_macro" connection="weaponcon_01" attacker="[0x1fdc7]" attackmethod="hitbybullet" attacktime="46183.71" attackership="[0x1fdc7]" shipattacktime="46183.71" lastshottime="49328.446" id="[0x1c5de]">
--------------
Both weapons are working in the Ship.
Slot 1: repairlaser
Slot 2: handlaser
So maybe only a few words are wrong ? Hopefully you give me some pointers.
Of course the main idea is the real laser overpowered and the repairlaser original as intendend. But i had only the repairlaser for the start. Good old try and error method.
thanks, hv
Repairlaser and Spacesuitlaser as shipweapon
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 189
- Joined: Mon, 22. Dec 03, 17:15
-
- Posts: 1244
- Joined: Fri, 8. Nov 13, 22:35
Re: Repairlaser and Spacesuitlaser as shipweapon
So i'm assuming u already crafted all ur weapon mods? And maybe all the other mods that were created just so you can have your specialized equipment that just excells other stuff? 
https://i.imgur.com/MMEN1zW.png
It's been years since i created new weapons and ships for X-R (which is fairly similar to X4 in that regard), so i might have forgotten about a few keypoints,
but to summ it up, you basicly have components that contain the mesh data, lights and all the other things for looks. Then u have macros that include that stats.
For a weapon to work u'll need the weapon itself and a "bullet", a projectile or laser, something that the weapon fires.
The "bullet" data can be found here: \assets\fx\weaponFx\macros
The "weapon data here: \assets\props\WeaponSystems
The easiest way would be to look at some ship weapon that already exists, copy the macros to your mod, adjust name and all the things u wanna chance,
apply an already existent component to your weapon macro and add ur macros it to the /index/macro.xml list.
Then u'll most likely have to create the fitting wares for them, /libraries/wares.xml. Then you'll have to figure out where the current weapons are linked to the shipyards,
add them there and then you should have a custom weapon you can equip.
Now that's how it worked in X-Rebirth, there's prolly some difference to how X4 does it, but it might give you a rough idea.
Best look for a mod that already adds new weapons and u'll have it alot easier.

https://i.imgur.com/MMEN1zW.png
It's been years since i created new weapons and ships for X-R (which is fairly similar to X4 in that regard), so i might have forgotten about a few keypoints,
but to summ it up, you basicly have components that contain the mesh data, lights and all the other things for looks. Then u have macros that include that stats.
For a weapon to work u'll need the weapon itself and a "bullet", a projectile or laser, something that the weapon fires.
The "bullet" data can be found here: \assets\fx\weaponFx\macros
The "weapon data here: \assets\props\WeaponSystems
The easiest way would be to look at some ship weapon that already exists, copy the macros to your mod, adjust name and all the things u wanna chance,
apply an already existent component to your weapon macro and add ur macros it to the /index/macro.xml list.
Then u'll most likely have to create the fitting wares for them, /libraries/wares.xml. Then you'll have to figure out where the current weapons are linked to the shipyards,
add them there and then you should have a custom weapon you can equip.
Now that's how it worked in X-Rebirth, there's prolly some difference to how X4 does it, but it might give you a rough idea.
Best look for a mod that already adds new weapons and u'll have it alot easier.

-
- Posts: 189
- Joined: Mon, 22. Dec 03, 17:15
Re: Repairlaser and Spacesuitlaser as shipweapon
Thanks for the answer, but of course i already found the 2 files, otherwise i wouldn´t have startet. I never crafted anything. Still dont know how to do, but thats no problem.
I am meaning, that there is maybe only a litte syntax error, because the rest was easy. So why does the game accept the second line with 20000MW damage and the switch to a real laser, but ignores the range. The range is also standing in the line, so it maybe only a stupid error. The original says range=25.
-- So how is the "codeline", if i only want to change the range to 5 km ?
-- can i have 5 lines with replace ? or is there a limit ?
<diff>
<replace sel="//bullet/@range">10000</replace> no
<replace sel="//damage/@hull">20000</replace> is ok
<replace sel="//damage/@repair">0</replace> is ok
</diff>
<macros>
<macro name="bullet_spacesuit_repairlaser_01_mk1_macro" class="bullet">
<component ref="bullet_spacesuit_repairlaser_01_mk1" />
<properties>
<bullet speed="800" lifetime="4" range="25" icon="weapon_repairlaser_mk1" maxhits="1" ricochet="0" restitution="1" scale="1" attach="1" />
<reload time="4" />
<damage hull="2" repair="1" />
<effects>
<impact ref="impact_spacesuit_repair_01_mk1" />
<launch ref="muzzle_gen_s_repair_01_mk1" />
</effects>
merci
I am meaning, that there is maybe only a litte syntax error, because the rest was easy. So why does the game accept the second line with 20000MW damage and the switch to a real laser, but ignores the range. The range is also standing in the line, so it maybe only a stupid error. The original says range=25.
-- So how is the "codeline", if i only want to change the range to 5 km ?
-- can i have 5 lines with replace ? or is there a limit ?
<diff>
<replace sel="//bullet/@range">10000</replace> no
<replace sel="//damage/@hull">20000</replace> is ok
<replace sel="//damage/@repair">0</replace> is ok
</diff>
<macros>
<macro name="bullet_spacesuit_repairlaser_01_mk1_macro" class="bullet">
<component ref="bullet_spacesuit_repairlaser_01_mk1" />
<properties>
<bullet speed="800" lifetime="4" range="25" icon="weapon_repairlaser_mk1" maxhits="1" ricochet="0" restitution="1" scale="1" attach="1" />
<reload time="4" />
<damage hull="2" repair="1" />
<effects>
<impact ref="impact_spacesuit_repair_01_mk1" />
<launch ref="muzzle_gen_s_repair_01_mk1" />
</effects>
merci
-
- Posts: 1244
- Joined: Fri, 8. Nov 13, 22:35
Re: Repairlaser and Spacesuitlaser as shipweapon
U are forgetting something. Sure u can set the range to limit the dmg application range, but if we do some simple math and see how far our laser would travel with a speed of 800 m/s, yet the laser only has a lifetime of 4 seconds, then we're left with an actuall range of 3.2km.
Once you adjust the speed and lifetime, you should see better results.
Once you adjust the speed and lifetime, you should see better results.

-
- Posts: 189
- Joined: Mon, 22. Dec 03, 17:15
Re: Repairlaser and Spacesuitlaser as shipweapon
I forgot the stupid word properties. Now it is working.
In 10km distance i destroyed an asteroid and a mining ship went into dust with two hits. The Handlaser refuses to work with the identical codes, which is very interesting, because they are more or less the same.
I am searching now for the laserturrets, which you can place in space. That would make more sense, because i doubt, that a ship has a laserturret as shipweapon installed.
Does anyone knew the file for the spaceturrets ?
<?xml version="1.0" encoding="utf-8"?>
<diff>
<replace sel="//properties/bullet/@speed">10000</replace>
<replace sel="//properties/bullet/@lifetime">1</replace>
<replace sel="//properties/bullet/@range">10000</replace>
<replace sel="//properties/reload/@time">2</replace>
<replace sel="//properties/damage/@hull">20000</replace>
<replace sel="//properties/damage/@repair">0</replace>
</diff>
And thanks again to iforgotmysocks, because one second after his MOD the idea popped into my brain ......
(now i only had to make the beam wider for good looking)
In 10km distance i destroyed an asteroid and a mining ship went into dust with two hits. The Handlaser refuses to work with the identical codes, which is very interesting, because they are more or less the same.
I am searching now for the laserturrets, which you can place in space. That would make more sense, because i doubt, that a ship has a laserturret as shipweapon installed.
Does anyone knew the file for the spaceturrets ?
<?xml version="1.0" encoding="utf-8"?>
<diff>
<replace sel="//properties/bullet/@speed">10000</replace>
<replace sel="//properties/bullet/@lifetime">1</replace>
<replace sel="//properties/bullet/@range">10000</replace>
<replace sel="//properties/reload/@time">2</replace>
<replace sel="//properties/damage/@hull">20000</replace>
<replace sel="//properties/damage/@repair">0</replace>
</diff>
And thanks again to iforgotmysocks, because one second after his MOD the idea popped into my brain ......
(now i only had to make the beam wider for good looking)