You must be logged in to post messages.
Please login or register

Modding Discussions
Moderated by Alexastor, MosheLevi, Mister SCP

Hop to:    
Welcome! You are not logged in. Please Login or Register.1 reply
Age of Empires III Heaven » Forums » Modding Discussions » Enabling units and changing unit costs in custom maps
Bottom
Topic Subject:Enabling units and changing unit costs in custom maps
murdilator
Skirmisher
posted 03-05-20 02:56 PM EDT (US)         
I have discovered how to do this, with the help of this file:

https://aoe3.heavengames.com/downloads/showfile.php?fileid=4053

And have made my own modifications

void balanceVanilla(void)
{
for(i=1; <cNumberPlayers)
{
rmCreateTrigger("OverallBalance"+i);
rmSwitchToTrigger(rmTriggerID("OverallBalance"+i));
rmSetTriggerPriority(3);
rmSetTriggerActive(true);
rmSetTriggerRunImmediately(true);
rmSetTriggerLoop(false);
rmAddTriggerCondition("Always");

rmAddTriggerEffect("Set Tech Status");
rmSetTriggerEffectParam("Status", "0");
rmSetTriggerEffectParamInt("PlayerID", i);
rmSetTriggerEffectParamInt("TechID", 304);

// A code that forbids the Gendarmes Tech, I think the numbering is the exact line of code it is.

rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParam("ProtoUnit", "TradingPost");
rmSetTriggerEffectParamInt("PlayerID", i);
rmSetTriggerEffectParamInt("Field", 16);
rmSetTriggerEffectParamInt("Delta", -50);

Number 16 is wood, Number 15 is gold, and Number 17 is food cost in the "Field". Field 0 is Hitpoints.

if ( rmGetPlayerCiv(i) == 3
|| rmGetPlayerCiv(i) == 4
|| rmGetPlayerCiv(i) == 5
|| rmGetPlayerCiv(i) == 1
){

rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParam("ProtoUnit", "Halberdier");
rmSetTriggerEffectParamInt("PlayerID", i);
rmSetTriggerEffectParamInt("Field", 17);
rmSetTriggerEffectParamInt("Delta", -10);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParam("ProtoUnit", "Halberdier");
rmSetTriggerEffectParamInt("PlayerID", i);
rmSetTriggerEffectParamInt("Field", 0);
rmSetTriggerEffectParamInt("Delta", 20);

// Civ 1 is Spanish, Civ 3 is French, Civ 4 and 5 are Portuguese and Dutch, Civ 6 is Russian.

rmCreateTrigger("HalbsGuard"+i);
rmSwitchToTrigger(rmTriggerID("HalbsGuard"+i));
rmSetTriggerPriority(3);
rmSetTriggerActive(true);
rmSetTriggerRunImmediately(false);
rmSetTriggerLoop(false);
rmAddTriggerCondition("Tech Status Equals");
rmSetTriggerConditionParamInt("PlayerID",i);
rmSetTriggerConditionParamInt("TechID",121);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParam("ProtoUnit", "Halberdier");
rmSetTriggerEffectParamInt("PlayerID", i);
rmSetTriggerEffectParamInt("Field", 0);
rmSetTriggerEffectParamInt("Delta", 6);
}

// TechID is important and I haven't quite figured it out, but I think currently that it is the exact number of techs to that tech, just as Gendarmes is 304. Delta is the amount in Modify Protounit. You can only add or subtract here.

rmAddTriggerEffect("Set Tech Status");
rmSetTriggerEffectParam("Status", "2");
rmSetTriggerEffectParamInt("PlayerID", i);
rmSetTriggerEffectParamInt("TechID", 304);[/code]

2 Means active, 1 Means Obtainable, 0 Means Unobtainable. This pre-researches Gendarmes for all players.

To enable a unit:

[code] rmAddTriggerEffect(“Unforbid and Enable Unit");
rmSetTriggerEffectParam("ProtoUnit", “Cuirassier”);
rmSetTriggerEffectParamInt("PlayerID", i);

// This enables Cuirassiers with all Civilizations with Stables or Forts or Galleons.

If I wanted to enable for just one Civ, then I'd use 8 for Ottomans, 7 for Germans, 21 for Indians, 20 for Chinese, 19 for Japanese, etc., in the order in which it appears in the "Civs" file.

if ( rmGetPlayerCiv(i) == 21){
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParam("ProtoUnit", “ypMahout”);
rmSetTriggerEffectParamInt("PlayerID", i);
rmSetTriggerEffectParamInt("Field", 16);
rmSetTriggerEffectParamInt("Delta", -50);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParam("ProtoUnit", "ypMahout");
rmSetTriggerEffectParamInt("PlayerID", i);
rmSetTriggerEffectParamInt("Field", 17);
rmSetTriggerEffectParamInt("Delta", -50);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParam("ProtoUnit", "ypRajput");
rmSetTriggerEffectParamInt("PlayerID", i);
rmSetTriggerEffectParamInt("Field", 16);
rmSetTriggerEffectParamInt("Delta", -20);

}

// This makes Mahouts -50 wood and -50 food, and Rajputs -20 Wood for all players. I could also add the following:

if ( rmGetPlayerCiv(i) == 21){
rmAddTriggerEffect(“Unforbid and Enable Unit");
rmSetTriggerEffectParam("ProtoUnit", “ypUrumi”);
rmSetTriggerEffectParamInt("PlayerID", i);

}

// If I wanted to Enable Urumi at the Indian Barracks and Galleon. This is a fun change, especially for online games.

If I wanted to enable mercenaries, remember that you must enable both regular and repentant counterparts.


rmAddTriggerEffect(“Unforbid and Enable Unit");
rmSetTriggerEffectParam("ProtoUnit", “MercGreatCannon”);
rmSetTriggerEffectParamInt("PlayerID", i);

// And for Asians:

rmAddTriggerEffect(“Unforbid and Enable Unit");
rmSetTriggerEffectParam("ProtoUnit", “ypRepentantGreatCannon”);
rmSetTriggerEffectParamInt("PlayerID", i);


This is a portion of what I've found out how to do. Please use this knowledge for your maps too!

[This message has been edited by murdilator (edited 03-05-2020 @ 03:00 PM).]

AuthorReplies:
murdilator
Skirmisher
posted 03-06-20 03:54 AM EDT (US)     1 / 1       
Also, don't forget to add
balanceVanilla();

// Text
rmSetStatusText("",0.95);
}


At the end of your code, and place any additional non-balance triggers after

balanceVanilla();

Your triggers here
You must be logged in to post messages.
Please login or register

Hop to:    

Age of Empires III Heaven | HeavenGames