Jump to content

Counting Items, storing value and removing items


Recommended Posts

Just taking a quick break from other scripting adventure, some of you huys know what I mean and wrote this script which to me seems like it should work but... it doesn't.

Scenario: Based upon a post I made about player should not be able to equip a torch, go into water and maigically it is still alight when player leaves water - I hit upon this idea. When player is completely submerged in water i.e. swimming, any torches that he is carrying and has equipped should be ruined and removed from inventory. Scripts compiles and works but no torches are removed from inventory, also need a way to remove an equipped torch if player is holding one.

 

 

Actor Property PlayerREF Auto
GlobalVariable Property MyCount Auto
Int Property TCount Auto
Light Property Torches Auto
Message Property FirstTime Auto
Message Property Discard Auto
Sound Property MySND Auto

EVENT onTriggerEnter(ObjectReference akActionRef)
if akActionRef == PlayerRef
TCount == PlayerRef.GetItemCount(Torches)
Game.GetPlayer().RemoveItem(Torches, TCount)
If MyCount.GetValue() == 0
FirstTime.Show()
EndIf
If MyCount.GetValue() > 0
Discard.Show()
EndIf
MyCount.SetValue(1)

EndIf
EndEvent

 

Link to comment
Share on other sites

You have two equal signs between TCount and the GetItemCount function call. Two equal signs indicate a comparison between each side. While a single equal sign indicates taking the value on the right and shoving it into the variable on the left. Surprised it compiled without complaint.

 

And if that is just a typo from posting on the forum, make sure that all your properties are properly filled.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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