| Mirage Source http://www.miragesource.net/forums/ |
|
| Ranged weapons. http://www.miragesource.net/forums/viewtopic.php?f=210&t=3646 |
Page 1 of 2 |
| Author: | Jack [ Sun Apr 27, 2008 9:14 am ] |
| Post subject: | Ranged weapons. |
Well this is my first tutorial and im changing somethings in the 2handed tutorial so. here it is Copy and paste 1/5 Understanding 2/5 Untested but 99.9% im sure it will work *i used the 2handed version by Sync and changed somethings around* Lets begin. -=Server side=- Go into Modtypes and find. Code: Type ItemRec Add This Code: Ranged As Byte Below Code: Data3 Integer Now go into ModDatabase and Find. Code: Sub SaveItem(ByVal ItemNum As Long) Then add Code: Call PutVar(FileName, "ITEM" & ItemNum, "Ranged", Trim(Item(ItemNum).Ranged)) Below Code: Call PutVar(FileName, "ITEM" & ItemNum, "Data3", Trim(Item(ItemNum).Data3)) Now find Code: Sub Loaditems() Add in Code: Item(i).Ranged = Val(GetVar(FileName, "ITEM" & i, "Ranged")) Below Code: Item(i).Data3 = Val(GetVar(FileName, "ITEM" & i, "Data3")) Server side is almost done now. Go into Modhandledata find Code: If LCase(Parse(0)) = "useitem" Then And find Code: Case ITEM_TYPE_WEAPON Change it to this Code: Case ITEM_TYPE_WEAPON If InvNum <> GetPlayerWeaponSlot(Index) Then If Item(GetPlayerInvItemNum(Index, InvNum)).Ranged < 1 Then If Int(GetPlayerSTR(Index)) < n Then Call PlayerMsg(Index, "Your strength is to low to hold this weapon! Required SPEED (" & n * 2 & ")", BrightRed) Exit Sub End If Call SetPlayerWeaponSlot(Index, InvNum) Else If GetPlayerShieldSlot(Index) = 0 Then Call SetPlayerWeaponSlot(Index, InvNum) Call SetPlayerShieldSlot(Index, InvNum) Else Call PlayerMsg(Index, "You have a sheild on!!", BrightRed) End If End If Else Call SetPlayerWeaponSlot(Index, 0) End If Call SendWornEquipment(Index) Just under the Case_item_Weapon You have Case_item_shield make it look like this Code: Case ITEM_TYPE_SHIELD If GetPlayerShieldSlot(Index) > 0 Then If GetPlayerWeaponSlot(Index) = GetPlayerShieldSlot(Index) Then Call PlayerMsg(Index, "You have a Ranged weapon equipped! Please unequip it before using your shield!", BrightRed) Exit Sub Else Call PlayerMsg(Index, "You already have a shield equipped! Please unequip it before using your shield!", BrightRed) End If Else If InvNum <> GetPlayerShieldSlot(Index) Then Call SetPlayerShieldSlot(Index, InvNum) Else Call SetPlayerShieldSlot(Index, 0) End If Call SendWornEquipment(Index) End If Now find Code: If LCase(Parse(0)) = "saveitem" Then Add in Code: Item(n).Ranged = Val(Parse(8)) So now it looks like this Code: ' Update the item Item(n).Name = Parse(2) Item(n).Pic = Val(Parse(3)) Item(n).Type = Val(Parse(4)) Item(n).Data1 = Val(Parse(5)) Item(n).Data2 = Val(Parse(6)) Item(n).Data3 = Val(Parse(7)) Item(n).Ranged = Val(Parse(8)) <----- added in Go into ModGameLogic find Code: Sub PlayerMapDropItem(ByVal Index As Long, ByVal InvNum As Long, ByVal Ammount As Long) Find Code: Case ITEM_TYPE_WEAPON make it look like Code: Case ITEM_TYPE_WEAPON If Item(GetPlayerInvItemNum(Index, InvNum)).TwoHanded < 1 Then If InvNum = GetPlayerWeaponSlot(Index) Then Call SetPlayerWeaponSlot(Index, 0) Call SendWornEquipment(Index) End If MapItem(GetPlayerMap(Index), i).Dur = GetPlayerInvItemDur(Index, InvNum) Else If InvNum = GetPlayerWeaponSlot(Index) And InvNum = GetPlayerShieldSlot(Index) Then Call SetPlayerWeaponSlot(Index, 0) Call SetPlayerShieldSlot(Index, 0) Call SendWornEquipment(Index) End If MapItem(GetPlayerMap(Index), i).Dur = GetPlayerInvItemDur(Index, InvNum) End If Now go into modServerTCP Find Code: Sub SendUpdateItemToAll(ByVal ItemNum As Long) Make the packet look like this =) Code: Packet = "UPDATEITEM" & SEP_CHAR & ItemNum & SEP_CHAR & Trim(Item(ItemNum).Name) & SEP_CHAR & Item(ItemNum).Pic & SEP_CHAR & Item(ItemNum).Type & SEP_CHAR & Item(ItemNum).Data1 & SEP_CHAR & Item(ItemNum).Data2 & SEP_CHAR & Item(ItemNum).Data3 & SEP_CHAR & Item(ItemNum).Ranged & SEP_CHAR & END_CHAR Right so close to the bottom now Find. Code: Sub SendEditItemTo(ByVal Index As Long, ByVal ItemNum As Long) make the packet like this Code: Packet = "EDITITEM" & SEP_CHAR & ItemNum & SEP_CHAR & Trim(Item(ItemNum).Name) & SEP_CHAR & Item(ItemNum).Pic & SEP_CHAR & Item(ItemNum).Type & SEP_CHAR & Item(ItemNum).Data1 & SEP_CHAR & Item(ItemNum).Data2 & SEP_CHAR & Item(ItemNum).Data3 & SEP_CHAR & Item(ItemNum).Ranged & SEP_CHAR & END_CHAR Done -=server side completed Congratulations=- Right the client now -=Client side=- Find modtypes and look for Code: Type ItemRec right under DATA 3 As integer Add Code: Ranged As Byte Now go to modClientTCP Find: Code: Public Sub SendSaveItem(ByVal ItemNum As Long) Make the packet look like this Code: Packet = "SAVEITEM" & SEP_CHAR & ItemNum & SEP_CHAR & Trim(.Name) & SEP_CHAR & .Pic & SEP_CHAR & .Type & SEP_CHAR & .Data1 & SEP_CHAR & .Data2 & SEP_CHAR & .Data3 & SEP_CHAR & .Ranged & SEP_CHAR & END_CHAR Now add You now have to add a checkbox in the equipment frame, in the items editor. Call it chkRanged and your set. Now, go into modGameLogic and find: Code: Public Sub ItemEditorOk() At the bottom of: Code: If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_POTIONSUBSP) Then and Code: If (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_SPELL) Then add Code: Item(EditorIndex).Ranged = 0 So should look sorta like this. Code: If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_POTIONSUBSP) Then Item(EditorIndex).Data1 = frmItemEditor.scrlVitalMod.Value Item(EditorIndex).Data2 = 0 Item(EditorIndex).Data3 = 0 Item(EditorIndex).Ranged = 0 End If Code: If (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_SPELL) Then Item(EditorIndex).Data1 = frmItemEditor.scrlSpell.Value Item(EditorIndex).Data2 = 0 Item(EditorIndex).Data3 = 0 Item(EditorIndex).Ranged = 0 End If now at the bottom of Code: If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_SHIELD) Then after Code: Item(EditorIndex).Data3 = 0 add Code: Item(EditorIndex).Ranged = frmItemEditor.chkRanged.Value Ok, now go into modHandleData and find: Code: If (LCase(Parse(0)) = "updateitem") Then Add below the update item section this: Item(n).Ranged = 0 Now find: Code: If (LCase(Parse(0)) = "edititem") Then And below: Code: Item(n).Data3 = Val(Parse(7)) ADD: Code: Item(n).Ranged = Val(Parse(8)) Well that's done and i hope it works =) Message me if it doesn't and ill help fix it MSN:[email protected] |
|
| Author: | Robin [ Sun Apr 27, 2008 11:14 am ] |
| Post subject: | Re: Ranged weapons. |
All you've done is added a variable. Where's the ranged weapon code? |
|
| Author: | Labmonkey [ Sun Apr 27, 2008 1:01 pm ] |
| Post subject: | Re: Ranged weapons. |
Quote: Untested Yea... um... |
|
| Author: | Lea [ Sun Apr 27, 2008 1:40 pm ] |
| Post subject: | Re: Ranged weapons. |
What's with people posting "untested" tutorials lately? They're of no use if they don't work, and they DO NOT work if they are untested. |
|
| Author: | Kousaten [ Sun Apr 27, 2008 1:58 pm ] |
| Post subject: | Re: Ranged weapons. |
Better question: How do you expect to test it without a ranged weapon? o.O This is like... adding a special data to Players for a specific series of quests, but not implementing those quests. |
|
| Author: | Labmonkey [ Sun Apr 27, 2008 2:12 pm ] |
| Post subject: | Re: Ranged weapons. |
Well he copied the two-handed weapon tutorial, and changed all of the "two-handed" to "range". Only thing is range doesn't do anything... at all |
|
| Author: | Asrrin29 [ Sun Apr 27, 2008 5:48 pm ] |
| Post subject: | Re: Ranged weapons. |
http://web.miragesource.com/old-tutoria ... apons.html |
|
| Author: | Jack [ Sun Apr 27, 2008 8:06 pm ] |
| Post subject: | Re: Ranged weapons. |
My mistake *first tutorial* |
|
| Author: | Kousaten [ Mon Apr 28, 2008 11:49 am ] |
| Post subject: | Re: Ranged weapons. |
Understanding the basics of how to add a stat of sorts to how data is saved and loaded in certain aspects (player, npc, items, spells, shops...) is actually decent for a first tutorial. I remember the days when people were asking how to break away from the formula which automatically set NPC HP/EXP, and the only somewhat tough part of that was understanding where everything loaded and how it was saved. I think I posted a tutorial on it but forgot a few parts and didn't finish it in the end. Magnus posted one later that works quite well, I believe. This was before MSE1 even, so I can't really recall who did it exactly. |
|
| Author: | Asrrin29 [ Mon Apr 28, 2008 12:22 pm ] |
| Post subject: | Re: Ranged weapons. |
Well I'm glad he's learning something, but posting it as a tutorial may not have been the wisest choice. regardless, he has learned something and there is already a finished working tutorial for this. so everyone wins. and for the record I've completely redone stats on everything in the game except for spells, which are next on my list. take a look at some of my screenshots posted in the gallery to see what I've done. |
|
| Author: | Kousaten [ Mon Apr 28, 2008 2:30 pm ] |
| Post subject: | Re: Ranged weapons. |
All I've done is renewed some things... DEF became VIT, SPEED became AGI, MAGI became WIS. Added DEX, used the values of DEX and AGI to determine accuracy in PvP (players may complain about not hitting regular monsters, but PvP is a big thing in my community so I placed it there anyway and no complaints thus far). Added INTL, changed formulas to keep WIS as a bonus for only "healing" spells, and INTL for "offensive spells" using WIS as the defense instead of the GetPlayerProtection as normal. Not too much, just some minor stuff I wanted. XD Might do more later though, once I get the game to where I can release an alpha. |
|
| Author: | Rian [ Mon Apr 28, 2008 3:38 pm ] |
| Post subject: | Re: Ranged weapons. |
Yeah, I feel like I should update my spell system a bit more too. Physical combat in my game includes a Slashing, Bludgeoning, Piercing, Ranging, and Shielding skills. Can't really think of good categories for splitting skills associated with spells though. |
|
| Author: | Lea [ Mon Apr 28, 2008 4:32 pm ] |
| Post subject: | Re: Ranged weapons. |
You could split them by element Fire, Water, Earth, Ice, Light, Dark, etc |
|
| Author: | Robin [ Mon Apr 28, 2008 6:47 pm ] |
| Post subject: | Re: Ranged weapons. |
Dave wrote: You could split them by element Fire, Water, Earth, Ice, Light, Dark, etc Since when were Light and Dark elements? |
|
| Author: | Labmonkey [ Mon Apr 28, 2008 7:34 pm ] |
| Post subject: | Re: Ranged weapons. |
Robin wrote: Dave wrote: You could split them by element Fire, Water, Earth, Ice, Light, Dark, etc Since when were Light and Dark elements? Have you never seen the Fantasy Periodic Table of elements. <a picture would be here but I'm not nerdy enough> |
|
| Author: | Jack [ Mon Apr 28, 2008 9:50 pm ] |
| Post subject: | Re: Ranged weapons. |
Glad to see that i have learn't something through out the past time with Mirage Source and its Good to see some Nice comments on it Thanks guys |
|
| Page 1 of 2 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|