intfiction.org

The Interactive Fiction Community Forum
It is currently Sun Nov 19, 2017 10:54 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Oct 16, 2017 8:15 pm 
Offline

Joined: Mon Oct 16, 2017 8:07 pm
Posts: 1
I'm new to Inform (specifically playfic.com) and I have a coding question. I can't find a way to make it so the player is unable to leave the room they are in until they kill a non-player entity. And the phrase: end game in victory does not seem to work. :( Could someone help me please.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Oct 16, 2017 8:36 pm 
Offline

Joined: Tue Nov 08, 2011 8:11 am
Posts: 2228
Location: US - Central
There are a lot of different ways to do this. One way is to use a check rule to see if the NPC exists.
Code:
Before going when the location is Roman Arena:
     if the location of Gladiator is Roman Arena:
          say "The Gladiator prevents you from escaping!" instead.


This then hinges on removing the Gladiator from play when conditions are met:

Code:
After attacking Gladiator:
     say "You stab the Gladiator. 'Oof! My spleen!' he hollers, disappearing in a puff of green smoke.";
     now Gladiator is off-stage.

"Off-stage" is a special location where things go before they are put into a location, and moving something there prevents the player from encountering it.

There are other methods of doing this, but this is a simple one.

NOTE: The "attacking" action is blocked by default. You can allow it conditionally with the line:

Code:
The block attacking rule does nothing when the noun is the Gladiator.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Oct 16, 2017 10:13 pm 
Offline

Joined: Fri May 31, 2013 3:54 pm
Posts: 100
DimensionWieldr wrote:
And the phrase: end game in victory does not seem to work. :(
"end the game in victory" no longer works; this post explains why this was changed. You want some variant of "end the story", e.g.:
Code:
After going to the Deadly Dungeon:
   end the story finally saying "You have won".
(See ยง9.4 in the manual.)


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group