ComUpgrade - b_bunker fail

Modding, patches, etc., for anyone who speaks neither Polish nor Czech.
Post Reply
User avatar
Gravitr
Throwback Developer
Czech Republic
Posts: 240
Joined: Fri Jul 27, 2012 12:00 pm
Location: CZ Prague
Contact:

ComUpgrade - b_bunker fail

Post by Gravitr »

Hi

How to upgrade building b_bunker to automatic turret? I tried ComUpgrade function, but nothing happens.
There's maybe a "collision" between upgrade and downgrade, because bunker allows both.

I also check Skirmish maps, where bunker upgrade is, but there are just some macros, which I don't understand.
[MOD] Arabian History - 9 missions
Show post with download

[MOD] Vsevolod Mission - 4 pro missions
Show post with download

[MP-MOD] Throwback - over 35 new missions
Official site (+download)
User avatar
McBenn
ArCamp Developer
Posts: 509
Joined: Tue Sep 04, 2012 4:30 pm

Re: ComUpgrade - b_bunker fail

Post by McBenn »

ComUpgrade doesn't work with breastworks/bunkers, probably because a breastwork can be upgraded to both a bunker and a turret. ComUpgradeLab doesn't do the trick either (one could hope, you know). I haven't considered if a macro is an option. Haven't studied them very much.
User avatar
Serpent
Soldier level 10
Soldier level 10
Estonia
Posts: 4224
Joined: Tue Jul 07, 2009 9:13 pm
Location: Polska - EuroStan ZSRE
Contact:

Re: ComUpgrade - b_bunker fail

Post by Serpent »

Try this:
Spoiler:

Code: Select all

{
UpgradeTower(eng, list); - first ident is list of engineers, second ident is list* of bunkers to upgrade.
* - also you can use this for single bunker.
}

Export tw_wep;
Export Function UpgradeTower(eng, list);
var i, x, y, d, w;
begin

     tw_wep := [];

     For i := 1 to list do
         begin
      // save parametrs
         x := GetX(list[i]);
         y := GetY(list[i]);
         d := GetDir(list[i]);
         w := GetBWeapon(list[i]);

      // add to new list
         tw_wep := tw_wep ^ w;
      // delete old bunker
         RemoveUnit(list[i]);
      // build new turret
         AddComBuild(eng, b_turret, x, y, d);
         end;

End;


On BuildingComplete(b) do
begin

     If b in FilterAllUnits([f_btype, b_turret]) then
        begin
        PlaceWeaponTurret(b, tw_wep[1]);
        tw_wep := Delete(tw_wep, 1);
        end;

End;
This function build new turret with old bunker parametrs.
Epickie teksty:
Marek1906: jak zrobic aby sail był zielony?
Kvantovy: Wszystko normalne, wszystko w koło było dziwne
Kvantovy:: To jest fajne, że to nie jest takie głupie
Kvantovy:: remove sos from kanapeczka
Kvantovy:: zdarzają się rzezy które sie filozofom nie śniły
Cenwen: problemem jest gejostwo
"Taki z niego fizyk jak ze mnie baletnica" - Profesor Scholtze o Kvantovym.
JAKBYŁ BYM CZECHEM TO BYM ROZŁOŻYŁ NAMIOT ~Kvanciak
Post Reply