Code center > Solved Bugs

Poison bug.

<< < (2/8) > >>

PurpleYouko:
For some reason the screenshot disappeared when I moved the post.

I didn't delete it on purpose. feel free to add it back in by edit of your post if you still have the link.

PurpleYouko:

--- Quote ---someone started kicking around my post here on the board
--- End quote ---
That was because it was OT for the thread in which you posted it.

I know that topics on the DB forum are normally very lax but in this bug forum I am trying to keep a tight reign on them.

Testlund:

--- Quote ---what value does "power" have in this subroutine. the level of poisin is defined by the "power" variable.
--- End quote ---
Here's the whole subrutine:

' robot n, hit by shot t, releases energy
Public Sub releasenrg(n As Integer, t As Integer)
  'n=robot number
  't=shot number
  Dim vx As Integer
  Dim vy As Integer
  Dim vs As Integer
  Dim vr As Single
  Dim power As Long
  Dim h2 As Integer
  Dim range As Single
  Dim scalingfactor As Single
  Dim Newangle As Single
     
  h2 = Half / 4
  vx = (Shots(t).vx - rob(n).vx) / -2 + rob(n).vx
  vy = (Shots(t).vy - rob(n).vy) / -2 + rob(n).vy
 
  If SimOpts.EnergyExType Then
    power = Shots(t).value * (Shots(t).nrg / Shots(t).range)
  Else
    power = SimOpts.EnergyFix
  End If
  If power > 8000 Then power = 8000
  If power > rob(n).nrg And Not rob(n).Corpse Then power = rob(n).nrg
  If rob(n).Corpse Then power = power * 0.5
 
  range = Shots(t).range     'new range formula based on range of incoming shot
 
  If rob(n).poison > power Then 'create poison shot
    createshot Shots(t).x, Shots(t).why, vx, vy, -5, n, power, range, vbYellow
    rob(n).Waste = rob(n).Waste + (power * 0.1)
    rob(n).poison = rob(n).poison - (power * 0.9)
    If rob(n).poison < 0 Then rob(n).poison = 0
    rob(n).mem(poison) = rob(n).poison
  Else ' create energy shot
    createshot Shots(t).x, Shots(t).why, vx, vy, -2, n, power, range, vbWhite
    rob(n).nrg = rob(n).nrg - power * 0.9  'some of shot comes from nrg
    rob(n).body = rob(n).body - power * 0.01 'some of shot comes from body
    rob(n).Radius = rob(n).body / factor
  End If
  If rob(n).body < 0 Or rob(n).nrg < 0 Then
    rob(Shots(t).Parent).kills = rob(Shots(t).Parent).kills + 1
    rob(Shots(t).Parent).mem(220) = rob(Shots(t).Parent).kills
  End If
  Shots(t).Exist = False
End Sub

Testlund:
Oh, and I have included this fix as you can see:

If power > 8000 Then power = 8000

PurpleYouko:
[hint]use the code tags to copy code up to the board or else you lose all formatting[/hint]

I know which routine it came from. I want to know what the hover value is for power when it crashed.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version