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.3 replies
Rise of Nations Heaven » Forums » Scenario Design » Tribute Response Scripting Help
Bottom
Topic Subject:Tribute Response Scripting Help
jimmybda2
Member
posted 01-29-14 09:59 PM EDT (US)         
Hey,

I am trying to create a script where, if anyone sends tribute to a certain computer player, there is a response based on the amount & type of tribute sent. I am a bit rusty with my scripting, and would love some help with this. All I want is for the popup to appear when player 8 is send >= 100 Food; the below script compiles but does not work...

scenario
{
labels {
}
run_once {

enable_trigger("Offer_trg");
}

trigger Offer_trg() {
for (n = 1; n <= 8; n++) {
food_offered = amount_offered(n, 8, "Food");
if (food_offered >= 100) {

popup_dialog("Russia orders full mobilization.");
accept_offer(8, n);

}

else {
}

}}}


Thanks!
AuthorReplies:
Super7700
Member
posted 01-31-14 09:18 PM EDT (US)     1 / 3       
I think the problem is that you are using a trigger without any conditions, so it will run once when you start the script but it won't run again. The trigger should be used for the actual offer, something like this:

scenario
{
labels {
}
run_once {

enable_trigger("Offer_trg");
}

for (n = 1; n <= 8; n++) {
food_offered = amount_offered(n, 8, "Food");
trigger Offer_trg (food_offered >= 100) {

popup_dialog("Russia orders full mobilization.");
accept_offer(8, n);

}

}}}

~ Creator of Kings and Conquerors, a total conversion mod for Rise of Nations: Thrones and Patriots ~

[This message has been edited by Super7700 (edited 01-31-2014 @ 09:19 PM).]

jimmybda2
Member
posted 02-02-14 05:53 AM EDT (US)     2 / 3       
Thanks! You were right! I ended up using the following, but yours is better (with the "for") so I'll implement it.

scenario
{
labels {
}
run_once {
enable_trigger("offer_trg");
}

contact = contact_open();
offered = amount_offered(1, 8, "Food");
trigger offer_trg(contact == 8 && offered >= 100) {

popup_dialog("Offered 100.");
accept_offer(1, 8);
enable_trigger("highlands_trg");
}
}

"Highlands_trg" being a trigger to start an uprising in the highlands or something.

How is progress going on Kings & Conquerors? It looks great.
Super7700
Member
posted 02-02-14 10:01 PM EDT (US)     3 / 3       
Kings and Conquerors is going very well thank you. I am having some issues however with getting some of the scripted features to work properly.

~ Creator of Kings and Conquerors, a total conversion mod for Rise of Nations: Thrones and Patriots ~
You must be logged in to post messages.
Please login or register

Hop to:    

Rise of Nations Heaven | HeavenGames