Jump to content

Need help with this script


Falcedon

Recommended Posts

I'm trying to add this script to a wrench activator and no matter what i've tried the script won't compile. Can you see anything wrong with it?

 

scn SHWrenchCreateScript
short Button
begin OnActivate
if IsActionRef player
ShowMessage SHWrenchMessage
endif
end
BEGIN MenuMode 1001
set Button to GetButtonPressed
if ( Button == 0 )
player.GetItemCount PHAssaultCarbineBody == 1
player.GetItemCount PHAssaultCarbineClip == 1
player.GetItemCount PHAssaultCarbineSilencer == 1
player.AddItem WeapSHAssaultCarbine 1
SetDestroyed 1
endif

END

Link to comment
Share on other sites

The part inside "if ( Button == 0 )" and its "endif" makes no sense programmatically and syntactically.

You're using "get" functions and a comparison inside a condition but without an "if".

 

What are those lines meant to do anyways?

"player.GetItemCount" returns the count. It cannot be used to "set" it.

And what purpose do you compare the result with "1" for? What should it do when it is "1"?

 

Or is it intended to only "AddItem" the "WeapSHAssaultCarbine" to the player, "if" all 3 "GetItemCount" return "1"?

Then you need to at least put them inside an "if" condition and the "AddItem" inside the result block.

 

Like so:

 

if (player.GetItemCount PHAssaultCarbineBody == 1) && (player.GetItemCount PHAssaultCarbineClip == 1) && (player.GetItemCount PHAssaultCarbineSilencer == 1)
    player.AddItem WeapSHAssaultCarbine 1
endif
Link to comment
Share on other sites

  • Recently Browsing   0 members

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