Just want to demonstrate how we use the command. Reminder since I am in v1.17 and still have my condition as "currentweapon=x", my results may differ from newer versions. I also have the "internal" flashlight feature.
We have three triggers placed, each with a script that controls a torch, blue glowstick, and a green glowstick. As the player collects each item, I can switch and the light changes according to what "currentweapon" is being called. The scripts also check to ensure that weapon is in my inventory before continuing.
Here is an example video concept we had started a while back to show it in action.
The scripts I used to make this work effectively are as follows:
torch script (attached to a trigger on the map)
;Artificial Intelligence Script
;Header
desc = Torch
;Triggers
:state=0:state=1
:state=1,weapininv=foxweapons\rtorch:state=2
:state=2,currentweapon=1:etimerstart,state=3
:state=2,scancodekeypressed=11:state=100
:State=3:flashlightrange=600
:State=3:flashlightred=255
:State=3:flashlightgreen=165
:State=3:flashlightblue=0
:state=3:state=5
:state=5,etimergreater=1000:flashlighton,etimerstart,state=6
:state=6,etimergreater=10000:flashlightrange=500
:state=6,etimergreater=20000:flashlightrange=400
:state=6,etimergreater=30000:flashlightrange=300
:state=6,etimergreater=40000:flashlightrange=200
:state=6,etimergreater=50000:flashlightrange=100
:state=6,etimergreater=60000:state=10
:state=6,scancodekeypressed=11:state=100
:state=10:fpgcrawtextsize=20,fpgcrawtextfont=Verdana,fpgcrawtextr=255,fpgcrawtextg=255,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=50
:state=10:flashlightoff,etimerstart,state=11
:state=11:fpgcrawtext=Press <ENTER> to relight torch.
:state=11,etimergreater=500,scancodekeypressed=28:state=12
:state=12:fpgcrawtextoff
:state=12:etimerstart,state=13
:state=13,etimergreater=500:state=0
:state=100:flashlightoff,etimerstart,state=101
:state=101,etimergreater=1000:state=0
;End of Script
glowstick (blue) script (attached to a trigger on the map)
;Artificial Intelligence Script
;Header
desc = blue glowstick
;Triggers
:state=0:state=1
:state=1,weapininv=foxweapons\gsblue:state=2
:state=2,currentweapon=2:etimerstart,state=3
:state=2,scancodekeypressed=11:state=100
:State=3:flashlightrange=300
:State=3:flashlightred=70
:State=3:flashlightgreen=130
:State=3:flashlightblue=180
:state=3:state=5
:state=5,etimergreater=1000:sound=audiobank\Foxaudio\glowsticksnap.wav,etimerstart,state=6
:state=6,etimergreater=500:flashlighton
;:state=6,etimergreater=20000:flashlightrange=400
;:state=6,etimergreater=30000:flashlightrange=300
;:state=6,etimergreater=40000:flashlightrange=200
;:state=6,etimergreater=50000:flashlightrange=100
;:state=6,etimergreater=60000:state=10
:state=6,scancodekeypressed=11:state=100
;:state=10:fpgcrawtextsize=20,fpgcrawtextfont=Verdana,fpgcrawtextr=255,fpgcrawtextg=255,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=50
;:state=10:flashlightoff,etimerstart,state=11
;:state=11:fpgcrawtext=Press <ENTER> to relight torch.
;:state=11,etimergreater=500,scancodekeypressed=28:state=12
;:state=12:fpgcrawtextoff
;:state=12:etimerstart,state=13
;:state=13,etimergreater=500:state=0
:state=100:flashlightoff,etimerstart,state=101
:state=101,etimergreater=1000:state=0
;End of Script
glowstick (green) script (attached to a trigger on the map)
;Artificial Intelligence Script
;Header
desc = green glowstick
;Triggers
:state=0:state=1
:state=1,weapininv=foxweapons\gsgreen:state=2
:state=2,currentweapon=3:etimerstart,state=3
:state=2,scancodekeypressed=11:state=100
:State=3:flashlightrange=300
:State=3:flashlightred=50
:State=3:flashlightgreen=205
:State=3:flashlightblue=50
:state=3:state=5
:state=5,etimergreater=1000:sound=audiobank\Foxaudio\glowsticksnap.wav,etimerstart,state=6
:state=6,etimergreater=500:flashlighton
;:state=6,etimergreater=20000:flashlightrange=400
;:state=6,etimergreater=30000:flashlightrange=300
;:state=6,etimergreater=40000:flashlightrange=200
;:state=6,etimergreater=50000:flashlightrange=100
;:state=6,etimergreater=60000:state=10
:state=6,scancodekeypressed=11:state=100
;:state=10:fpgcrawtextsize=20,fpgcrawtextfont=Verdana,fpgcrawtextr=255,fpgcrawtextg=255,fpgcrawtextb=255,fpgcrawtextx=50,fpgcrawtexty=50
;:state=10:flashlightoff,etimerstart,state=11
;:state=11:fpgcrawtext=Press <ENTER> to relight torch.
;:state=11,etimergreater=500,scancodekeypressed=28:state=12
;:state=12:fpgcrawtextoff
;:state=12:etimerstart,state=13
;:state=13,etimergreater=500:state=0
:state=100:flashlightoff,etimerstart,state=101
:state=101,etimergreater=1000:state=0
;End of Script
So the torch is the "currentweapon=1", the blue glowstick is "currentweapon=2", and the green glowstick is "currentweapon=3". The key is making sure that the weapons go in the correct slot. If the torch script ends up in slot 3, then obviously my torch will not work. Even though my command does not have the "plr" in front, the command is still the same and works the same as the "plrcurrentweapon".
There's no problem that can't be solved without applying a little scripting.