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

Kimimaru

Members
  • Posts

    890
  • Joined

  • Last visited

    Never

Everything posted by Kimimaru

  1. Kimimaru

    Adding items?

    Simply open up the files in Paint or something and replace the existing tiles and item sprites with your own.
  2. You should put your code in **Function CanMove** on the Client side.
  3. @kornusdj: > Zesh, This doesn't work > If I add : > Dim index as Long, show an RTE 9 > Byval index as Long, show an RTE 13 > > This is my Sub AttackNpc, if I add my code. > > ``` > Sub AttackNpc(ByVal Attacker As Long, _ > ByVal MapNpcNum As Long, _ > ByVal damage As Long) > Dim Name As String > Dim Exp As Long > Dim N As Long, I As Long, x As Long, o As Long > Dim MapNum As Long, NpcNum As Long > > ' Check for subscript out of range > If IsPlaying(Attacker) = False Or MapNpcNum MAX_MAP_NPCS Or damage < 0 Then > Exit Sub > End If > > ' Check for weapon > If GetPlayerWeaponSlot(Attacker) > 0 Then > N = GetPlayerInvItemNum(Attacker, GetPlayerWeaponSlot(Attacker)) > Else > N = 0 > End If > > ' Send this packet so they can see the person attacking > Call SendDataToMap(GetPlayerMap(Attacker), "ATTACKNPC" & SEP_CHAR & Attacker & SEP_CHAR & MapNpcNum & SEP_CHAR & END_CHAR) > MapNum = GetPlayerMap(Attacker) > NpcNum = MapNpc(MapNum, MapNpcNum).num > Name = Trim$(Npc(NpcNum).Name) > MapNpc(MapNum, MapNpcNum).LastAttack = GetTickCount > > If damage >= MapNpc(MapNum, MapNpcNum).HP Then > > ' Check for a weapon and say damage > Call BattleMsg(Attacker, "Zabiłeś/aś a " & Name, BrightRed, 0) > Dim add As String > > add = 0 > > If GetPlayerWeaponSlot(Attacker) > 0 Then > add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerWeaponSlot(Attacker))).AddEXP > End If > > If GetPlayerArmorSlot(Attacker) > 0 Then > add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerArmorSlot(Attacker))).AddEXP > End If > > If GetPlayerShieldSlot(Attacker) > 0 Then > add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerShieldSlot(Attacker))).AddEXP > End If > > If GetPlayerHelmetSlot(Attacker) > 0 Then > add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerHelmetSlot(Attacker))).AddEXP > End If > > If GetPlayerLegsSlot(Attacker) > 0 Then > add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerLegsSlot(Attacker))).AddEXP > End If > > If add > 0 Then > If add < 100 Then > If add < 10 Then > add = 0 & ".0" & Right$(add, 2) > Else > add = 0 & "." & Right$(add, 2) > End If > > Else > add = Mid$(add, 1, 1) & "." & Right$(add, 2) > End If > End If > > ' Calculate exp to give attacker > If add > 0 Then > Exp = Npc(NpcNum).Exp + (Npc(NpcNum).Exp * Val(add)) > Else > Exp = Npc(NpcNum).Exp > End If > > ' Make sure we dont get less then 0 > If Exp < 0 Then > Exp = 1 > End If > > If IS_PREMIUM = 1 Then > Call SetPlayerExp(index, GetPlayerExp(index) + Int(Exp * 2)) > Call BattleMsg(index, "Dostałeś/aś " & Int(Exp * 2) & " doświadczenia.", BrightBlue, 0) > Else > Call SetPlayerExp(index, GetPlayerExp(index) + Exp) > Call BattleMsg(index, "Dostałeś/aś " & Exp & " doświadczenia.", BrightBlue, 0) > End If > > For I = 1 To MAX_NPC_DROPS > > ' Drop the goods if they get it > N = Int(Rnd * Npc(NpcNum).ItemNPC(I).Chance) + 1 > > If N = 1 Then > Call SpawnItem(Npc(NpcNum).ItemNPC(I).ItemNum, Npc(NpcNum).ItemNPC(I).ItemValue, MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y) > End If > > Next > > ' Now set HP to 0 so we know to actually kill them in the server loop (this prevents subscript out of range) > MapNpc(MapNum, MapNpcNum).num = 0 > MapNpc(MapNum, MapNpcNum).SpawnWait = GetTickCount > MapNpc(MapNum, MapNpcNum).HP = 0 > Call SendDataToMap(MapNum, "NPCDEAD" & SEP_CHAR & MapNpcNum & SEP_CHAR & END_CHAR) > > ' Check for level up > Call CheckPlayerLevelUp(Attacker) > > ' Check for level up party member > If Player(Attacker).InParty = YES Then > > For x = 1 To MAX_PARTY_MEMBERS > > If Party(Player(Attacker).PartyID).Member(x) 0 Then > Call CheckPlayerLevelUp(Party(Player(Attacker).PartyID).Member(x)) > End If > > Next > > End If > > Call TakeFromGrid(MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y) > > ' Check if target is npc that died and if so set target to 0 > If Player(Attacker).TargetType = TARGET_TYPE_NPC And Player(Attacker).Target = MapNpcNum Then > Player(Attacker).Target = 0 > Player(Attacker).TargetType = 0 > End If > > Else > > ' NPC not dead, just do the damage > MapNpc(MapNum, MapNpcNum).HP = MapNpc(MapNum, MapNpcNum).HP - damage > > ' Check for a weapon and say damage > Call BattleMsg(Attacker, "Zadałeś/aś a " & Name & " " & damage & " obrażeń.", White, 0) > > If N = 0 Then > > 'Call PlayerMsg(Attacker, "Zadałeś/aś a " & Name & " for " & obrażeń & " hit points.", White) > Else > > 'Call PlayerMsg(Attacker, "Zadałeś/aś a " & Name & " with a " & Trim$(Item(n).Name) & " for " & obrażeń & " hit points.", White) > End If > > ' Check if we should send a message > If MapNpc(MapNum, MapNpcNum).Target = 0 And MapNpc(MapNum, MapNpcNum).Target Attacker Then > If Trim$(Npc(NpcNum).AttackSay) "" Then > Call PlayerMsg(Attacker, "A " & Trim$(Npc(NpcNum).Name) & " : " & Trim$(Npc(NpcNum).AttackSay) & "", SayColor) > End If > End If > > ' Set the NPC target to the player > MapNpc(MapNum, MapNpcNum).Target = Attacker > MapNpc(MapNum, MapNpcNum).TargetType = TARGET_TYPE_PLAYER > > ' Now check for guard ai and if so have all onmap guards come after'm > If Npc(MapNpc(MapNum, MapNpcNum).num).Behavior = NPC_BEHAVIOR_GUARD Then > > For I = 1 To MAX_MAP_NPCS > > If MapNpc(MapNum, I).num = MapNpc(MapNum, MapNpcNum).num Then > MapNpc(MapNum, I).Target = Attacker > MapNpc(MapNum, I).TargetType = TARGET_TYPE_PLAYER > End If > > Next > > End If > End If > > 'Call SendDataToMap(MapNum, "npchp" & SEP_CHAR & MapNpcNum & SEP_CHAR & MapNpc(MapNum, MapNpcNum).HP & SEP_CHAR & GetNpcMaxHP(MapNpc(MapNum, MapNpcNum).num) & SEP_CHAR & END_CHAR) > ' Reset attack timer > Player(Attacker).AttackTimer = GetTickCount > End Sub > ``` Change your Sub AttackNpc to this: ``` Sub AttackNpc(ByVal Attacker As Long, _ ByVal MapNpcNum As Long, _ ByVal damage As Long) Dim Name As String Dim Exp As Long Dim N As Long, I As Long, x As Long, o As Long Dim MapNum As Long, NpcNum As Long ' Check for subscript out of range If IsPlaying(Attacker) = False Or MapNpcNum MAX_MAP_NPCS Or damage < 0 Then Exit Sub End If ' Check for weapon If GetPlayerWeaponSlot(Attacker) > 0 Then N = GetPlayerInvItemNum(Attacker, GetPlayerWeaponSlot(Attacker)) Else N = 0 End If ' Send this packet so they can see the person attacking Call SendDataToMap(GetPlayerMap(Attacker), "ATTACKNPC" & SEP_CHAR & Attacker & SEP_CHAR & MapNpcNum & SEP_CHAR & END_CHAR) MapNum = GetPlayerMap(Attacker) NpcNum = MapNpc(MapNum, MapNpcNum).num Name = Trim$(Npc(NpcNum).Name) MapNpc(MapNum, MapNpcNum).LastAttack = GetTickCount If damage >= MapNpc(MapNum, MapNpcNum).HP Then ' Check for a weapon and say damage Call BattleMsg(Attacker, "Zabiłeś/aś a " & Name, BrightRed, 0) Dim add As String add = 0 If GetPlayerWeaponSlot(Attacker) > 0 Then add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerWeaponSlot(Attacker))).AddEXP End If If GetPlayerArmorSlot(Attacker) > 0 Then add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerArmorSlot(Attacker))).AddEXP End If If GetPlayerShieldSlot(Attacker) > 0 Then add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerShieldSlot(Attacker))).AddEXP End If If GetPlayerHelmetSlot(Attacker) > 0 Then add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerHelmetSlot(Attacker))).AddEXP End If If GetPlayerLegsSlot(Attacker) > 0 Then add = add + Item(GetPlayerInvItemNum(Attacker, GetPlayerLegsSlot(Attacker))).AddEXP End If If add > 0 Then If add < 100 Then If add < 10 Then add = 0 & ".0" & Right$(add, 2) Else add = 0 & "." & Right$(add, 2) End If Else add = Mid$(add, 1, 1) & "." & Right$(add, 2) End If End If ' Calculate exp to give attacker If add > 0 Then Exp = Npc(NpcNum).Exp + (Npc(NpcNum).Exp * Val(add)) Else Exp = Npc(NpcNum).Exp End If ' Make sure we dont get less then 0 If Exp < 0 Then Exp = 1 End If If IS_PREMIUM = 1 Then Call SetPlayerExp(Attacker, GetPlayerExp(Attacker) + Int(Exp * 2)) Call BattleMsg(Attacker, "Dostałeś/aś " & Int(Exp * 2) & " doświadczenia.", BrightBlue, 0) Else Call SetPlayerExp(Attacker, GetPlayerExp(Attacker) + Exp) Call BattleMsg(Attacker, "Dostałeś/aś " & Exp & " doświadczenia.", BrightBlue, 0) End If For I = 1 To MAX_NPC_DROPS ' Drop the goods if they get it N = Int(Rnd * Npc(NpcNum).ItemNPC(I).Chance) + 1 If N = 1 Then Call SpawnItem(Npc(NpcNum).ItemNPC(I).ItemNum, Npc(NpcNum).ItemNPC(I).ItemValue, MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y) End If Next ' Now set HP to 0 so we know to actually kill them in the server loop (this prevents subscript out of range) MapNpc(MapNum, MapNpcNum).num = 0 MapNpc(MapNum, MapNpcNum).SpawnWait = GetTickCount MapNpc(MapNum, MapNpcNum).HP = 0 Call SendDataToMap(MapNum, "NPCDEAD" & SEP_CHAR & MapNpcNum & SEP_CHAR & END_CHAR) ' Check for level up Call CheckPlayerLevelUp(Attacker) ' Check for level up party member If Player(Attacker).InParty = YES Then For x = 1 To MAX_PARTY_MEMBERS If Party(Player(Attacker).PartyID).Member(x) 0 Then Call CheckPlayerLevelUp(Party(Player(Attacker).PartyID).Member(x)) End If Next End If Call TakeFromGrid(MapNum, MapNpc(MapNum, MapNpcNum).x, MapNpc(MapNum, MapNpcNum).y) ' Check if target is npc that died and if so set target to 0 If Player(Attacker).TargetType = TARGET_TYPE_NPC And Player(Attacker).Target = MapNpcNum Then Player(Attacker).Target = 0 Player(Attacker).TargetType = 0 End If Else ' NPC not dead, just do the damage MapNpc(MapNum, MapNpcNum).HP = MapNpc(MapNum, MapNpcNum).HP - damage ' Check for a weapon and say damage Call BattleMsg(Attacker, "Zadałeś/aś a " & Name & " " & damage & " obrażeń.", White, 0) If N = 0 Then 'Call PlayerMsg(Attacker, "Zadałeś/aś a " & Name & " for " & obrażeń & " hit points.", White) Else 'Call PlayerMsg(Attacker, "Zadałeś/aś a " & Name & " with a " & Trim$(Item(n).Name) & " for " & obrażeń & " hit points.", White) End If ' Check if we should send a message If MapNpc(MapNum, MapNpcNum).Target = 0 And MapNpc(MapNum, MapNpcNum).Target Attacker Then If Trim$(Npc(NpcNum).AttackSay) "" Then Call PlayerMsg(Attacker, "A " & Trim$(Npc(NpcNum).Name) & " : " & Trim$(Npc(NpcNum).AttackSay) & "", SayColor) End If End If ' Set the NPC target to the player MapNpc(MapNum, MapNpcNum).Target = Attacker MapNpc(MapNum, MapNpcNum).TargetType = TARGET_TYPE_PLAYER ' Now check for guard ai and if so have all onmap guards come after'm If Npc(MapNpc(MapNum, MapNpcNum).num).Behavior = NPC_BEHAVIOR_GUARD Then For I = 1 To MAX_MAP_NPCS If MapNpc(MapNum, I).num = MapNpc(MapNum, MapNpcNum).num Then MapNpc(MapNum, I).Target = Attacker MapNpc(MapNum, I).TargetType = TARGET_TYPE_PLAYER End If Next End If End If 'Call SendDataToMap(MapNum, "npchp" & SEP_CHAR & MapNpcNum & SEP_CHAR & MapNpc(MapNum, MapNpcNum).HP & SEP_CHAR & GetNpcMaxHP(MapNpc(MapNum, MapNpcNum).num) & SEP_CHAR & END_CHAR) ' Reset attack timer Player(Attacker).AttackTimer = GetTickCount End Sub ``` The "Index" variable is not always referring to the player. In the AttackNpc Sub, Index is passed through it, and it is renamed "Attacker," so instead of referring to the player as "Index," you'd need to refer to the player with the "Attacker" variable.
  4. Hey, everyone! I'm getting Run Time Error '9': Subscript out of range whenever I handle data from a certain packet. I can't seem to figure out why because all of the data is being sent and received properly. Here's my code: **Packet sent from the Server**: ``` Sub SendClasses(ByVal Index As Long) Dim I As Long Dim b As clsBuffer Set b = New clsBuffer b.WriteLong Sclassesdata b.WriteInteger MAX_CLASSES For I = 0 To MAX_CLASSES b.WriteString Trim$(ClassData(I).Name) b.WriteString Trim$(ClassData(I).Desc) b.WriteLong GetClassMaxHP(I) b.WriteLong GetClassMaxMP(I) b.WriteLong GetClassMaxSP(I) b.WriteLong ClassData(I).STR b.WriteLong ClassData(I).DEF b.WriteLong ClassData(I).Speed b.WriteLong ClassData(I).Magi b.WriteLong ClassData(I).Locked Next I Call SendDataTo(Index, b.ToArray()) Set b = Nothing End Sub ``` **Packet being handled in the Client**: ``` HandleDataSub(Sclassesdata) = GetAddress(AddressOf ClassesData) ``` ``` Private Sub ClassesData(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim I As Long Dim b As clsBuffer Set b = New clsBuffer b.WriteBytes Data() ' Max classes Max_Classes = b.ReadInteger ReDim Class(0 To Max_Classes) As ClassRec For I = 0 To Max_Classes Class(I).Name = b.ReadString Class(I).desc = b.ReadString Class(I).HP = b.ReadLong Class(I).MP = b.ReadLong Class(I).SP = b.ReadLong Class(I).STR = b.ReadLongh Class(I).DEF = b.ReadLong Class(I).speed = b.ReadLong Class(I).MAGI = b.ReadLong Class(I).Locked = b.ReadLong Next I Set b = Nothing End Sub ``` The error is appearing within the WriteBytes command for whatever reason. When I changed the packet around earlier, I managed to find out that **Class(I).Name** was considered **Subscript Out of Range** when it was assigned to a name, which doesn't make any sense. Any help would be greatly appreciated.
  5. Sorry for the double post, but I thought I'd bring some more attention to this, as it can be pretty important. I've found out the reason for the flaw in the Random function. Take a look at the original function, with the randomization fix included: ``` Function Random(ByVal Low As Integer, ByVal High As Integer) As Integer Randomize Random = ((High - Low + 1) * Rnd) + Low End Function ``` Here, **Random** is clearly an Integer, meaning it rounds to a whole number value. However, you're letting the Random do the rounding itself, and when an integer rounds, it rounds either up or down depending on what number is in the tenths place. So, let's use my random code as an example: ``` RandomNum = Random(1, 4) ``` This is what could be happening inside the Random function: ``` Function Random(ByVal Low As Integer, ByVal High As Integer) As Integer Randomize Random = ((4 - 1 + 1) * .94) + 1 End Function ``` The first part, **((4 - 1 + 1) * .94)**, would yield **3.76** as a value. Add one to that, and it becomes **4.76**. Since you're allowing the integer (Random) to round by itself, it rounds that number up to 5. Now let's see what would happen if you were using a slightly modified Random function that I made: ``` Function Random(ByVal Low As Integer, ByVal High As Integer) As Integer Randomize Random = Int((High - Low + 1) * Rnd) + Low End Function ``` Notice that the Int() modifier was added. This rounds the number down regardless, so let's take a look at how that fixes the problem, with the same example of course: ``` Function Random(ByVal Low As Integer, ByVal High As Integer) As Integer Randomize Random = Int((4 - 1 + 1) * .94) + 1 End Function ``` Again, the first part, **((4 - 1 + 1) * .94)**, yields **3.76** as the value. This time, however, the Int() modifier rounds that down to 3\. Adding the 1 to it effectively keeps it within the range, at a value of 4.
  6. Okay, thanks. I'll adapt to it, but I just thought I'd post it to help out others as well. The Eclipse Evolution 2.7 Rand function works well for me, so maybe that can be a suitable replacement for the current function, if changed to return an Integer instead of a Long?
  7. I was setting a random value in Eclipse Origins, and it somehow extended beyond my specified range. I've changed my Random function to look like this: ``` Function Random(ByVal Low As Integer, ByVal High As Integer) As Integer Randomize Random = ((High - Low + 1) * Rnd) + Low End Function ``` This is my randomization code: ``` Dim RandomNum as Integer RandomNum = Random(1, 4) ``` Somehow, I'm getting 5 as a result occasionally. Any ideas? I've also tried this as well: ``` RandomNum = Int(Random(1, 4)) ```
  8. Hey! I was sending some packets, and I realized that there is no option to write booleans to the buffer. I just sent them as a Long; would that work? EDIT: Sending Booleans through as either an Integer or a Long will work because when a boolean is True, its numerical value is -1\. When it is False, its numerical value is 0.
  9. It's great to hear that Ambardia is still going strong. I may try out this new version because I'm sure it will be amazing! @Robin: > Please, _please_ make sure the installer allows you to not install the library files. And make sure it doesn't remove them if you didn't install them with the installer. > > I generally avoid every Eclipse game which has an installer because people don't know how to set them up properly without destroying my runtime files. Maybe Ambard could take what we do in the SMBO installer as an example. We make the installer not install the library files; instead, there's a .exe file in the main folder with all the other files named "RUN THIS BEFORE YOU PLAY THE GAME!" People who have played Eclipse games before would know that these are the library files and would therefore not run them if they already have them installed. However, new players would obviously run it because of its name, lol. It works pretty well, I'd say.
  10. That could work too, I suppose.
  11. I'd just like to add a little something to this tutorial. If you plan on using this tutorial to make your randomizations accurate, you should put this function somewhere in your source: ``` Public Function Rnd2() Randomize Rnd2 = Rnd End Function ``` Now, wherever you see **Rnd**, simply replace it with **Rnd2**. I find that much easier and more organized than sticking a Randomize in before every **Rnd**.
  12. Thanks for spotting this out. I don't use Rnd too often, but I'll put this in wherever I see it; I usually stick to using the Rand function, which has Randomize at the beginning of the function.
  13. Sorry guys, but I've already stated that I won't be taking anymore suggestions. All of your suggestions are indeed possible, though. I will now lock this topic because there's no need to post here anymore.
  14. Did you make sure that you've added in the part in the server that updates the NPC's HP?
  15. No problem. I'm glad it's helping you out!
  16. Look up your computer's manufacturer and see if you can install better video drivers for your video card. It should be relatively easy to find them.
  17. I highly doubt it because Origins' MapRec construction is pretty different than Eclipse Stable's.
  18. Okay, no problem. I'm glad I could help!
  19. Yeah, I suppose. Just send them to me through a PM.
  20. Yes, this is possible; however, these are not loops. They are just simple IF statements. You should also combine your IF statements with an AND statement like so: ``` If x = a And y = b Then z = c ElseIf x = b And y = c Then z = a End If ```
  21. Basically, when you have your project open in Visual Basic 6, press CTRL + F5 to compile it.
  22. Did you try taking out HP from an NPC?
  23. @bandcampboy: > I'm pretty sure I did everything you said and It's not working for me. Could you post screenshots of the effects so I can see what it's supposed to look like. Yeah, I can, but did you make sure you put some of the code in the Server? Npc at max HP: ![](http://www.freemmorpgmaker.com/files/imagehost/pics/51f870c0360cee47a0ec8b88b8386d9c.png) Npc with HP taken: ![](http://www.freemmorpgmaker.com/files/imagehost/pics/ee5b9b337a9450c5487959e26300889a.png)
×
×
  • Create New...