Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ranged weapons.
#1
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)) = ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex
Reply
#2
All you've done is added a variable. Where's the ranged weapon code?
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#3
Quote:Untested


Yea... um...
Reply
#4
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.
Reply
#5
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
Reply
#6
My mistake *first tutorial*
Reply
#7
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. Smile Think it was him, though.
Reply
#8
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.
Reply
#9
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.
Reply
#10
Dave Wrote:You could split them by element
Fire, Water, Earth, Ice, Light, Dark, etc

Since when were Light and Dark elements?
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#11
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.

Reply
#12
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 Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)