Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Uhh, would this work?


Rathalos888
 Share

Recommended Posts

After discovering that EE 1.0's potions are bugged and can't be sold, I've decided to try to script a potion. After already having a beer script, I just copied the health up in the script and pasted it… But my guess (I can't script) is that this won't work.

Here is how my scripted Items section looks:

' This sub is run when a scripted item is used or double clicked.
Sub ScriptedItem(index, Script)                                 
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Select Case Script

Case 0
*insert beer script here, don't want the maker to be mad it's in here*
Case Else
'No script found
Call playermsg(index, "No script found. Please contact an admin to solve this problem.", 15)
Exit Sub

End Select

Case 1
    Call SetPlayerHP(index, int(GetPlayerHP(index)+int(int(GetPlayerMaxHP(index)/100)*10)))
    Call PlayerMsg(index, "You drink the potion and feel a bit better!", 7)
End If

End Sub

(Case 1's is my lil' potion script)

What it's supposed to do, is have the player drink the potion, heal 10 hp, and then the potion dissapear. i was wondering if this is placed correctly/ what's wrong with it?

Thanks in advance.
Link to comment
Share on other sites

hmm im still a novice at this stuff, but i think you have the wrong format…

i think this is what you want
```
Sub ScriptedItem(Index, Script)
Select Case Script
Case 0
*insert beer script here, don't want the maker to be mad it's in here*
Exit Sub
                Case 1
                Call SetPlayerHP(index, int(GetPlayerHP(index)+int(int(GetPlayerMaxHP(index)/100)*10)))
    Call PlayerMsg(index, "You drink the potion and feel a bit better!", 7)
Call Take_Item(index, number, value)
                Exit Sub
Case Else
Call PlayerMsg(Index, "No item script found. Please contact an admin to solve this problem.", WHITE)
Exit Sub
End Select
End Sub

```
All i did was rearrange your code, and add the take_item so that the potion will disappear after they drink it
Warconn

[EDIT]
I was looking around my main, and found this

Call Take_Item(index, number, value)

The number is the item number you want to take so if the potion item is number 3  then the number would be 3

This is the amount you want taken, so if you want to take 2 potions when they drink it, the value would be 2

**If you dont have the take_item sub in your main at all, add this at the end of your main

```
'********************************
Sub Take_Item(index, number, value)
'********************************

Dim slot
Dim taken
Dim initial
Dim final

slot=1
taken=0
  Do While Int(slot) < 25     
      If Int(taken)=0 Then     
        If GetPlayerInvItemNum(index,Int(slot)) = Int(number) Then
            If Int(GetPlayerInvItemValue(index, Int(slot))) >= Int(value) Then
            initial = Int(GetPlayerInvItemValue(index, Int(slot) ) )
            final = Int(initial) - Int(value)           
              If Int(final) <= 0 Then             
              Call SetPlayerInvItemNum(index, Int(slot), Int(0) )
              Call SetPlayerInvItemValue(index, Int(slot), Int(0) )
              Call SetPlayerInvItemDur(index, Int(slot), Int(0) )
              Call SendInventoryUpdate(index, Int(slot))
              taken=1             
              Else           
              Call SetPlayerInvItemValue(index, Int(slot), Int(final) )
              Call SendInventoryUpdate(index, Int(slot) )
              taken=1           
              End If
            End If       
        End If
      End If     
  slot = slot + 1
  Loop
End Sub

```
Correct me if i am wrong about this stuff guys  :)

Thanks
Link to comment
Share on other sites

You have the "End Select" in the wrong spot. It goes after the last Case, which would be right above the "End Sub", in this instance.

Other than that, it looks like it will work, but that's highly unnecessary. All the Int() functions aren't needed. You'd only need one around the Max hp divided by 100\. And you say you just want to add 10 hp? That'd just be GetPlayerHP(index) + 10\. No need to be elaborate.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...