Jump to content

Weapon Scripting Help!


ashjay101

Recommended Posts

Hey all, am working on a mod and am at a bit of a block

 

Im working on a weapon, I want something to happen when its in the players inventory/being used by the player but something different to happen when its in any other npcs inventory/being used by an NPC (dont think OnAdd would work) any suggestions?

 

Ideally Id want something like:

 

Begin Gamemode

If (Is being used by player, this is the command im looking for) set PlayerUse to 1

else

Set PlayerUse to 0

Endif

End

 

Begin OnFire

If PlayerUse == 1

stuff

Else

more stuff

endif

end

Link to comment
Share on other sites

The solution that comes to my mind would be to have a Player Only and a Non-Playable version of the weapon, each individually scripted with the appropriate effect.

 

Have an Onadd block on the the Player Only version that gives NPCs the Non-Playable version when it's added to their inventory.

 

This illusion is breakable unless you flag the NPC version as undroppable, but I think that's a small price for simplicities sake. (I think Unplayable makes it undroppable anyway.)

I'm not sure about a clean way to remove the non-playable version when taking the Player version to fully sell the illusion, but I'm sure there's an answer.

Edited by Radioactivelad
Link to comment
Share on other sites

  On 7/10/2022 at 2:43 PM, ashjay101 said:

Hey all, am working on a mod and am at a bit of a block

 

Im working on a weapon, I want something to happen when its in the players inventory/being used by the player but something different to happen when its in any other npcs inventory/being used by an NPC (dont think OnAdd would work) any suggestions?

 

Ideally Id want something like:

 

Begin Gamemode

If (Is being used by player, this is the command im looking for) set PlayerUse to 1

else

Set PlayerUse to 0

Endif

End

 

Begin OnFire

If PlayerUse == 1

stuff

Else

more stuff

endif

end

It seems you understand the basics ,,, but yet you dont use it . err I guess dont explain a purpose .

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...