Jump to content

Player.getitemcount script bugging around


3170728

Recommended Posts

So I made a Generator, which should be refueled by Turppentine. Here is my script :

 

 

scn GeneratorFuel

 

 

int iButton

 

 

Begin OnActivate

 

 

 

ShowMessage 00Generator

 

 

End

 

Begin GameMode

 

set iButton to GetButtonPressed

 

 

if iButton == -1 ; No button has been pressed yet

Return

elseif iButton == 0 ; Option 0

if player.GetItemCount Turpentine >= 3

player.removeitem Turpentine 3

 

else showmessage 0NotenoughTurpentine

endif

 

 

 

elseif iButton == 1 ; Close Message Window

RemoveMe

endif

 

 

End

 

The Problem is, that Fallout Isn't Caring if I have turpentine in my Inventory or not. I Can activate the Generator with and without the turpentine. When I have 3 Turpentine in my inventory, it gets removed by the script. What am I Doing wrong ?

Link to comment
Share on other sites

I think else should be on its own line for one, with the showmessage function below it. And what's the removeme bit? That only works on inventory items, not activators.

 

What happens if it is activated, is there some animation? Since there is no activate function anywhere in the script I don't see how it is getting activated.

Link to comment
Share on other sites

if (player.GetItemCount Turpentine >= 3)

player.removeitem Turpentine 3

else

showmessage 0NotenoughTurpentine

endif

 

Would be my recommendation. Geck can be.. strange. Its best to stick very close to explicit syntax as you can.

 

Also, Don't use 'removeme', Just don't do anything if its == 1.

(You could also 'return' if there was code you wanted to skip)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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