RonG
November 18, 2011, 9:24pm
1
You can tell by the number of topics I’ve posted that I have a long way to go with TADS3. In this one, I would like a person to die (from various means) and then be resurrected if he says yes to a question asking if he would like to be resurrected. The resurrection should put him in a special room and will also subtract points from his score.
Any ideas
RonG
Here’s a way to use a FinishOption object for this.
#charset "us-ascii"
#include <adv3.h>
#include <en_us.h>
versionInfo: GameID
name = 'The Deadly Dungeon'
byline = 'by Anonymous Bard'
version = '1'
;
gameMain: GameMainDef
initialPlayerChar = me
;
me: Actor
vocabWords = 'self'
location = dungeon
;
dungeon: Room 'DUNGEON'
"Monsters lurk in every shadow. You could DIE at any time. "
;
hospital: Room 'HOSPITAL'
"Doctors lurk in every shadow. You could CHECK OUT at any time. "
;
DefineIAction(Die);
DefineIAction(CheckOut);
VerbRule(Die)
'die'
: DieAction
verbPhrase = 'die/dying'
;
VerbRule(CheckOut)
'check' 'out'
: CheckOutAction
verbPhrase = 'check/checking out'
;
modify DieAction
execAction() {
finishGameMsg(ftDeath, [finishOptionResurrect]);
}
;
modify CheckOutAction
execAction() {
gPlayerChar.moveInto(dungeon);
cls();
gPlayerChar.lookAround(true);
}
;
finishOptionResurrect: FinishOption
desc = "PRAY for mercy"
responseKeyword = 'pray'
responseChar = 'p'
doOption() {
cls();
gPlayerChar.moveInto(hospital);
gPlayerChar.lookAround(true);
addToScore(-2, 'dying');
}
;