Map Database  •  FAQ  •  RSS  •  Register  •  Login

Unhandled exception when using Actions.HouseAddRepair

<<

tomasara413

Peasant

Posts: 4

Joined: 06 Jun 2014, 12:33

KaM Skill Level: Fair

Post 27 Jun 2016, 16:13

Unhandled exception when using Actions.HouseAddRepair

Hello, so lets get straight into the problem.
I came across this when I was scripting (how unsuspected), I kinda took over concept, but the important thing was that I tried to enhance it by repairing houses that do not need to be destroyed. But when we (me and friend) tested the map, we found out that when someone damages house in the earliest stage of building process, it crashes.
Lately I was thinking what could possibly cause this problem. And I fugured out that all problems are caused by script part down bellow (it's easy to fix in the script but despite the crash I think it should be considered as bug, please correct me if I am wrong). So what I suspect happend is this: in proc. OnHouseDamaged it gets taken damage and adds that damage to repair. It all uses ID of damaged building which is generated when building is placed, but in this case when building has no (0) health on start when you hit it, it'll destroy that building which will delete the ID but also the ID will be transfered to OnHouseDamage and will try to repair building which is not in the game anymore and also it will take all the damage from (defacto) non existing building.
So that's probably the case. And thanks for reading and hoopefully resolving.
  Code:
begin   
   TypeOfHouse := States.HouseType(aHouseId);
   Owner := States.HouseOwner(aHouseId);
   TakenDamage := States.HouseDamage(aHouseId);
   
   if (TypeOfHouse <> 29) and (TypeOfHouse <> 17) and (TypeOfHouse <> 21) and (Players[Owner].Enslaved = false) then
   begin
      Actions.HouseAddRepair(aHouseId, TakenDamage);
   end
   else if (TypeOfHouse = 29) and (TakenDamage > 250) and (Players[Owner].Enslaved = false) then
   begin
      Actions.PlayerShareFog(Owner, aAtacker, true);
      Actions.PlayerAllianceChange(Owner, aAtacker, true, true);
   end;
end;
Last edited by tomasara413 on 28 Jun 2016, 07:17, edited 1 time in total.
<<

Krom

User avatar

Knights Province Developer

Posts: 3237

Joined: 09 May 2006, 22:00

Location: Russia

KaM Skill Level: Fair

Post 28 Jun 2016, 04:29

Re: Unhandled exception when using Actions.HouseAddRepair

Described problem should not be caused by that explicitly - house object is kept around till its reference count reaches 0. Also repairing of non-existent house silently does nothing in code.

It looks problem is someplace else. Without exception details it's hard to guess. Did you get crashreport and send it to us?
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

tomasara413

Peasant

Posts: 4

Joined: 06 Jun 2014, 12:33

KaM Skill Level: Fair

Post 28 Jun 2016, 07:50

Re: Unhandled exception when using Actions.HouseAddRepair

Well I don't know, but when I removed "house healing" script. Also figured that this affects any building except the three excluded in if and also in any stage of building process, when it's all done it works fine. But on your request I and my friend printscreened and recorded the error with some info (all just in case you were not able to get our report from game or there isn't enough screenshots of detail). I was not able to take all of those screenshots (I actually was able only to screen only one of them), because my video allways froze after the error. If you got the reports it should be from game username Tom Heldens/Cersei Lannister if you look at system username then it's just Tom. I should also mention that map is designed for multiplayer.
Here are some screenshots: https://ctrlv.cz/hanT; http://prnt.sc/bm0ime; http://prnt.sc/bm0ivc;
Here is video: https://www.youtube.com/watch?v=Z7voFBDNCgQ&feature=youtu.be
<<

Krom

User avatar

Knights Province Developer

Posts: 3237

Joined: 09 May 2006, 22:00

Location: Russia

KaM Skill Level: Fair

Post 29 Jun 2016, 08:51

Re: Unhandled exception when using Actions.HouseAddRepair

Call Stack info is very helpful!
I hope to take a deeper look later
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de

Return to Bugs

Who is online

Users browsing this forum: No registered users and 2 guests