Im working on some scripts for a modified version of Factorio to use in schools and holiday programs. The next step is to be able to define zones in the control.lua for a scenario in which the players are not allowed to fire weapons, activate capsules/grenades, or drive vehicles.
Stopping players from driving inside an area is trivial using the teleport function but the weapon removal/disable is a bit trickier.
My first ideas were:
When players enter these zones strip them of the items and then return them upon leaving the area
or
Remove the equipped slots from players inside the areas
or
replace weapons with "dummy versions when entering zones, and replace them again when leaving zones
Is there a way to intercept the fire keypress or capsule deployment?
How can I store confiscated items that persists across loads/server restarts?
Can anyone think of a better way to do this?
Limiting Weapon use in zone
Re: Limiting Weapon use in zone
If you can't disable the use you can confiscate items and store them in a global table example
D = 2
Does not persist, but
Global.D = 2
Will
!
Defining the zones could probably be done by checking for an item with no texture or collision.
D = 2
Does not persist, but
Global.D = 2
Will

Defining the zones could probably be done by checking for an item with no texture or collision.
Logo
Noticed the told change in FFF #111 so il continue to use my signature ^_^Thanks for listening to our suggestions, devs

I would jump of joy if we could specify which tiles spawned in a surfaces
Re: Limiting Weapon use in zone
Ive got the zones working well so far.
So anything added to the Global object will be stored on save and retrieved on load?
So anything added to the Global object will be stored on save and retrieved on load?
Re: Limiting Weapon use in zone
Yesabregado wrote:Ive got the zones working well so far.
So anything added to the Global object will be stored on save and retrieved on load?

Trye this:
Code: Select all
if (global.dd == null) then
global.dd = 1
end
Then in the on load function
global.dd += 10
THen in the on_tick
game.players[0].print(global.dd)
PS if you arent already aware of it if you only change the script you will only need to reload the save, not the whole game

Logo
Noticed the told change in FFF #111 so il continue to use my signature ^_^Thanks for listening to our suggestions, devs

I would jump of joy if we could specify which tiles spawned in a surfaces