Opinions on restoring an older Breaching Door Swep?

I’m editing an old door breaching swep.

The script can only have 1 target each shot, so the other shot doors get overridden and won’t respawn.

I’m thinking of a way to solve this with tables, but is there a better way or any advice?

You could restore the door using a timer.Simple ( or timer.Create with a unique name ) and not have to worry about storing the data and it getting lost. Now, timers have been having issues lately where a timer.Simple isn’t being created sometimes, or is being created but won’t execute so I believe there is an issue with the timer system… You may be better off using a table and table.Insert with all of the relevant information. Create a hook that runs through those results, or checks them once per x seconds. Remove the hook after the last object removed from table, and start it when the first one is inserted.

The addon works great now but I’m having trouble getting tables to work in this Swep.

If I create a table in the Initialize function will it become global? Can I make a local table for this instance of a Swep, or would I have to use something like self:NWString()? I haven’t used that function yet.

If you want the table to be local to the swep itself ( the spawned entity ) then self.xxxx = { }; will work for that ( do it serverside only since the client won’t need to know about it, or if the clients needs to be notified it can happen when the hook does the action )