DEV DIARY#2: Battle System

After some snooping around I finally found a code that allows for a random action every time a twine passage loads.

<<set $dice to random(0,1)>>\
<<if $dice is 0>><<set $health -=25>>You have been ATTACKED!<</if>>
<<if $dice is 1>>Moose!<</if>>

Using this code, I can make an enemy randomly use an attack and take away from the players health. Not just one attack either, I can create a list of attacks with different damage to be used at random.

In a weird way this has created a sort of AI function with twine. The battles will be more genuine like an actual video game. Depending on what the enemy does at random, will determine the players course of action. It will be turn based as well. So when enemy attacks (or doesn’t) what will the player do? Attack? Use a healing item?  ect.

This code makes battle within twine possible which is exciting because I almost abandoned the idea. Before this discovery I was going to have one battle per episode, since I would literally have to create a series of passages for every possible scenario or action that the player would choose. That would have been WAYYYYYY to much work. Below is a sample of the code in action.

TRY THE SAMPLE HERE

SDF

 

Advertisements

About Dark Forest Media

Production Company Dealing in Multi Media Projects
This entry was posted in Developer Diary, Video Game and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s