learning inform 7

#1

im trying to make this game but it i dont understand how to do this part. i want to have a vest that would protect you if you were to go somewhere like a shooting range so how do i program it so that if you have the vest when you enter this room, you dont die and if you enter without a vest you die?

0 Likes

(Hanon Ondricek) #2

The simplest form of this without taking anything else into consideration:

Every turn when the location is Shooting Range: if the player does not wear the bulletproof vest: end the story saying "A stray bullet ricochets off concrete, lodging directly in your spleen. You should have paid attention to those warning signs outside!";

0 Likes

#3

Or if you only want them to die if they enter the room without the vest (but don’t care if they take it off once inside the room):

Hall is a room. The description is "A rather bland hallway".

The bulletproof vest is a wearable thing in Hall.

Shooting Range is north of Hall. The description is "A place of tortured bullets. A bullet hell.".
		
After going to Shooting Range:
	if the player does not wear the bulletproof vest:
		end the story saying "A stray bullet ricochets off concrete, lodging directly in your spleen. You should have paid attention to those warning signs outside!";
	continue the action.

Example output in which I get/put on the vest, enter the shooting range, take off the vest in the range (to show it only triggers the bullet when I enter without the vest, not if I take it off inside), and then exit and enter again to catch a stray bullet and die:

Hall
A rather bland hallway

You can see a bulletproof vest here.

>don vest
(first taking the bulletproof vest)
You put on the bulletproof vest.

>n

Shooting Range
A place of tortured bullets. A bullet hell.

>take off vest
You take off the bulletproof vest.

>s

Hall
A rather bland hallway

>n


    *** A stray bullet ricochets off concrete, lodging directly in your spleen. You should have paid attention to those warning signs outside! ***
0 Likes

#4

Thank You!!!

0 Likes