I hope this is the right subforum to post this...
Is there any way to limit a vehicle's weapon firing ability to an arc in front of the vehicle (i.e. 45')? Some weapons just shouldn't be able to fire in a 360' arc.
Weapon firing arcs
Re: Weapon firing arcs
No.
Not unless you're willing to reimplement firing logic in lua, which would be rather ineffective approach to fast weapons like machinegun or flamethrower.
Not unless you're willing to reimplement firing logic in lua, which would be rather ineffective approach to fast weapons like machinegun or flamethrower.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.
Re: Weapon firing arcs
Is there any way to prevent the player from firing the weapon, then?
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: Weapon firing arcs
When player enters vehicle, you could move any weapons the player has in their inventory to the vehicle inventory, then move the weapon back to player when player exits the vehicle. If you need sample code to see how to access stuff in inventory, check out this mod which should have plenty of examples in its code.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Re: Weapon firing arcs
That's not quite what I mean; I am talking about preventing the player from firing the weapons of the vehicle they are in. With a little bit of trig, I am sure I could mock up a firing arc restriction.
Re: Weapon firing arcs
If your vehicle will use some special ammo that cannot be fired by nothing else that shouldn't have ark limitation, then
Make a vehicle gun use a special ammo, which effect consists solely in creation of shortlived dummy entity (like explosion type) and use on_trigger_created_entity event, to detect the act of shooting.
Then see if player is in vehicle and if vehicle orientation is right then create real projectile.
You can have the weapon create dummy entities both in source and destination position, and the corresponding on_trigger_created_entity events will be always risen in a particular order one right after another. This way you can detect which of several players fired a gun in multiplayer.
Something similar was working in my mod but it was lost to a disk cleanup gone wrong, thus I cannot provide the examples.
Make a vehicle gun use a special ammo, which effect consists solely in creation of shortlived dummy entity (like explosion type) and use on_trigger_created_entity event, to detect the act of shooting.
Then see if player is in vehicle and if vehicle orientation is right then create real projectile.
You can have the weapon create dummy entities both in source and destination position, and the corresponding on_trigger_created_entity events will be always risen in a particular order one right after another. This way you can detect which of several players fired a gun in multiplayer.
Something similar was working in my mod but it was lost to a disk cleanup gone wrong, thus I cannot provide the examples.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
I also update mods, some of them even work.
Recently I did a mod tutorial.