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

My Promised Belly System (Hunger based on steps)


hisherwin
 Share

Recommended Posts

I don't recommend you to use this because its only for pokemon games

To all PMD Lovers!! BEHOLD The Noob Code Belly system!!

I called it Noob Code because the code was too messy . I don't know how to clean it ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)

Information: I made a New Map Moral , Like MAP_MORAL_DUNGEON .. On that map you will lose Belly.. I will also explain how i made this System , Well we can also called this System as Hunger System . When your belly reach to 0 and your still moving , you will lose health

Sorry for my English

Problems:

The major 1 Problem is when you log out and log in again your belly will turn into 100 again.. I don't know how to fix that .. So if anyone can fix it . i'll appriciate your help!!

Now let's start it .. The Belly Code is on the Client Side , And the HP Reduction Code is on Server Side

~Client Side~

On ModGameLogic find "CheckMovement" at "Player(MyIndex).Moving = MOVING_RUNNING" Add this below

```

If Map.Moral = MAP_MORAL_DUNGEON Then

If frmMain.lblBelly.Caption = "0" Then

SendBelly

Else

frmMain.lblBelly.Caption = Val(frmMain.lblBelly) - 1

End If

Else

frmMain.lblBelly.Caption = "100"

End If

```

You can also add it on "Player(MyIndex).Moving = MOVING_WALKING"

Now formwork , At frmMain add a lblBelly and make its caption "100" or any number you want ..

- at frmEditor_Map Properties add this on Morals "Dungeon"

At ModConstant on MapMorals add this

```

Public Const MAP_MORAL_DUNGEON As Byte = 2

```

Now at UpdateDrawMapName add Replace the whole sub into this

```

Public Sub UpdateDrawMapName()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

DrawMapNameX = Camera.Left + ((MAX_MAPX + 1) * PIC_X / 2) - getWidth(TexthDC, Trim$(Map.Name))

DrawMapNameY = Camera.top + 1

Select Case Map.Moral

Case MAP_MORAL_NONE

DrawMapNameColor = QBColor(BrightRed)

Case MAP_MORAL_SAFE

DrawMapNameColor = QBColor(White)

Case MAP_MORAL_DUNGEON

DrawMapNameColor = QBColor(Black)

Case Else

DrawMapNameColor = QBColor(White)

End Select

' Error handler

Exit Sub

errorhandler:

HandleError "UpdateDrawMapName", "modGameLogic", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

at HandlePLayerHP add this below the sub

```

If frmMain.lblHP.Caption = "0/" & GetPlayerMaxVital(MyIndex, Vitals.HP) Then

SendDead

Else

' Send None

End If

```

at clientTCP Add this at the bottom

```

Sub SendBelly()

Dim Buffer As clsBuffer

Set Buffer = New clsBuffer

Buffer.WriteLong CBelly

SendData Buffer.ToArray()

Set Buffer = Nothing

End Sub

Sub SendDead()

Dim Buffer As clsBuffer

Set Buffer = New clsBuffer

Buffer.WriteLong CDead

SendData Buffer.ToArray()

Set Buffer = Nothing

End Sub

```

at Enumeration add this above CMSG_COUNT

```

CBelly

CDead

```

at the same mod add this above SMSG_COUNT

```

SRestartBelly

```

At InitMessages add this

```

HandleDataSub(SRestartBelly) = GetAddress(AddressOf HandleRestartBelly)

```

at the bottom of the sub add this

```

Private Sub HandleSendPing(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

frmMain.lblBelly.Caption = "100"

End Sub

```

~Server Side~

At Map constants at modConstants add this

```

Public Const MAP_MORAL_DUNGEON As byte = 2

```

at Enumeration add this above CMSG_COUNT

```

CBelly

CDead

```

at the same mod add this above SMSG_COUNT

```

SRestartBelly

```

At the bottom of ServerTCP Add this

```

Sub SendRestartBelly(ByVal index As Long)

Dim buffer As clsBuffer

Set buffer = New clsBuffer

buffer.WriteLong SRestartBelly

SendDataTo index, buffer.ToArray()

Set buffer = Nothing

End Sub

```

Add this at InitMessages

```

HandleDataSub(CBelly) = GetAddress(AddressOf HandleBelly)

HandleDataSub(CDead) = GetAddress(AddressOf HandleDead)

```

At the bottom of the mod add this

```

Sub HandleBelly(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim x As Long

x = rand(5, 10)

If Player(index).Vital(Vitals.HP) <= 20 Then

Player(index).Vital(Vitals.HP) = Player(index).Vital(Vitals.HP) - 1

Else

Player(index).Vital(Vitals.HP) = Player(index).Vital(Vitals.HP) - x

End If

SendVital index, HP

End Sub

Sub HandleDead(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Call OnDeath(index)

End Sub

```

at sub onDeath add this after Dim i As Long

```

SendRestartBelly (index)

```

If i miss something please notice me..

If you saw some bugs , Please Notice me again

And if you want me to clean it , Please GET OUT!
Link to comment
Share on other sites

From looking at the code it takes only 100 steps to do damage. This will anoy players like hell and they will not play a game with that feature. I suggest making the -1 for every 10 steps so then it will be 1000 steps to do damage which is a bit more reasonable and like the PMD series. Keep programming Sherwin.

~Kibbelz
Link to comment
Share on other sites

> From looking at the code it takes only 100 steps to do damage. This will anoy players like hell and they will not play a game with that feature. I suggest making the -1 for every 10 steps so then it will be 1000 steps to do damage which is a bit more reasonable and like the PMD series. Keep programming Sherwin.
>
> ~Kibbelz

I saw that too .. I'm trying to use Rand Function to make it fix..
Link to comment
Share on other sites

You've done it the most awkward way possible. Make a timer in the gameloop that either decreases your hunger at certain intervals or randomly (If rand(1, 50) = 50 then Player(index).Hunger = Player(index).Hunger - 1, etc).
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...