Serious Sam Fusion 2017 (beta)

Serious Sam Fusion 2017 (beta)

Not enough ratings
How to make bullet-shooting weapon shoot projectiles
By NSKuber
Improve your custom weapon with this new tool.
   
Award
Favorite
Favorited
Unfavorite
Why do I need this? How does it work?
There are a number of weapon features that are currently only available on weapons that shoot bullets (like spinning or aiming down sights), and you can't make these weapons shoot projectiles by editing params. While it is likely that this will be fixed by Croteam eventually, in the meantime Bullets to Projectiles mod can help out.

The mod's mechanism is simple. Bullet-shooting weapons have an option to make bullets they shoot not hitscan, but physical projectiles instead. But you can't customize these physical bullets. The script in the Bullets to Projectiles mod "catches" these bullets and replaces them with projectile of your choice. That's it.

How do I make my shotgun shoot rockets?
First, make sure you need to use this mod to implement your brilliant weapon idea. If you don't need any of the following features in your weapon:
  • Ability to aim down sights;
  • Ability to shoot many projectiles at once like shotgun;
  • Ability to spin your weapon like minigun;
  • Ability to aim like sniper rifle;
then you definitely can make your weapon without the mod.

Ok, now that you've firmly decided you need to make, for example, rocket-shooting shotgun, let's start.
First, prepare a projectile your weapon will be shooting.
Second, make you weapon as a bullet-shooting weapon, with usual hitscan. Configure the spread, number of bullets and such. Don't make very large spread (a bit bigger than double shotgun's spread is fine), because script can not work properly then. Then, in weapon parameters, change "Bullet type" to "Physical, flying":



Your weapon should shoot yellow glowing bullets now. Now you need to make the script replace the bullets with projectiles. But before you do that, change the speed of bullets in weapon params to zero. After that, create a "Script entity" on any level, and double-click on it to open text editor on the left. Paste the following code into it, changing "PathToWeaponParams", "PathToProjectileParams", ProjectileSpeed and X,Y,Z with values for your weapon:

if (worldGlobals.BulletsToProjectilesWeapons == nil) then worldGlobals.BulletsToProjectilesWeapons = {} end worldGlobals.BulletsToProjectilesWeapons["PathToWeaponParams"] = {"PathToProjectileParams",ProjectileSpeed,X,Y,Z}

X, Y and Z are corresponding values of Position vector in "Rendering params" of your weapon.
For example, for Flak Cannon it looks like this:

if (worldGlobals.BulletsToProjectilesWeapons == nil) then worldGlobals.BulletsToProjectilesWeapons= {} end worldGlobals.BulletsToProjectilesWeapons["Content/SeriousSam3/Databases/Weapons/FlakCannonWeapon.ep"] = {"Content/SeriousSam3/Databases/Projectiles/FlakSlug.ep",150,0,0,0}

Now go to "Entity" tab while your script entity is selected, press on (local) -> Save As and save this script into each of the three folders under any name of your preference:

/Content/SeriousSamHD/Scripts/CustomWorldScripts/
/Content/SeriousSamHD_TSE/Scripts/CustomWorldScripts/
/Content/SeriousSam3/Scripts/CustomWorldScripts/

(saving it in each folder makes it work in the levels of the game you saved it in).

That should be it. You don't need the script entity anymore, only the files that you created matter. Now start the simulation and shoot with your weapon. If everything is done right, it should now shoot specified projectiles (with specified launch speed) instead of yellow bullets.
14 Comments
NSKuber  [author] 26 Dec, 2018 @ 5:37pm 
Yeah, that's a known change that has been made several patches ago. Hitscan bullets, as well as physical ones, now come out from the camera in FP instead of the barrel.
SeriousPC 26 Dec, 2018 @ 9:52am 
For some reason the projectiles of my weapon come off the center of the screen instead of the gun barrel.
Myash 3 Sep, 2017 @ 4:24am 
It works thx. I found it in Entity > Logic > Script.
NSKuber  [author] 3 Sep, 2017 @ 3:47am 
Script files, you mean? Sure, just place a script entity anywhere on the map, and browse to the file (there should be a browsable field on "Entity" tab of script entity). Open, edit, save file.
Myash 3 Sep, 2017 @ 3:25am 
Is it possible to open and edit already created scripts directly from SS editor? Or do I have to create new one each time I want to edit few numbers?
Spawn Hybrid 10 Aug, 2017 @ 6:19am 
Thanks!
NSKuber  [author] 10 Aug, 2017 @ 5:53am 
Check noam's guide on how to make weapons. I recommend getting some SED experience before trying to utilize things like this mod.
Spawn Hybrid 10 Aug, 2017 @ 5:12am 
Okay but what do i do to edit the weapons, is there a file i need to edit, if so where is it?
NSKuber  [author] 9 Aug, 2017 @ 9:28pm 
Why do you want to access the scripts? I don't understand your problem.
Spawn Hybrid 9 Aug, 2017 @ 9:26pm 
Okay but how do i access the scripts?