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

Scenario Design
Moderated by alincarpetman

Hop to:    
Welcome! You are not logged in. Please Login or Register.No replies
Rise of Nations Heaven » Forums » Scenario Design » Scripting Trouble Help
Bottom
Topic Subject:Scripting Trouble Help
cedp
Member
posted 06-18-19 11:37 AM EDT (US)         
Hi everyone! I'm new here and I'd like to ask regarding an issue in scripting. This is part of the script I wrote for a scenario based on the Battle of Leyte Gulf:

trigger CounterattackSetup (city_captured(2,"Tacloban"))
{
set_timer("CA1",1);
set_timer("CA2",110);
set_timer("CA3",180);
enable_trigger("JapaneseCounterattack1");
enable_trigger("JapaneseCounterattack2");
}
trigger JapaneseCounterattack1(timer_expired("CA1"))
{
clear_group(2);
show_notice($S("The IJA has launched a counterattack on Tacloban!"), "capital_notice", 1);
create_unit_in_group(2,123,77, "Infantry",3);
create_unit_in_group(2,123,77, "Tank",1);
create_unit_in_group(2,123,77, "Armored Scout Car",1);
create_unit_in_group(2,123,77, "Bazooka",2);
create_unit_in_group(2,123,77, "Howitzer",1);
create_unit_in_group(2,123,77, "Supply Wagon",1);
city_id = find_city_id("Tacloban");
x = object_position_x(1, city_id);
y = object_position_y(1, city_id);
group_attack_to_order(2, x, y);
if(num_in_group(2)<3){
popup_dialog($S("We have beaten back the Japanese counterattack!"));
}

what I intended to happen was that the newly created group of Japanese troops would attack after the timer expired, and then a popup dialog shows up to indicate that the attack has been beaten. Additionally I was going to add a script wherein they would scatter in all directions after the attack was repelled. A reference to this would be the Darius mission in the Alexander CTW campaign or MeatPuppet's Stalingrad Part Two scenario. I was just testing if the dialog would work and then i would add a trigger that would script the move order. However I can't seem to get the dialog to show up at the right time. It either fails to show up when the number of units drops below 3, or it shows up at the very beginning when the group is still complete. I'd just like to add that there is nothing wrong with the syntax or anything as it reads script compiled successfully. I just can't seem to get it to work right. Thanks in advance!

[This message has been edited by cedp (edited 06-18-2019 @ 11:38 AM).]

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

Hop to:    

Rise of Nations Heaven | HeavenGames