Jump to content

How to make a weapon rack like in UH?


psrfreddyz06

Recommended Posts

I managed to get this work!!!!

 

Here is the script:

ScriptName EHRevScript

begin onactivate player

Short inventory
Short onstand


Set inventory to player.getitemcount Weap32CaliberPistol
Set onstand to EHmagREF1.getdisabled

	If onstand == 1
		If inventory >= 1

			Player.removeitem Weap32CaliberPistol 1 1
			EHmagREF1.enable 0
		Endif
Endif

	If onstand == 0
		EHmagREF1.disable
		Player.AddItem Weap32CaliberPistol 1
	EndIf
End

It works perfectly fine.. Can you see any errors/something that i can change?

 

P.S i do NOT take credit for this, 99% is copied from the UH mod. Next step is to understand everything haha

 

Ya the thing to note about yours ... is that your weapon display will also repair the weapon to 100% as a by product.

Simply because the player is not getting back their instance of the weapon ... but a brand new one.

 

In that instance of UndergroundHideout ... they are storing the weapon health as a variable ... then destroying it.

But then modifying the new weapon with that variable when the player gets it back.

Link to comment
Share on other sites

And if you need to keep the weapon condition on a bunch of weapons ... instead of making a weapon condition variable for each one ...

You just move the weapon to a container. let the built in scripting do it for you.

Edited by Mktavish
Link to comment
Share on other sites

And if you need to keep the weapon condition on a bunch of weapons ... instead of making a weapon condition variable for each one ...

You just move the weapon to a container. let the built in scripting do it for you.

I don't really care about the weapon health, so this works fine for me. Thanks for all of your help!! :)

Link to comment
Share on other sites

  • 2 weeks later...

I have a small problem once again, I'm testing around a bit. Here is my script:

ScriptName EHKnifeScript

begin onactivate player

Short inventory
Short onstand

If GetIsid 0EHKnife

Set inventory to player.getitemcount WeapKABARMMP
Set onstand to KnifeREF.getdisabled

	If onstand == 1
		If inventory >= 1

			Player.removeitem WeapKABARMMP 1 1
              Player.removeitem WeapTKABARMMP 20 1

			KnifeREF.enable 1
		Endif
Endif

	If onstand == 0
		KnifeREF.disable
		Player.AddItem WeapKABARMMP 1
          Player.AddItem WeapTKABARMMP 20
		  
elseIf GetIsid 0EHGrifle

showmessage TrapGrenadeHarvest

else
endif

  EndIf
EndIf
End

But when i press the "0EHGrifle" activator ingame. No message comes up.. What have i done wrong? :o Everything before the "elseIf GetIsid 0EHGrifle" is working fine.. Cheers!

 

EDIT: Solved it.. I had one of the "Endif" in the wrong place!

Edited by psrfreddyz06
Link to comment
Share on other sites

  • Recently Browsing   0 members

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