inkle / ink

inkle's open source scripting language for writing interactive narrative.
http://www.inklestudios.com/ink
MIT License
3.97k stars 482 forks source link

[Question] I want to manage the player stat. #892

Open littleSnailSong opened 4 months ago

littleSnailSong commented 4 months ago

Hi! i'm noob indie game developer. i'm using unity(2D) to make text-based game. (with awwwesome ink)

first, I say sorry for my strange English skills.

anyway! in my game, player have several status. like power, health, intelligence...etc.

question is, in the story, if player drink poison tea, how can i down player's health status?

[player drink tea. oops. it's poison.

health -20] << if this line come out, i want to down 20 health point in my player's 100 health point that already defined in c# script. image

i tried but...sorry for my bad english. have a nice day!

Selsynn commented 4 months ago

To integrate gameplay via variable and ink, you have two major solutions. Which one you choose depends of your use case:

1) have Ink be the master of the logic. Technically, that means the "true" variable is staying in ink. The rest of the game is reading the value in ink to know it and act on it.

2) have the master of the logic outside ink. It means you need an external function each time you want to read the variable in ink (that will ask the "true" value).

There is no way that is better or worse than the other, it's mostly depending of what you want your code to do. Points to know:

Let me know if there is a specific point where you need more info, as I just redirect you with an overview and the documentation (there is a ton of things that is possible in ink, you just have to get the keys on how to use it to be able to create neat game.)

littleSnailSong commented 4 months ago

thank you for your kindness. i checked all of your informations! It's sad news, but I haven't solved my problem yet. i will try again. thank you!