Damage::BreakMyShield bug

Talk about Severance Blade of Darkness modifications and maps here. No tips or tech support questions please, use the forum above. Note that the game is rated 18 so some content may be unsuitable for younger readers.

Moderators: Ade, prospero

User avatar
cieply
Dragon
Posts: 312
Joined: Wed Jun 26, 2013 3:43 pm

Damage::BreakMyShield bug

Postby cieply » Sat Jun 10, 2017 12:52 am

Bug in Damage::BreakMyShield

It was when I was playing with Fugitive and tried to neutralise Ragnar when I discovered rather irritating bug:
when trying to shot him with a bow his shield was able to withstand any amount of damage without breaking.
Later it turned out it's true if only I was shooting repeatedly, if I made a break in barrage the shield was breaking up.
To see how it works check this link.

here is some log from console where you can see how it goes:

\[code\]
Load Time = 2.418000

if shield: // shield=<B_PyEntity object at 22c1a14>
shield=EscudoRagnar# 169

if shield: // shield=<B_PyEntity object at 22c07cc>
shield=EscudoRagnar# 38

if shield: // shield=<B_PyEntity object at 22c2260>
shield=EscudoRagnar# -93
## at this point shield should break already

if shield: // shield=<B_PyEntity object at 22c2314>
shield=EscudoRagnar# -131.0
## but it remains 'invincible' with 0 durability

if shield: // shield=<B_PyEntity object at 22c23d4>
shield=EscudoRagnar# -131.0

if shield: // shield=<B_PyEntity object at 22c23ec>
shield=EscudoRagnar# -131.0


object PerkinsQuiver_Arrow_8 of kind Flecha of mass 0.5 sticking for 6.0 seconds
if shield: // shield=<B_PyEntity object at 22c2188>
shield=EscudoRagnar# -131.0
End ActivateMenu()
\[/code\]

I started to look for a reason and I found that fault lies somewhere in Damage.py::BreakMyShield method.

# @ Lib/Damage.py

\[code\]
def BreakMyShield(EntityName):
me=Bladex.GetEntity(EntityName)
if me.InvLeft<>"":
esc=Bladex.GetEntity(me.InvLeft)
if esc:
n_child=esc.GetNChildren()
for n in range(n_child):
child=Bladex.GetEntity(esc.GetChild(n))
if child and child.Kind<>"Entity Spot":
esc.UnLink(child)
child.Impulse(0,0,0)
if Breakings.ExplodeSpecialObject ( me.InvLeft , 24000.0)==1:
if Reference.EntitiesObjectData.has_key(me.InvLeft):
del Reference.EntitiesObjectData[me.InvLeft]
DropInvalidObjectsOnImpact (EntityName)
me.Wuea=Reference.WUEA_ENDED
me.LaunchAnmType("df_s_broken")
inv=me.GetInventory()
inv.RemoveShield(me.InvLeft)
inv.LinkLeftHand("None")
if me.Data.NPC:
me.Data.ResetCombat (EntityName)
\[/code\]

for some reason when shooting repeatedly n_child is > 0
as far as I get it tries to unlink (is it same what delete?) derived objects but it fails and abandons execution of the rest of function body

question is how to fix it so it was dealing with that problem properly without dropping the rest of function body

PS. there are attached some files that will help if one wants to check that themselves - there is modified Lib/Damage.py with lot of print() debug info and already prepared scene - Coliseum map with Ragnar and "unlimited" quiver
there are also some console logs from my investigation, maybe that will help

PPS. sorry for this messy codes but they lose all indentations/new lines formatting when put in bbcode so I put them into message body
Last edited by cieply on Thu May 24, 2018 1:43 am, edited 1 time in total.
l'aria fresca,
vino puro, ...

User avatar
cieply
Dragon
Posts: 312
Joined: Wed Jun 26, 2013 3:43 pm

fixed

Postby cieply » Sat Jun 10, 2017 5:11 pm

after some contemplation I concluded that the fact it abandons rest of function must have raise exception which can be caught - so I enclosed function in try/except clause and as expected I got the desired result - an exception:

-- code --
def BreakMyShield(EntityName=Ragnar):
if me.InvLeft<>"": @ 904
n_child=2
child=<B_PyEntity object at 5e60670> // child=Bladex.GetEntity(esc.GetChild(n)) @ 912
if child and child.Kind<>"Entity Spot":
exception:
Traceback (innermost last):
File "..\..\Lib\Damage.py", line 972, in BreakMyShield
esc.UnLink(child)
AttributeError: UnLink
-- /code --

So it's `UnLink' that causes problem - quick look into the code and it turns out there is a corresponding method called `Unlink' (not `UnLink') and changing that was enough to repair the issue.

Summing up:
all you have to do is change `esc.UnLink(child)' to `esc.Unlink(child)' in `def BreakMyShiled(EntityName):'

-- code --
def BreakMyShiled(EntityName):
(...)
if child and child.Kind<>"Entity Spot":
print 'if child and child.Kind<>"Entity Spot":'
esc.Unlink(child) # ! `UnLink'->`Unlink'
-- /code --

PS. sorry for crude `-- code --' clauses - there seem to be a problem with bbcode lately
lacking indentation have to be preserved as they are in code
l'aria fresca,
vino puro, ...


Return to “Severance BoD: Modding Community”

Who is online

Users browsing this forum: No registered users and 1 guest

cron