Barbarians in TSK?
Please cast your vote on strawpoll:
http://www.strawpoll.me/14813128
Thanks!
The Poll will be closed 12 January at 15:00 CET
Poll closed with following results:
Former Site Admin
Posts: 3814
Joined: 08 Jan 2009, 23:00
Location: California - Pacific Time (UTC -8/-7 Summer Time)
King Karolus Servant
Posts: 2154
Joined: 29 Aug 2007, 22:00
KaM Skill Level: Veteran
Location: In his dark thunderstormy castle
Moorbach's Guard
Posts: 1044
Joined: 15 Apr 2012, 12:11
KaM Skill Level: Fair
Location: In the Market
1. The people who made TSK might actually have intended to have the AI train barbarians
2. The AI can actually train knights in this mission
I think there are enough barbs on TSK8. That map is all about the first wave of barb attack and the two bases if I remember well. One of the funniest missions.
Moorbach's Guard
Posts: 1044
Joined: 15 Apr 2012, 12:11
KaM Skill Level: Fair
Location: In the Market
King Karolus Servant
Posts: 2154
Joined: 29 Aug 2007, 22:00
KaM Skill Level: Veteran
Location: In his dark thunderstormy castle
I think there are enough barbs on TSK8. That map is all about the first wave of barb attack and the two bases if I remember well. One of the funniest missions.
Besides, it looks kinda ugly to see an axe fighter 'disappear' and 'change' into a barbarian when it comes out of the barracks (since there is no 'barbarian walking out of the barracks' animation).
procedure TKMScriptActions.UnitTypeSet(aUnitID, aNewType: Integer);
var
U: TKMUnit;
G: TKMUnitGroup;
begin
try
if (aUnitID > 0)
and (aNewType in [UnitTypeToIndex[WARRIOR_MIN]..UnitTypeToIndex[WARRIOR_MAX]]) then
begin
U := fIDCache.GetUnit(aUnitID);
if U = Nil then Exit;
if not (U.UnitType in [WARRIOR_MIN .. WARRIOR_MAX]) then
begin
LogParamWarning('Actions.UnitTypeSet is not supported for civilians', [aUnitID, aNewType]);
Exit;
end;
if U.SetUnitType(UnitIndexToType[aNewType]) then //Returns True if the group type changed
begin
//Split the unit if its group type changed
G := gHands[U.Owner].UnitGroups.GetGroupByMember(TKMUnitWarrior(U));
if G <> Nil then
G.UpdateGroupType(TKMUnitWarrior(U));
end;
end
else
LogParamWarning('Actions.UnitTypeSet', [aUnitID, aNewType]);
except
gScriptEvents.ExceptionOutsideScript := True; //Don't blame script for this exception
raise;
end;
end;
function TKMUnit.SetUnitType(NewType: TUnitType): Boolean;
begin
Result := False;
if fUnitType = NewType then Exit;
//Abort the storming if the new type shouldn't be able to
if (GetUnitAction is TUnitActionStormAttack)
and (NewType in [low(UnitGroups) .. high(UnitGroups)])
and (UnitGroups[NewType] <> gt_Melee) then
TUnitActionStormAttack(GetUnitAction).DepleteStamina;
//Update player stats
gHands[fOwner].Stats.UnitLost(fUnitType);
gHands[fOwner].Stats.UnitCreated(NewType, False);
//Check if the group type changed
if (fUnitType in [low(UnitGroups) .. high(UnitGroups)])
and (NewType in [low(UnitGroups) .. high(UnitGroups)])
and (UnitGroups[fUnitType] <> UnitGroups[NewType]) then
Result := True;
//Update hit points
fHitPoints := Min(fHitPoints, gRes.UnitDat[NewType].HitPoints);
//Actually change the unit type
fUnitType := NewType;
end;
procedure TKMUnitGroup.UpdateGroupType(aUnit: TKMUnitWarrior);
var
G: TKMUnitGroup;
begin
if Count > 1 then
begin
G := OrderSplitUnit(aUnit, True);
G.UpdateGroupType(aUnit);
Exit;
end;
if gHands[fOwner].AI.General.DefencePositions.FindPositionOf(Self) = nil then
begin
fGroupType := UnitGroups[aUnit.UnitType];
gHands[fOwner].AI.General.WarriorEquipped(Self); //Update AI logic
end else begin
//Workaround to release this group from AI defence positions if Count = 1
aUnit.ReleaseUnitPointer;
G := gHands[fOwner].UnitGroups.AddGroup(aUnit);
G.OnGroupDied := OnGroupDied;
G.fTimeSinceHungryReminder := fTimeSinceHungryReminder;
G.fOrderLoc := KMPointDir(aUnit.GetPosition, fOrderLoc.Dir);
G.OrderHalt(False);
if MySpectator.Selected = Self then begin
MySpectator.Selected := G;
G.fSelected := fSelected;
end;
fMembers.Delete(0);
end;
end;
Thanks Esthlos, maybe we could put it in good use!
Also are you on discord?
Users browsing this forum: No registered users and 4 guests
Powered by phpBB® Forum Software © phpBB Group Designed by ST Software |