intfiction.org

The Interactive Fiction Community Forum
It is currently Tue Dec 11, 2018 3:12 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Oct 26, 2018 12:28 am 
Offline

Joined: Tue Jan 24, 2012 7:54 pm
Posts: 8
Location: Victoria, Australia
Hi everyone,

To start off, I want to introduce what I'm trying to create. I though it would be a fun experiment to completely re-create a Pokemon game in Inform 7. Obviously the world building is relatively simple - the tricky bit is building the stat formulas and the AI, but I'm confident!!

Anyway, my first step was to come up with a way to change a template Pokemon (a kind of animal) into any other Pokemon that I want. To do this, I've created an action that adjusts its stats:

Code:
Altering is an out of world action applying to one thing and one number. Understand "alter [pokemon] to [a number]" as altering.
Carry out altering:
   now the Dex of the noun is the number understood;
   now the Name of the noun is the tName corresponding to a tDex of the number understood in the Table of Pokemon Stats;
   now the Base_HP of the noun is the tB_HP corresponding to a tDex of the number understood in the Table of Pokemon Stats;
   now the Base_Atk of the noun is the tB_Atk corresponding to a tDex of the number understood in the Table of Pokemon Stats;
   now the IV_HP of the noun is a random number between 0 and 31;
   now the IV_Atk of the noun is a random number between 0 and 31;
   now the True_Nat of the noun is a random Nature;
   now the Nat_Atk of the noun is the tAtk corresponding to a tNat of the True_Nat of the noun in the Table of Pokemon Natures;
   now the True_HP of the noun is ((((Base_HP * 2) + IV_HP + (EV_HP / 4)) * Level) / 100) + Level + 10;
   now the True_Atk of the noun is ((((((Base_Atk * 2) + IV_Atk + (EV_Atk / 4)) * Level) / 100) + 5) * Nat_Atk) / 10.


(That's stripped back a bit to save space, because the other 4 stats are the same formulas as Atk)

This works absolutely perfectly - I'm able to launch the game and change my template Pokemon into anything I like. The problem is, I don't want this action to be able to be used by the player. Maybe the chances that a player will find and use that action are pretty slim, but I'd like to cover all bases. How do I make it so that I can call this action when I'm writing the story, but the player is unable to perform it when playing the game?

Thanks in advance. :)


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Oct 26, 2018 1:41 am 
Offline
User avatar

Joined: Sun May 21, 2017 4:59 pm
Posts: 301
Location: Michigan
You probably want to check out this: http://inform7.com/learn/man/WI_11_2.html

And make it a phrase instead of making it an action. :)

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


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Oct 26, 2018 1:50 am 
Offline
User avatar

Joined: Sun May 21, 2017 4:59 pm
Posts: 301
Location: Michigan
Taking some more info from here: http://www.ifwiki.org/index.php/Inform_ ... ers/Part_2

I've come up with this example of "To..." that also accepts a number as an argument:

Code:

The cornfield is a room. "A lovely place to watch corn grow.".

The cage is an enterable container in the cornfield. "An obvious trap".

To spring the trap to (mynum - number):
   say "'Sproing!' go the [mynum] hinges and, with a flash of silver, the enormous blades whisk together!";
   end the story.
   
Instead of entering the cage:
   spring the trap to 5.



Example output:

Code:
cornfield
A lovely place to watch corn grow.

An obvious trap

>spring trap to 5
That's not a verb I recognise.

>enter cage
"Sproing!" go the 5 hinges and, with a flash of silver, the enormous blades whisk together!



    *** The End ***


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


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Oct 26, 2018 4:58 am 
Offline

Joined: Tue Jan 24, 2012 7:54 pm
Posts: 8
Location: Victoria, Australia
Thank you so much @howtophil, that's exactly what I'm looking for!


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Oct 26, 2018 10:06 am 
Offline
User avatar

Joined: Sun May 21, 2017 4:59 pm
Posts: 301
Location: Michigan
You're welcome :)

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


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Oct 26, 2018 10:06 am 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5832
A phrase is the simplest solution.

However, just so you know: if you don't write an Understand line for an action, the player will have no way to trigger the action.


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

All times are UTC - 6 hours [ DST ]


Who is online

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