intfiction.org

The Interactive Fiction Community Forum
It is currently Mon May 20, 2013 4:25 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Random in certain rooms
PostPosted: Sat Jul 07, 2012 5:47 pm 
Offline
User avatar

Joined: Fri Jul 15, 2011 2:46 pm
Posts: 230
Location: Cental Ohio
In my game I want the player to be able to do a certain action in, well, lets say all the outdoor rooms, and have a random chance, let's say 50%, of finding a fairly common object that's not important to the game per se, that I'll give a random name to.

From a previous discussion about monsters I have an idea how to do the part with the actual object, but I am trying to decide how to approach the random whether they can look in x room or not. I also want to prevent the player from getting such an object more than once in the same room, so there's not like an infinite number of objects, etc.

Ideas?

_________________
David Good
http://david-good.com/portfolio/interactive-fiction/
http://www.facebook.com/duodave


Top
 Profile Send private message  
 
PostPosted: Sat Jul 07, 2012 6:18 pm 
Offline
User avatar

Joined: Sat May 08, 2010 9:25 pm
Posts: 958
Location: The Seattle Massive
I think you already defined a searching-the-room action, yes? If so, here's a quick and dirty version:

Code:
A room can be searched or unsearched.  A room is usually unsearched.

Instead of searching in the Outdoors:
if the location is unsearched and a random chance of 1 in 2 succeeds begin;
say "You find [if there is a searched room]another[otherwise]an[end if] iridescent purple wotsit.";
now the location is searched;
otherwise;
say "Your search turns up nothing in particular.";
end if;



Top
 Profile Send private message  
 
PostPosted: Sat Jul 07, 2012 6:26 pm 
Offline
User avatar

Joined: Fri Jul 15, 2011 2:46 pm
Posts: 230
Location: Cental Ohio
maga wrote:
I think you already defined a searching-the-room action, yes? If so, here's a quick and dirty version:

Code:
A room can be searched or unsearched.  A room is usually unsearched.

Instead of searching in the Outdoors:
if the location is unsearched and a random chance of 1 in 2 succeeds begin;
say "You find [if there is a searched room]another[otherwise]an[end if] iridescent purple wotsit.";
now the location is searched;
otherwise;
say "Your search turns up nothing in particular.";
end if;



Oh thanks. Sometimes I get an idea and I just need a nudge in the right direction.

_________________
David Good
http://david-good.com/portfolio/interactive-fiction/
http://www.facebook.com/duodave


Top
 Profile Send private message  
 
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: Google [Bot] 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