Share this Page URL
Help

Chapter 7. Playing Your Own Games > Make Your IF NPCs Move - Pg. 324

Attack: if (self hasnt general) { give self general; "~The access controller sneers at your ineffectual attack. ~DO THAT AGAIN AND I WILL KILL YOU!~ it threatens."; } deadflag = 1; "The access controller wards off your clumsy assault and grabs you before you can beat a retreat. As it crushes the life out of you, you think, ~Maybe violence wasn't the answer to this one.~"; The general attribute appears again, this time for something entirely different: here it indicates that the access controller's patience has elapsed. You've also used the global variable deadflag , which has a value of 0 as long as the game continues to run; the game ends the moment a statement returns true with deadflag set to any nonzero value. A deadflag set to 1 produces a *** You have died *** ending. Set to 2, the program cheer- fully announces that *** You have won *** . Values above 2 allow for customized sendoffs. Now the character has a little character. It's not quite real yet; it needs to be able to move and communicate. That's the stuff of [Hack #89] and [Hack #90] . Make Your IF NPCs Move Add the gifts of motion and conversation to your characters.