Ending a scenario

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: Ending a scenario
Warrior
Member # 3905
Profile #0
Ok, so I'm gonna try this editing/scripting-your-own-adventure-thingy.

However I don't want the Warrior's Grove, so I decided to make an own starting town (so far it's just dirt and a few walls). But I still want you to be able to end the scenario by walking out of the starting town (to the north). My question is: how do I do this? I scanned through the editor docs, but I could find no mention of how you'd do this, and it doesn't seem to be implemented in the editor (as with its opposite, the starting location).

It's probably a real stupid question (and dead simple), but I'd appreciate all help I can get anyway...
Posts: 56 | Registered: Tuesday, January 20 2004 08:00
BANNED
Member # 4623
Profile Homepage #1
Don't know the exact script (I suck at coding in general, and am too lazy to really try to learn), but take a look at the town script that comes with the Warrior's Grove.

The scripts that come with the package are a good read for a begginner, I've gathered. :)

--------------------
The Great Mister

kommari@gmail.com[/url]
Posts: 417 | Registered: Sunday, June 27 2004 07:00
Shock Trooper
Member # 4445
Profile #2
Either do what he said, or open up the "t0forttalrus.txt" file in the Valley of Dying Things folder. Look for the states that pertain to leaving the scenario (somewhere around 19, IIRC). When it is checking an SDF, that is to see whether the party won or not. Look in the editor docs appendix. The call you need should be in the "most important calls section."
Posts: 293 | Registered: Saturday, May 29 2004 07:00
Agent
Member # 4506
Profile Homepage #3
Here's the codes:
end_scenario(0); This code means that you leave the scenario, but do not win it.

end_scenario(1); This code means that you end the scenario and win it.

--------------------
"You dare Trifle with Avernum?" ~ Erika the Archmage
--------------------
My Scenarios:
Undead Valley : A small Undead problem, what could possibly go wrong?
--------------------
Richard Black - PROOF of his existance (the Infernal one's website).
--------------------
MY FORUM! Randomosity at it's highest! :)
Posts: 1370 | Registered: Thursday, June 10 2004 07:00
Warrior
Member # 3905
Profile #4
I use the following script at the bottom of my town script:

beginstate 11;
reset_dialog();
add_dialog_str(0,"Do you wish to leave the scenario already?",0);
add_dialog_choice(0,"Keep Fighting");
add_dialog_choice(1,"Chicken Out");
choice = run_dialog(1);
if (choice == 1)
end();
if (choice == 2)
set_state_continue(12);
break;

beginstate 12;
end_scenario(0);
break;
This I more or less stole from Warrior's Grove. In town details I make exiting to the north call special state 11. However, when I run the scenario and enter the town (executing the town script) it says something about "unknown command choice". What have I missed?
Posts: 56 | Registered: Tuesday, January 20 2004 08:00
...b10010b...
Member # 869
Profile Homepage #5
Sounds like you forgot to define choice as a variable.
Posts: 9973 | Registered: Saturday, March 30 2002 08:00
Infiltrator
Member # 4637
Profile Homepage #6
quote:
Originally written by Dyng:

beginstate 11;
reset_dialog();
add_dialog_str(0,"Do you wish to leave the scenario already?",0);
add_dialog_choice(0,"Keep Fighting");
add_dialog_choice(1,"Chicken Out");
choice = run_dialog(1);
if (choice == 1)
end();
if (choice == 2)
set_state_continue(12);
break;

beginstate 12;
end_scenario(0);
break;

I didn't start reading about scripting, so I might be saying no-sense, but I noticed the following in your script:

You give two choices (0 and 1)
The "if choice" part refers to choices 1 and 2, instead of 0 and 1...

It's just a mater of logic but, as I said, I know no scripting. So I'll let someone who knows to tell you. :)

edit: I checked the VotDT script for fort talrus, and it's just like you have there, so i'm wrong... hummm...

[ Saturday, July 10, 2004 04:27: Message edited by: Overwhelming ]

--------------------
Visit the Blades of Avernum Center
and the Beta Testing Center

--------------
"Beware lest anyone cheat you through philosophy and empty deceit, according to the tradition of men, according to the basic principles of the world, and not according to Christ." Colossians 2:6-9
Posts: 483 | Registered: Tuesday, June 29 2004 07:00
Agent
Member # 4506
Profile Homepage #7
With langyages like this, 0 = 1, 1 = 2, 2 = 3, etc.

So basically Choice 0 means Choice 1,

And Choice 1 means Choice 2.

Understand?

- Magic and Technology are NOT a good mix

--------------------
"You dare Trifle with Avernum?" ~ Erika the Archmage
--------------------
My Scenarios:
Undead Valley : A small Undead problem, what could possibly go wrong?
--------------------
Richard Black - PROOF of his existance (the Infernal one's website).
--------------------
MY FORUM! Randomosity at it's highest! :)
Posts: 1370 | Registered: Thursday, June 10 2004 07:00
Warrior
Member # 3905
Profile #8
quote:
Originally written by Thuryl:

Sounds like you forgot to define choice as a variable.
=D

Yup! That's very likely it.

Thanks. (I'm feeling pretty stupid right now...)
Posts: 56 | Registered: Tuesday, January 20 2004 08:00
Warrior
Member # 286
Profile #9
Overwhelming - Yeah, the numbering when you set up the buttons starts at 0, but the value you get back starts at 1. Jeff admits that was a pretty stupid thing for him to do; it was basically a rather large oversight. :P

--------------------
Z: "I just feel so insignificant."
Psych: "You ARE. You're an ANT."
--Antz
Posts: 104 | Registered: Saturday, November 17 2001 08:00
Off With Their Heads
Member # 4045
Profile Homepage #10
Archimage Micael (which is not much of an improvement over "archmagi," by the way -- there's no I in archmage), I know what you're trying say and even I had trouble understanding what you're saying.

Long story short, Overwhelming, the code is right. Choosing dialog choice 0 makes run_dialog return 1, and choosing dialog choice 1 makes run_dialog return 2, and choosing dialog choice 2 makes run_dialog return 3. It's weird, but that's how it works.

EDIT: Posted at the same time as Flamefiend.

[ Saturday, July 10, 2004 17:15: Message edited by: Just Call Me Kel ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Warrior
Member # 4202
Profile Homepage #11
quote:
Originally written by Just Call Me Kel:

Archimage Micael (which is not much of an improvement over "archmagi," by the way -- there's no I in archmage)
My dictionary includes "Archimage" but not "Archmage". "Archimage" is quite correct; however, considering the way Spiderweb Software spells it, "Archmage" would be a better choice. Not that it matters. :P

--------------------
Creator of the 3D Blades of Avernum Editor for Mac. Get it at Ingenious Isaac's Illusion, my web page. Better yet, get Battle for Wesnoth, a wonderful free TBS game.
Posts: 192 | Registered: Sunday, April 4 2004 08:00
Warrior
Member # 3905
Profile #12
Ok, follow-up question.

That neat piece of script works just fine (I just forgot to declare the variable 'choice', I got too happy cutting and pasting), and I'm starting to get the hang of dialogue scripts. But now I've noticed that if I exit the town in qustion to the north (thus executing the end-scenario question-dialog-thingy) and choose not to exit the scenario the party really exits the town to the north. I don't want this to happen since this places the party outside my map. How do I correct this?
That is: I want the party to stay in town should they choose to continue the scenario, thus making it impossible to exit the town to the north...

Any ideas or suggestions?
Posts: 56 | Registered: Tuesday, January 20 2004 08:00
Warrior
Member # 4202
Profile Homepage #13
block_entry(1);

--------------------
Creator of the 3D Blades of Avernum Editor for Mac. Get it at Ingenious Isaac's Illusion, my web page. Better yet, get Battle for Wesnoth, a wonderful free TBS game.
Posts: 192 | Registered: Sunday, April 4 2004 08:00
Warrior
Member # 3905
Profile #14
Where in the script does that go exactly?
Posts: 56 | Registered: Tuesday, January 20 2004 08:00
Off With Their Heads
Member # 4045
Profile Homepage #15
Right before the end call. So...

if (choice == 1)
block_entry(1);
end();


--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Warrior
Member # 286
Profile #16
Not quite right, Kelandon. :) If you have more than one statement in your if(), then you need braces around them, like so:

if (choice == 1) {
block_entry(1);
end();
}


--------------------
Z: "I just feel so insignificant."
Psych: "You ARE. You're an ANT."
--Antz
Posts: 104 | Registered: Saturday, November 17 2001 08:00
Off With Their Heads
Member # 4045
Profile Homepage #17
My bad. Honestly, I was thinking:

if (choice == 1)
block_entry(1);
and just delete the end call entirely. It doesn't really make that much of a difference.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00