Improvments to Combat Engine

0 votes
asked Aug 8 by The Hellfox (310 points)

Pretty sure I based my combat system off of this post on reddit

I have done a lot of work modifying this and am still looking for ways to enhance it further. Currently I am looking at ways to give enemies different actions and unique special moves, miss/dodge chances, critical hits, and possibly party mechanics. I realize this is a lot of work and atm I only have an idea for enemy actions. I was going to alter the setter links in the "You" passage to set $turn to a random number from 1-6 and then have those correspond with different actions. I will take whatever suggestions you can offer so take a look at what I have built and let me know what you think. I want to make this a comprehensive battle system and it looks like I am getting closer and closer to it working out.

STORY INIT

/*Player Character*/
<<set $player to {
	name: "Hiro", 
	MVIT: 0,
	VIT: 0,
	STR: 8,
	DEX: 8,
	CON: 8,
	INT: 8,
	WIS: 8,
	CHA: 8,
	} >>

/*Health*/
<<set $player.MVIT to Character.mod($player.CON) + 100>>
<<set $player.VIT to $player.MVIT>>

/*Weapons*/
<<set $weapon to {
	name: "",
	DMGmod: 0,
	ATK: "",
	} >>

<<set $Fists to {
	name: "Fists",
	DMGmod: 0,
	ATK: "You punch the $monster.name,",
	} >>
	
<<set $IronBroadsword to {
	name: "Iron Broadsword",
	DMGmod: 3,
	ATK: "You strike the $monster.name with your blade,",
	}>>
	
/*Spells*/
<<set $spell to {
	name: "",
	DMGmod: 0,
	ATK: ""
	}>>
	
	<<set $Firebolt to {
	name: "Firebolt",
	DMGmod: 5,
	ATK: "You blast the $monster.name away with a bolt of flame,",
	}>>
	

/*Combat*/
<<set $turn = 0>>
<<set $log = "you">>

/*Monsters*/
<<set $monster to {
	name: "",
	MVIT: 0,
	VIT: 0,
	STR: 0,
	DEX: 0,
	WIS: 0,
	FRT: 0,
	CHA: 0,} >>

<<set $goblin to {
	name: "Goblin",
	MVIT: 30,
	VIT: 30,
	STR: 13,
	DEX: 13,
	WIS: 13,
	FRT: 13,
	CHA: 13,} >>

<<goto "Ready">>

READY

<<set $test to random(1, 6)>>

<<print $test>>

[[Fight Goblin|Combat][$monster to $goblin, $weapon to $Fists, $spell to $Firebolt]]
[[Stats|Point Buy]]

COMBAT

<<include "Enemy">> <<include "Log">> <<include "You">>

ENEMY

-----
<<print $monster.name>>
VIT: <<print $monster.VIT>> / <<print $monster.MVIT>>
-----

YOU

<<if $turn == 0>>
[[Punch|Combat][$monster.VIT -= $Fists.DMGmod + Character.mod($player.STR), $atkdmg to $Fists.DMGmod + Character.mod($player.STR), $turn to random(1, 6), $log to "weaponAtk"]] 

[[Sword|Combat][$weapon to $IronBroadsword, $monster.VIT -= $IronBroadsword.DMGmod + Character.mod($player.STR), $atkdmg to $IronBroadsword.DMGmod + Character.mod($player.STR), $turn to $turn to random(1, 6), $log to "weaponAtk"]]

[[Firebolt|Combat][$spell to $Firebolt, $monster.VIT -= $Firebolt.DMGmod + Character.mod($player.WIS), $atkdmg to $Firebolt.DMGmod + Character.mod($player.WIS), $turn to $turn to random(1, 6), $log to "spellAtk"]]

<<elseif $turn == 1>>
[[Continue|Combat][$log to "enemyAtk", $turn to 0, $player.VIT -= $monster.STR]]
<</if>>

<<if $player.VIT lt 1>>
<<goto "Lose">>
<</if>>

<<if $monster.VIT lt 1>>
<<goto "Win">>
<</if>>

LOG

<<if $log == "you">>
It is your turn!
<<elseif $log == "weaponAtk">>
<<print $weapon.ATK>> dealing <<print $atkdmg>> points of damage!
<<elseif $log == "spellAtk">>
<<print $spell.ATK>> dealing <<print $atkdmg>> points of damage!
<<elseif $log == "enemyAtk">>
The <<print $monster.name>> attacks!
<</if>>

 

2 Answers

0 votes
answered Aug 8 by The Hellfox (310 points)
If you need me to post the other passages as well I can.
commented Aug 10 by HiEv (11,760 points)

FYI - You probably won't get much help here because this is more of a "game design" question, than a coding question.  How you want to design your game is up to you, and depends on a lot of other information before others could suggest things.

You'd probably be better off asking this in a game design forum of some sort with more information about the game itself.

Good luck! smiley

+2 votes
answered Aug 10 by idling (10,670 points)

If you have any particular questions or problems you are struggling with, feel free to ask, but otherwise there is little anybody can do to help you without knowing your exact goals. Only thing I can see from what you have is that you are not utilizing widgets enough and seem to be substituting passages for them. Maybe look into them and what they acan do for you here.

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...