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

Ravey

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Ravey's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. (Edited.) Hello there. I made a simple system to automatically regenerate vitals after logging in in a specific time interval, althrough, you can easily make it regenerate what you want with just a few additional lines. It's entirely server-based. Add this in **PlayerRec** in **modTypes**. LastLogin As Date Find **Sub JoinGame** Initialize new variables: ``` Dim LLD As Date Dim CSD As Date Dim Difference As Long ``` Then add this somewhere in the sub. ``` ' Log Login Date 'L.L.D. - Last Login Date LLD = Player(index).LastLogin 'C.S.D. - Current Server Date 'This gets the current time from the server-running computer. CSD = Now Difference = Datediff("s", LLD, CSD) 'If the date difference is > 4 in seconds, refill. If Difference > 4 Then Player(index).Vital(HP) = GetPlayerMaxVital(index, Vitals.HP) Player(index).Vital(MP) = GetPlayerMaxVital(index, Vitals.MP) Call SendVital(index, Vitals.HP) Call SendVital(index, Vitals.MP) Call PlayerMsg(index, "Your last login was " & Difference & " seconds ago. Vitals refilled.", Pink) End If '...And set the CSD login to the file for next use. Player(index).LastLogin = CSD ``` Put this in **Sub AddChar**. ``` 'Set a LLD to begin with. (used for regenerating) Player(index).LastLogin = Now ``` To customize the interval, change the Datediff function. Datediff(interval, Date1, Date2) If you want it to count minutes, use "n", if hours, use "h", and so on. You can see the full list on the internet. Then change the **If Difference > 4** to what you want. Regards, Ravey.
  2. @Sherwin: > I mean it Said End If without Block If , When End If is still there , But when i remove it no error shown.. Ahh, sorry. The one i use has additional functions, i forgot to remove the End If for the tutorial. Then yes, it shouldn't be there. Sorry for the dismay. Regards, Ravey.
  3. That means it is needed there, so put it back. Regards, Ravey.
  4. @Sherwin: > Item Number 3? what if i want the result will be a flame sword on item number 20? To make it very simple… ITEM EDITOR 1.Gold 2.Hatchet 3.Wood Log ... ... ... ... ... 27\. Iron Sword 28\. Essence of Fire ... ... ... ... 45\. Flame Sword First, **In Select Case CraftSlot1** Case 27 = 1
  5. No, the result will be Item # 3 as chosen in the Item Editor.
  6. Alright, look at this You need to define the Primary item for the recipe. Select Case CraftSlot1 Select Case CraftAmnt1 Cases of CraftSlot1 mean the NUMBER od the ITEM in your first slot Case 0 = No item Case 1 = Item # 1 Case 2 = Item # 2 Case 3 = Item # 3 Case 234 = Item # 234 Case Else = Any other item that has no primary crafting usage Then, you create subchecks after checking the item, you check it's amount. Sorry, I can't help more than this. Just read it carefully in the source code, too see how it works.
  7. I added descriptions. ``` Case 1 ' Check if we have item 1 in slot 1 Select Case CraftAmnt1 Case Is >= 5 ' Check if we have a stack of 5 or more of item 1 Select Case CraftSlot2 Case 2 ' Continue, Check if we have item 2 in slot 2 (Case = Item number, CraftSlot2 = slot) Select Case CraftAmnt2 Case Is >= 1 ' Check if we have 1 amount of item 2. Call CraftProcess(index, 3, 5, 1, 0) ' Process the craft, give item 3, take away 5 items from slot 2, take away 1 item from slot 2 Case Else Call CraftFail(index) End Select Case Else Call CraftFail(index) End Select Case Else Call CraftFail(index) End Select ``` You need to know how Case Selects work. It's not that hard, just needs logic. Regards, Ravey
  8. Put a primary item in the first slot in your bank, Put another item in the second slot, and more you might specify in the craft script Click the button. I left a default item there, You make it by putting 5 items of number 1 and 1 item of number 2, it puts item number 3 in your inventory. Regards, Ravey.
  9. Hello, I made a simple crafting system which uses the Bank. Why the bank? because a Bank can store stacks of any item, not just currencies, useful when combining non-stacks of the same type. Therefore, if you are interested, and haven't fixed your bank currency withdrawal bug yet, reffer to: [http://www.touchofdeathforums.com/smf2/index.php/topic,81828.0.html](http://www.touchofdeathforums.com/smf2/index.php/topic,81828.0.html) It uses bank slot checks to give items, the downside? It requires manual scripting for the whole thing. On the other side, you can make anything to happen once you have enough items in the slots, not only make an item. Client frmMain - Find picBank and make a Command Button called "cmdCraft" in it, or anything else you want to click at. - Double click "cmdCraft" - Put this in: ``` Private Sub cmdCraft_Click() ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler CraftItem ' Error handler Exit Sub errorhandler: HandleError "cmdCraft_Click", "frmMain", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit Sub End Sub ``` modClientTCP Place this to the bottom: ``` Public Sub CraftItem() Dim Buffer As clsBuffer ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Set Buffer = New clsBuffer Buffer.WriteLong CCraftItem SendData Buffer.ToArray() Set Buffer = Nothing ' Error handler Exit Sub errorhandler: HandleError "CraftItem", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit Sub End Sub ``` modEnumerations **Do this both in Client and Server!** Find 'Packets sent by client to server Put **CCraftItem** to the list. Server modHandleData Put this in the same order as the enumerations packets (not sure if it's neccesary) ``` HandleDataSub(CCraftItem) = GetAddress(AddressOf HandleCraftItem) ``` Now, add this there, too: ``` Sub HandleCraftItem(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Call CraftScript(index) End Sub ``` Crafting Script Make a new module or put this in modCustomScripts. ``` '################### '### CRAFTING ##### '################### Public Sub CraftFail(index) PlayerMsg index, "Didn't make anything!", BrightRed End Sub Public Sub CraftScript(index As Long) Dim CraftSlot1 As Long Dim CraftSlot2 As Long Dim CraftSlot3 As Long Dim CraftAmnt1 As Long Dim CraftAmnt2 As Long Dim CraftAmnt3 As Long ' item index number CraftSlot1 = GetPlayerBankItemNum(index, 1) CraftSlot2 = GetPlayerBankItemNum(index, 2) CraftSlot3 = GetPlayerBankItemNum(index, 3) ' amount of items CraftAmnt1 = GetPlayerBankItemValue(index, 1) CraftAmnt2 = GetPlayerBankItemValue(index, 2) CraftAmnt3 = GetPlayerBankItemValue(index, 3) Select Case CraftSlot1 Case 0 'USAGE-NONE PlayerMsg index, "You don't have a primary item in the first slot.", BrightRed Case 1 'USAGE-ITEM1 Select Case CraftAmnt1 Case Is >= 5 Select Case CraftSlot2 Case 2 Select Case CraftAmnt2 Case Is >= 1 Call CraftProcess(index, 3, 5, 1, 0) Case Else Call CraftFail(index) End Select Case Else Call CraftFail(index) End Select Case Else Call CraftFail(index) End Select Case Else PlayerMsg index, "This item has no primary crafting usage.", BrightCyan End Select End Sub Public Sub CraftProcess(index As Long, CraftResult As Long, BnkChangeSlotAmnt1 As Long, BnkChangeSlotAmnt2 As Long, BnkChangeSlotAmnt3 As Long) If FindOpenInvSlot(index, CraftResult) = 0 Then PlayerMsg index, "Inventory full!", Red Exit Sub End If SetPlayerBankItemValue index, 1, (GetPlayerBankItemValue(index, 1) - BnkChangeSlotAmnt1) SetPlayerBankItemValue index, 2, (GetPlayerBankItemValue(index, 2) - BnkChangeSlotAmnt2) SetPlayerBankItemValue index, 3, (GetPlayerBankItemValue(index, 3) - BnkChangeSlotAmnt3) 'check if the slots are at 0 amount, if that's true, clear the items from the slots completely. If GetPlayerBankItemValue(index, 1) = 0 Then SetPlayerBankItemNum index, 1, 0 If GetPlayerBankItemValue(index, 2) = 0 Then SetPlayerBankItemNum index, 2, 0 If GetPlayerBankItemValue(index, 3) = 0 Then SetPlayerBankItemNum index, 3, 0 GiveInvItem index, CraftResult, 1, True SendBank index PlayerMsg index, "Item crafted successfully!", BrightGreen End Sub ``` The first cases mean the number of the item, as in it's item editor inventory item number. then, you check for amount of slot 1 by adding another case selection, then you add another case selection for slot 2, check item, then, another case selection for amount check. Call CraftProcess usage is: ``` Call CraftProcess(index, item number to give to the player, slot#1 substraction, slot#2 substraction, slot#3 substraction) ``` Make sure you try putting 5x Item#1 in the first bank slot and 1x Item#2 in the second bank slot, then click the button. And so on, good luck. Regards, Ravey
  10. Hello, I don't hang around here too often, and I probably won't for a long time, still. I don't know if there isn't a fix for this somewhere else, but I decided to figure it out myself and post it here. There is a bug in Eclipse Origins, and as I read here, even in Nightly releases. This bug prevents you from withdrawing currencies from banks in a normal way, while you input the amount of items you want to drop and then hit the button, it withdraws items from the bank based on your inventory amounts, NOT bank amounts. So, for example, if you have 0 Gold in inventory, the bank withdraws an useless "zero" piece of currency. If you have like 50 coins in the inventory, it withdraws 50 from the bank, conclusion is, it doesn't check for the bank amounts at all. Here's the fix (Client Side only): **modGameLogic** Find: ``` Public Function GetBankItemValue(ByVal bankslot As Long) As Long ``` Replace With: ``` Public Function GetBankItemValue(ByVal index As Long, ByVal bankslot As Long) As Long ``` * * * Add **above** GetBankItemValue = Bank.Item(bankslot).Value : ``` If index > MAX_PLAYERS Then Exit Function ``` * * * **modDirectDraw7** Find these two: ``` If GetBankItemValue(i) > 1 Then `````` Amount = CStr(GetBankItemValue(i)) ``` Add 0 for Index: ``` If GetBankItemValue(0, i) > 1 Then `````` Amount = CStr(GetBankItemValue(0, i)) ``` **frmMain (Code)** Find: ``` Private Sub lblCurrencyOk_Click() ``` Reffer to this: ``` If IsNumeric(txtCurrency.text) Then If Val(txtCurrency.text) > GetPlayerInvItemValue(MyIndex, tmpCurrencyItem) Then txtCurrency.text = GetPlayerInvItemValue(MyIndex, tmpCurrencyItem) ``` **Replace the 2 lines with this, instead:** Here, you make an exception that if we're withdrawing, we use currency menu 3, so we check for Bank amounts instead of Inventory amounts. ``` If IsNumeric(txtCurrency.text) Then If CurrencyMenu = 3 Then If Val(txtCurrency.text) > GetBankItemValue(MyIndex, tmpCurrencyItem) Then txtCurrency.text = GetBankItemValue(MyIndex, tmpCurrencyItem) ElseIf Val(txtCurrency.text) > GetPlayerInvItemValue(MyIndex, tmpCurrencyItem) Then txtCurrency.text = GetPlayerInvItemValue(MyIndex, tmpCurrencyItem) End If ``` And that's all. Regards, Ravey.
  11. Just a little question, wouldn't Sub UseItem do it when the item is used, eg. double clicked? My custom idea is that, it would add up to a new "secret" stat that would be invisible to the users, and would be accounted for in the calculations in modCombat… but a question is... is there a way to count all items of the said type (reffering about the new item type) in player's inventory and get them into one value(new stat)? then it would be something like... ``` Case MP Select Case GetPlayerClass(index) Case 1 GetPlayerMaxVital = (GetPlayerStat(index, Intelligence)) + (GetPlayerStat(index, Charges) * 3) ``` Thank you for the idea, it is a better way to do it. Hoping to figure it out with the help of you all, I'm willing to learn.
  12. Oh, my apologies for that. And i do know how to use that word, I even checked it in a dictionary, i do not think it's so bad to say. To make everyone sure, i will be very grateful, and i value your opinion about it… even though, as said above, you should not post here to criticise what i typed. Anyhow, peace.
  13. Hello, Okay so here comes an easy question, i want to add something to basic calculations, and that is where it would count with 'rare' items to add Max HP/MP Here is the line…. you know.. GetPlayerMaxVital = (GetPlayerStat(index, Intelligence)) - 1 So i want it to count the number of certain currency items and add it up to the value... so simply said if one had 10 Intelligence, 4 Batteries, 7 Soul Stones and 2 Sparks, minus 1... that player would have 22 maximum MP.... i want to add them some individual multiply values as well, but i only demand to know the way how it can be done to check for the items. I want only(?) 8 rare items to work with this, would it cause the game to be slow? Thanks in advance.
  14. Since i got a copy of VB6, i did some changes to the source, but. instead of looking all through the stuff i want to ask in what do i edit these two …. * First of, i want to know where to edit font size and position of the number of stackable items you have in an inventory slot, when you have like 30 items, it draws 30 on down left, i want to edit the size and position * Secondly, where do i edit the time it takes before a character starts regenerating HP/MP after damage is done? Thanks in advance.
  15. Right, so the spell is literally a Battle Heal/Regeneration, i see… Anything is fine! Since i downloaded EO, i didn't try so much things, i am mainly drawing my custom graphics, So.... i have no idea what Willpower is for...
×
×
  • Create New...