Page 6 of 6

Re: Empire Earth 2 Map making - MP - .ies Scripting

Posted: 28 Apr 2018, 20:19
by Loewenherz
Its is possible to script a missile attack in a scenario?

Re: Empire Earth 2 Map making - MP - .ies Scripting

Posted: 28 Apr 2018, 20:50
by Dr.MonaLisa
It is possible only if you manage to produce ICBMs in Missile Siloses.
I remember TheGrouchDE has done it by giving resources to AI player and used custom APIs scripts. So it's not that simple.

Re: Empire Earth 2 Map making - MP - .ies Scripting

Posted: 29 Apr 2018, 07:49
by TheGrouchDE
Hey Loewenherz,

it indeed is possible to make a scripted nuke attack. The thing you have to do is, you create a .aip file in which you make the AI build the ICBM and/or MGMNukes. That looks around like this:

Code: Select all

// hopefully this is temporary, but you need more resources in the late epochs,
//		so you need more citizens
int maxAutobuildCitizens = 65;

// trying to build ALL units is not effective in the late epochs, there's just too many options
//	this AIP will focus on tanks, with a few infantry and airplanes thrown in


// Auto-outpost/fortressing params
//		we look for threatening areas this close to friendly bases (by friendly base
//		grassfire dist map scale) - set to -1 to not auto-outpost
float autoOutpostDistThreshold = 4.0f;


// cannot have more than 7 air defense per territory at the moment
// LightArtillery2 is a AA tank

BuildListElement baseList[] = 
{
// (name), (priority), (hints), (block?), (min desired count), (max desired count), (max build count)
//
};


BuildListElement troopList[] = 
{
// (name), (priority), (hints), (block?), (min desired count), (max desired count), (max build count)
//

//EmptyPlaceForUnit(scud)29.07.2014
//EmptyPlaceForUnit(v2)29.07.2014
//EmptyPlaceForUnit(mam)29.07.2014

"ICBM",		0.1,	DEFAULT,	YES,	8,	8,	60,
"MGMNuke",		0.11,	DEFAULT,	YES,	4,	4,	60,
};


BuildListElement newCityBaseList[] = 
{
// (name), (priority), (hints), (block?), (min desired count), (max desired count), (max build count)
//
};

BuildListElement newCityTroopList[] = 
{
// (name), (priority), (hints), (block?), (min desired count), (max desired count), (max build count)
//

}
The best is, you set an AI_Buildfactor with 0.01 for the AI so he can build them instantly. Or you Otherwise it might happen, that he tries to attack with a silo, that is not filled. Now i don't know exactly, either this will just cause to ignore these or in worst case - cause a debug screen. Additionally you need to set script names for the Missile Silo's and the ICBM you placed for the AI. Only thing left then is to make the Missile Silo's/ICBM's attack. If you want to attack a specific building you just select them with SelectUnit("Scriptname") and then AttackWithSelection("Scriptnameoftargetunit"). Now im not sure, but theoretically if you want them to attack just a area you might can make them attack these too. I think i did that with one of my scenario's too.

Re: Empire Earth 2 Map making - MP - .ies Scripting

Posted: 29 Apr 2018, 19:42
by Loewenherz
Hi TheGrouchDE and Dr. MonaLisa. Thanks for your helpfull answers. :D
I will test that for me in the boston mission. It seems that the aip file is a valuable addition for specific script situations. I will look precisely in this files.
What the Missile Silo's/ICBM's attack is concerned, i wanted it first, to script that with the "AddAirMissionWayPointArea" action.

The guys from Mad Doc have create for ervery Player in EE 2 Missions a own aip file. It seems for good reason. :?:

Re: Empire Earth 2 Map making - MP - .ies Scripting

Posted: 01 Aug 2018, 14:32
by Loewenherz
Hi, here is a little gimmick from me. That function counts the time, and is in contrast to "PERIODICITY" variabele and can be changed.

Code: Select all

////////////////////////////////////////////////////////////
// INITIALIZATION 
////////////////////////////////////////////////////////////
INITIALIZATION
	iEveryMinute = 61;
	MISSIONTIMER_TEXT = "tx_enum_eTeam_0";

  bEveryMinute = false; //start this out false
  bDumpSemaphore2 = false;
  bDumpSemaphore3 = false;

END_INITIALIZATION



RULE ruleCountTime 
  if (true)
    then actionCountTime
END_RULE

ACTION actionCountTime
  SCRIPT WORLD

