intfiction.org

The Interactive Fiction Community Forum
It is currently Fri Apr 20, 2018 7:22 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 5 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: 2436
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.

_________________
http://hanonondricek.wixsite.com/pyramidif
https://pyramidif.itch.io


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: 105
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  
PostPosted: Mon Apr 16, 2018 7:00 pm 
Offline

Joined: Sat Apr 14, 2018 9:26 pm
Posts: 3
Following the 'removing the Gladiator from play' option: an alternative can be to say something like:
Code:
The Gladiator can be alive or dead. The Gladiator is alive.
After attacking the Gladiator:
    say "You stab the gladiator in the gut. He bellows in agony, then falls back, dead.";
    now the Gladiator is dead.


Then any checks regarding whether or not the Gladiator has been defeated can hinge on whether or not the Gladiator is dead. However, I wouldn't recommend this unless you plan on implementing death and dying and combat regularly throughout the game.

If it's just one puzzle, you're likely better off using the remove-from-play method suggested above, and then adding a corpse as a separate object if needed, moving it to the location immediately after the Gladiator dies.

_________________
Spoiler: show
hi there


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Apr 16, 2018 8:05 pm 
Online
User avatar

Joined: Sun May 21, 2017 4:59 pm
Posts: 143
Location: Michigan
I block the character in various ways in "Getting To Work And Other Bullshit." I pretty much use an if inside of a "Instead of going <direction> when <the NPC> is visible" type of thing.

Here's the crawling skeleton section of my game. You have to give him cigarettes, then he "is smoking" and you can then go west.

Code:
Part 3 - The Crawling Skeleton

sidewalk_4 is north of sidewalk_3. It is traffic_west. It is in the Outdoors Area.
      The printed name is "The sidewalk".
   The description is "[one of]If there were any more crack in this sidewalk, it'd be above the belt of a plumber![or]It's a shame that there aren't more dirt paths to walk along.[cycling]
   
   There's a crosswalk to the west.".
   The Crawling Skeleton is here. It is a person. It is not smoking. "Whoah! An animated skeleton is slowly, so, so, so slowly crawling towards you. It's front teeth are stained a bright yellow, but the rest is sun-bleached white.". The description is "A very slowly crawling skeleton. It seems to be trying to say something, but coughs every time.[paragraph break][italic type]Wait. Coughs? Lungs much?[roman type]".
   Instead of giving cigarette butts to Crawling Skeleton:
      move cigarette butts to skeleton;
      now Crawling Skeleton is smoking;
      say "The Skeleton stops crawling and reaches out a bony hand to snatch away the cigarette butts. It leans its frail looking body against the eastern fence and starts puffing away. The cigarette is lit and smoke is curling into his rib cage, but you know there are no lungs and he doesn't seem to have a lighter, so you can't imagine how what you're seeing is actually working...[paragraph break]'Thanks, brother, I needed this,' he says, looking at you with his empty eye sockets.[paragraph break]You tell him it's no problem and hope this is the last of the weirdness you run into on your way to work.";
      now the description of the Crawling Skeleton is "The Skeleton is propped up against the eastern fence, puffing on a cigarette butt. You still can't figure out how it does that without lungs.";
   Instead of going west when the Crawling Skeleton is visible:
      if Crawling Skeleton is not smoking begin;
         say "You try to step over the skeleton, but its bony hand snatches your ankle and he tosses you back a few steps.";
      else;
         say "The Skeleton is propped up against a fence, somehow smoking a cigarette butt. You're not sure how, without lungs and without a lighter anywhere in sight, but you shrug and go on your way trying not to think too hard about it.
         
         The Skeleton says, 'Thanks for the smokes, brother. I needed this to stop the morning cough.'";
         continue the action;
      end if;

_________________
~~~
My ebooks on Amazon
My ebooks on Smashwords


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

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 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