Rathalos888 Posted August 15, 2008 Author Share Posted August 15, 2008 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 ScriptCase 0*insert beer script here, don't want the maker to be mad it's in here*Case Else'No script foundCall playermsg(index, "No script found. Please contact an admin to solve this problem.", 15)Exit SubEnd SelectCase 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 IfEnd 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 More sharing options...
Warconn Posted August 15, 2008 Share Posted August 15, 2008 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 SelectEnd Sub```All i did was rearrange your code, and add the take_item so that the potion will disappear after they drink itWarconn[EDIT]I was looking around my main, and found thisCall 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 3This 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 slotDim takenDim initialDim finalslot=1taken=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 LoopEnd Sub```Correct me if i am wrong about this stuff guys :)Thanks Link to comment Share on other sites More sharing options...
balliztik1 Posted August 15, 2008 Share Posted August 15, 2008 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 More sharing options...
Rathalos888 Posted August 15, 2008 Author Share Posted August 15, 2008 Yeah, as I said, All I actually did is copy and paste a section of the beer script and just tweak it a little =P.I'm actually about to just request a +10 HP, +25 HP, +175HP, and +10MP scripts, but I don't know how to add cases >_<. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now