if (!bDumpSemaphore2)
	{
	tMissiontTimerCountTime = NewMissionTimer(MISSIONTIMER_TEXT ,Foo);
	SetMissionTimer(tMissiontimerCountTime, iEveryMinute); 
	StartMissionTimer(tMissiontimerCountTime); 
	bDumpSemaphore2 = true;
	bDumpSemaphore3 = true;
	}
	 if(bDumpSemaphore3){
  GetEveryMinute = GetMissionTimer(tMissiontimerCountTime);
	     if (IsMissionTimerExpired(tMissiontimerCountTime))
	{
	iEveryMinute = 60;
	SetMissionTimer(tMissiontimerCountTime, iEveryMinute);
	bEveryMinute = true;
	}
	}
	
  END_SCRIPT
END_ACTION

Multiple choice for story options in Scenarios

Posted: 11 Jan 2019, 13:10
by Loewenherz
Another Idea. This script count the click on the chat console and triggers than a action. So there is a alternative to the not working chat trigger "HasTextBeenTyped". In this case you click with the mouse 3x on text input window and 1x mal on the "Allierte" button from the chat console and select a City center. That triggers a event. But make it not to complicated. I think, that is the best option to communicate with the player over the script system and create dynamic situations.

Example. You storm with your army a castle. Now will the commander negotiate with you. In this situation can you rob the castle, she destroyed, or conquer. For every choice can you give the player via widget selection a option.
EE2_ScreenShot3.jpg
EE2_ScreenShot3.jpg (688.79 KiB) Viewed 300 times

Code: Select all

RULE testwidget ONESHOT
  if ( GetWidgetSelectionCount("chat_input_textfield") >= 3 
  && GetWidgetSelectionCount("chat_input_radio_allies") >= 1
  && IsUnitSelectedUI("CityCenterSelectet")
				)
		then actiontestwidget
END_RULE
ACTION actiontestwidget
SCRIPT WORLD

	FlashWidgetForTime("chat_input_glass", 5);
	DoDelay( 2.0 );
	STEP
	DebugOutputString( "Seems to Work!" ); //strictly for testing
	PrintMessage( "Seems to Work and you win!" ); //this does work, even though these strings are normally localized in a .utf8 file in the db/ directory.

DoDelay( 10.0 );
STEP

	WinScenario();

END_SCRIPT
END_ACTION

Re: Empire Earth 2 Map making - MP - .ies Scripting

Posted: 11 Jan 2019, 18:56
by Dr.MonaLisa
Nice, but I would add a possible re-activation using some extra "int", then the RULE wouldn't need to be ONESHOT.

For example:
int Now = -1;
int Old = 0;
In RULE or ACTION:
Now = GetWidgetSelectionCount("chat_input_textfield");
if (Now >= (Old + 3)){
if(IsUnitSelectedUI("CityCenterSelectet")){
Old = Now;
//Do other things
}
}

Of course it wasn't tested, but you get the idea.

Re: Empire Earth 2 Map making - MP - .ies Scripting

Posted: 11 Jan 2019, 20:05
by Loewenherz
I agree with you. The best it to re-activation such rules. Maybe is the widget selection trick interessting for a multiplayer scenario... :mrgreen:

Interparse EE2 Scripting - Switch, lock and unlock gates.

Posted: 12 Jan 2019, 11:07
by Loewenherz
And here is another trick. So you can, switch, lock and unlock gates.

Code: Select all

RULE testGates ONESHOT
  if ( GetWidgetSelectionCount("chat_input_textfield") >= 1 
				)
		then actiontestGates
END_RULE
ACTION actiontestGates
SCRIPT WORLD
 
	FlashWidgetForTime("chat_input", 5);
	DoDelay( 1.0 );
	STEP
	DebugOutputString( "Seems to Work!" ); //strictly for testing
	PrintMessage( "Seems to Work and you win!" ); //this does work, even though these strings are normally localized in a .utf8 file in the db/ directory.

DoDelay( 1.0 );
STEP

CreateNamedUnitInArea(HUMAN_PLAYER, "Wall_Gate", "Gate1", false, "Area1");
DoDelay (2.0);
STEP
SelectUnit("Gate1");
RemoveSelection();
SetUnitPlacementAngle(65.0); //Dont work
CreateNamedUnitInArea(LARRY_PLAYER, "Wall_Gate", "Gate1", false, "Area1");
END_SCRIPT
END_ACTION
Make a trigger, that no enemy units are on this location, so that the gate are not switch to a wrong place.


EE2_ScreenShot0.jpg
EE2_ScreenShot0.jpg (436.68 KiB) Viewed 302 times
EE2_ScreenShot1.jpg
EE2_ScreenShot1.jpg (406.19 KiB) Viewed 302 times
EE2_ScreenShot2.jpg
EE2_ScreenShot2.jpg (405.93 KiB) Viewed 302 times