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

Ammo for range projectiles (3.0) not hardcoded


or3o
 Share

Recommended Posts

Thanks to

**[Exxsamuari](http://www.touchofdeathforums.com/community/index.php?/user/77774-exxsamuari/) for giving the the idea and thanks to [Joyce](http://www.touchofdeathforums.com/community/index.php?/user/48253-joyce/) for giving be the basics of how to do this. and thanks to [Ryoku Hasu](http://www.touchofdeathforums.com/community/index.php?/user/64145-ryoku-hasu/) for his spells require equipment tutorial (i borrowed heavily from it) alright first you need to have wabbits range system already in your game.**

**Now to the coding.**

Client side first

Go to mod types and in the item rec add to the bottom before end type

```
ammo as long

ammoreq as long
```

now in frmEditor_item in your projectiles frame add a checkbox name it```
ChkAmmo
```
then a scrollbar and name it```
scrlAmmo
```
and last a label name it```
lblammo
```

Double click scrlAmmo and paste

```
If scrlAmmo.Value > 0 Then

lblammo.Caption = "Weapon: " + Item(scrlAmmo.Value).name

Else

lblammo.Caption = "Weapon: None"

End If

Item(EditorIndex).Ammo = scrlAmmo.Value
```

Next double click Chkammo and paste this```
If EditorIndex = 0 Or EditorIndex > MAX_ITEMS Then Exit Sub

Item(EditorIndex).ammoreq =Chkammo.Value
```

Now in the form go to Private sub form_load and paste```
Scrlammo.max = MAX_ITEMS
```

Now go to ModgameEditors in Itemeditorinit under```
frmEditor_Item.txtDesc.text = Trim$(.Desc)
```
paste```
frmEditor_Item.Scrlammo.Value = Item(EditorIndex).Ammo

frmEditor_Item.Chkammo.Value = Item(EditorIndex).ammoreq
```
That should be it for Client side, now lets move on to the Server!

Ok first go to mod types item rec before end type

```
ammo as long

ammoreq as long
```Now in Modhandledata in the Handleprojectileattack sub

right below```
CurEquipment = GetPlayerEquipment(Index, Weapon)
```
add this```
If Item(CurEquipment).ammoreq > 0 Then

If HasItem(Index, Item(CurEquipment).ammo) <= 0 Then

Call PlayerMsg(Index, "You Dont Have Any Arrows!", BrightRed)

Exit Sub

End If

Call TakeInvItem(Index, Item(CurEquipment).ammo, 1)

End If
```and that should be it! just make the ammo a currency and you can stack it, Thanks for checking out my tutorial. No credit needed
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...