Re: Vatrix's Campaign Fixes
PostPosted: 19 Dec 2014, 09:30
-The builders and servants come out of the storehouse after the enemy forces in town are defeated.
Talk about Knights and Merchants!
http://knightsandmerchants.net/forum/
-The builders and servants come out of the storehouse after the enemy forces in town are defeated.
I wonder how this works? Are they just being spawned around the storehouse, or is there actually a script these days to make them walk out of a building?-The builders and servants come out of the storehouse after the enemy forces in town are defeated.
That would be a pity, I think it looks really bad when units or buildings just appear out of nowhere...
I think it was okay in the original version. Why is it any different in the Remake?
Seeing how the latter is probably impossible
First option is right, they're spawned when player 4 and 5 is defeated, because if player have them from start, they're almost all killed by enemy. I know it looks a bit odd, but this is now the only option how to save them all.That would be a pity, I think it looks really bad when units or buildings just appear out of nowhere...
var aCivQueue: array of Record aType, aOwner, aX, aY, aHunger, aDir: Integer; end;
procedure OnUnitWounded(aUnitID: Integer; AttackerID: Integer);
begin
if ( (States.PlayerDefeated(3) = False) OR (States.PlayerDefeated(4) = False) ) AND (States.UnitOwner(aUnitID) = 0) AND ( (States.UnitType(aUnitID) = 0) OR (States.UnitType(aUnitID) = 9) ) then begin
SetLength(aCivQueue, Length(aCivQueue)+1);
aCivQueue[Length(aCivQueue)-1].aType := States.UnitType(aUnitID);
aCivQueue[Length(aCivQueue)-1].aOwner := States.UnitOwner(aUnitID);
aCivQueue[Length(aCivQueue)-1].aX := States.UnitPositionX(aUnitID);
aCivQueue[Length(aCivQueue)-1].aY := States.UnitPositionY(aUnitID);
aCivQueue[Length(aCivQueue)-1].aHunger := States.UnitHunger(aUnitID);
aCivQueue[Length(aCivQueue)-1].aDir := States.UnitDirection(aUnitID);
Actions.UnitKill(aUnitID, True);
end;
end;
procedure OnUnitAfterDied(aType: Integer; aOwner: Integer; aX: Integer; aY: Integer);
var i: Integer;
var i2: Integer;
var iCount: Integer;
begin
if Length(aCivQueue) > 0 then begin
iCount := 0;
for i := 0 to Length(aCivQueue)-1 do if (aType = aCivQueue[i-iCount].aType) AND (aOwner = aCivQueue[i-iCount].aOwner) AND (aX = aCivQueue[i-iCount].aX) AND (aY = aCivQueue[i-iCount].aY) then begin
Actions.UnitHungerSet(Actions.GiveUnit(aCivQueue[i-iCount].aOwner, aCivQueue[i-iCount].aType, aCivQueue[i-iCount].aX, aCivQueue[i-iCount].aY, aCivQueue[i-iCount].aDir), aCivQueue[i-iCount].aHunger);
for i2 := i-iCount to Length(aCivQueue)-2 do aCivQueue[i2] := aCivQueue[i2+1];
iCount := iCount+1;
end;
if iCount > 0 then SetLength(aCivQueue, Length(aCivQueue)-iCount);
end;
end;
Ouuuuuuu, thank you, I didn't really thought of making them immortal, nice idea!!!
Ouuuuuuu, thank you, I didn't really thought of making them immortal, nice idea!!!![]()
P.S. By the way, it should be possible to use a similar code to change each Barbarian's max Life Points value to a lower number, if you need to nerf the initial attack in mission 8 in a not too obvious way.
IMO the original campaigns shouldn't have things like invincible units, magically spawning units
function TKMScriptActions.GiveUnitFromHouse(aPlayer, aType, aHouseID, aDir: Word): Integer;
var
U: TKMUnit;
H: TKMHouse;
aX, aY: Word;
begin
try
Result := UID_NONE;
//Verify all input parameters
if InRange(aPlayer, 0, gHands.Count - 1) and (gHands[aPlayer].Enabled)
and (aType in [UnitTypeToIndex[CITIZEN_MIN] .. UnitTypeToIndex[CITIZEN_MAX]])
and (aHouseID > 0)
and (TKMDirection(aDir + 1) in [dir_N .. dir_NW]) then
begin
H := fIDCache.GetHouse(aHouseID);
if H = nil then Exit;
aX := H.GetEntrance.X;
aY := H.GetEntrance.Y;
U := gHands[aPlayer].AddUnit(UnitIndexToType[aType], KMPoint(aX,aY));
if U = nil then Exit;
Result := U.UID;
U.Direction := TKMDirection(aDir + 1);
//Make sure the unit is not locked so the script can use commands like UnitOrderWalk.
//By default newly created units are given SetActionLockedStay
U.SetActionGoIn(ua_Walk,gd_GoOutside,H);
end
else
LogParamWarning('Actions.GiveUnitFromHouse', [aPlayer, aType, aHouseID, aDir]);
except
gScriptEvents.ExceptionOutsideScript := True; //Don't blame script for this exception
raise;
end;
end;
I don't like the idea of these magic scripts which change the gameplay/balance in the original campaigns. IMO the original campaigns shouldn't have things like invincible units, magically spawning units, or barbarians with lower life points. Unit statistics should be consistent between missions, you shouldn't make certain units weaker or immortal in some missions just because it suits the balance better. If you want weaker barbarians, just remove some of them or something like that which doesn't change the game rules.Ouuuuuuu, thank you, I didn't really thought of making them immortal, nice idea!!!![]()
P.S. By the way, it should be possible to use a similar code to change each Barbarian's max Life Points value to a lower number, if you need to nerf the initial attack in mission 8 in a not too obvious way.
Heavily using scripts also makes it prone to bugs, and probably means the campaigns will need to be checked/updated for every release to make sure all the scripts are still working the way you intended.
I don't like the idea of these magic scripts which change the gameplay/balance in the original campaigns. IMO the original campaigns shouldn't have things like invincible units, magically spawning units, or barbarians with lower life points. Unit statistics should be consistent between missions, you shouldn't make certain units weaker or immortal in some missions just because it suits the balance better. If you want weaker barbarians, just remove some of them or something like that which doesn't change the game rules.
Heavily using scripts also makes it prone to bugs, and probably means the campaigns will need to be checked/updated for every release to make sure all the scripts are still working the way you intended.
I agree that scripts shouldn't be added to the original campaigns. I think some people are trying to change things simply because they can. If serfs are dying like flies in mission 1 and it is seriously possible to be stuck without serfs, then just fill the school with gold or add a few serfs. Making invincible serfs is a terrible idea in my opinion.
Then give us Actions.GiveUnitFromHouse().IMO the original campaigns shouldn't have things like invincible units, magically spawning units![]()
Pweeeease![]()