Author Topic: Health Script  (Read 2649 times)

Dr Obvious

  • Regular
  • **
  • Posts: 53
    • View Profile
    • http://www.drobvious.net
Health Script
« on: 2005-09-11, 12:40:42 AM »
Alright, so I have a script that's calling special functions and the special function is being called just fine (I think), but it's not reading my inventory right.  My health is initially set to 100, but no matter what, it always thinks my health is at 0.   Anyone know hy it's doing this?

Code: [Select]

if func.Name = "H- Check" Then
With ProjectObj.gamePlayer
'>= 80% health
If .InvQuantityOwned(4) > 79 Then
.ActivateFunction .rmap.Specials("H- f80")
'>= 60% health
ElseIf .InvQuantityOwned(4) > 59 Then
.ActivateFunction .rmap.Specials("H- f60")
'>= 40% health
ElseIf .InvQuantityOwned(4) > 39 Then
.ActivateFunction .rmap.Specials("H- f40")
'> 0% health
ElseIf .InvQuantityOwned(4) > 19 Then
.ActivateFunction .rmap.Specials("H- f20")
'Dead
ElseIf .InvQuantityOwned(4) = 0 Then
.ActivateFunction .rmap.Specials("H- f0")
End If
End with
End If


My health inventory item is index 4 and I have it displayed in text on my screen and it does say 100.

-edit-
I've tried setting my health inventory item to various value and it always wants to go to 0 on the if thens.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Health Script
« Reply #1 on: 2005-09-11, 06:59:06 AM »
Take a look at the code in the sticky post "Tip: Debugging Script" in this forum.  Add some log messages to that block of code to see what the actual value of your inventory is before and after the If/End If.  See if you can catch the inventory at a non-zero value ever; try other inventory items to see if they have non-zero values.