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.1 reply
Rise of Nations Heaven » Forums » Scenario Design » script help
Bottom
Topic Subject:script help
tetah
Member
posted 10-19-16 05:19 AM EDT (US)         
i got a 2 problems on this script when i compile
the first is in the line : if(choice==1){
and the second in the last line : }
who can help
here is my script :

scenario
{

labels {
//Add any constant labels here in a comma separated list.
}

run_once {
//Insert commands that should be executed only once when the script is loaded here.
popup_dialog("The americans are lost, help them find a way!");
if (any_object_near_build(1,1,3,137,5)){
objective_complete("move");
popup_choice("the Japanese are in war with other americans, you can't go! do you want to ally?","yes","no");
if(choice==1){
popup_dialog("i'm happy to hear it, the Americans are north of here but watch out for there army!, i help you!");
declare_war(2,1);
switch_teams(1,3,2016);
switch_teams(1,3,36);
switch_teams(1,3,24);
switch_teams(1,3,2015);
}
else {
popup_dialog("i am sorry to hear ... ATTACK THEM!");
declare_war(3, 1);
make_alliance(1, 2);
create_unit(1,167,184,"Assault Marines", 10);
create_unit(1,167,184,"Advanced Machine Gun", 10);


}

//Main script body.
//Add triggers and other commands to be executed each game frame here.
//Use Edit->Insert Trigger Function to select from the list of available functions
//Use Edit->Insert Trigger Block to add a blank trigger block.
//See ./scenario/sample_script.bhs for additional documentation

}
AuthorReplies:
MrMew
Huskarl
posted 09-24-17 02:02 AM EDT (US)     1 / 1       
There is a } missing at the end, as for choice it is not a declared variable.

You would have to declare it as something line:

int choice;

before the main body. Then later you would need to do:

choice=popup_dialog("The americans are lost, help them find a way!");

as the popup will assign a 1 for yes to choice or 0 for no to choice.

By now I guess you've figured out your problem, but hey maybe someone will find this useful.

Time of Tea
Still in the Dark Age
Don't be a melodramatic clown. ~Mr Wednesday
You must be logged in to post messages.
Please login or register

Hop to:    

Rise of Nations Heaven | HeavenGames