A combat system for Squiffy

Hello!

I've been putting together this combat simulator for my Squiffy game. Its graphically basic, but I've built it so that you can modify each specific combat with enemy names, skills etc.

With this system you can fight 1-3 enemies at the same time. It takes into consideration:

*Choise of weapon (will impact dexterity and damage)
*Armor (will impact armorsoak and dexterity)
*Dexterity skill (for chance to dodge attacks)
*Weapon skill (for chance to hit enemy)

You're able to modify each enemy alone so that you can, for instance, have a boss fighting together with henchmen. Or two heavy machinegunners fighting together with a dodgy ninja etc

I would love some input on code crunching, bugs, suggestions etc!

[[Intro]]:

@set weaponskill = 90
@set dex = 45
@set alive
@set health = 80

You are Brian, a thug working for a crime syndicate.


Choose your main weapon.

<li>[Handgun] - Medium damage, no negative dexterity impact</li>
<li>[Heavy pistol] - Medium/high damamge, very small impact on dexterity</li>
<li>[Shotgun] - High damage, lowers dexterity</li>
<li>[Automatic rifle] - Very high damage, greatly lowers dexterity</li>


[Handgun]:

@set my_weapon = handgun

You chose a handgun.

Now, [choose armor](Armorchoise)

[Heavy pistol]:

@set my_weapon = heavy pistol

You chose a heavy pistol.

Now, [choose armor](Armorchoise)

[Shotgun]:

@set my_weapon = shotgun

You chose the shotgun.

Now, [choose armor](Armorchoise)

[Automatic rifle]:

@set my_weapon = automatic rifle

You chose the automatic rifle.

Now, [choose armor](Armorchoise)

[Armorchoise]:

Select which armor to wear. 

[No armor]

[Protective vest] - lowers dexterity, high damage soak

[Kevlar] - greatly lowers dexterity, very high damage soak

[No armor]:

@set armorsoak = 2

You chose no armor. Only your own jacket.

[[Continue]](Start)

[Protective vest]:

@set armor1
@set armorsoak = 20

You chose protective vest as armor.

[[Continue]](Start)

[Kevlar]:

@set armor2
@set armorsoak = 50

You chose kevlar as armor.

[[Continue]](Start)

[[Start]]:

<DEFINE ENEMY, ENEMY SKILL, ENEMY NUMBERS, ENEMY ARMOR, BELOW. WARNING! "enemies" and "enemiesfo" must match! MODIFY enemy_alive and enemyfinish to match with enemy numbers.>

@set enemy1_name = a thug overlord
@set enemy2_name = a thug
@set enemy3_name = a thugess
@set enemy1_weaponskill = 90
@set enemy2_weaponskill = 50
@set enemy3_weaponskill = 40
@set enemy1_dex = 30
@set enemy2_dex = 10
@set enemy3_dex = 10
@set enemies = 3
@set enemiesfo = 3
@set enemy1_weapon = rifle
@set enemy2_weapon = handgun
@set enemy3_weapon = handgun
@set enemy1_health = 80
@set enemy2_health = 65
@set enemy3_health = 60
@set enemy1_armorsoak = 40
@set enemy2_armorsoak = 20
@set enemy3_armorsoak = 20
@set enemy1_alive
@set enemy2_alive
@set enemy3_alive
@set not enemy1finish
@set not enemy2finish
@set not enemy3finish
@set enemyturn = 0

<END OF ENEMY DEFINITION>

<ARMOR CHECK IF YOUR ARMOR COMES FROM OTHER SOURCE>

{if armor1:{@dex-=15}}
{if armor2:{@dex-=25}}

<END OF YOUR ARMOR CHECK>

<WEAPON CHECK IF YOUR WEAPON COMES FROM OTHER SOURCE>

{if my_weapon=knife:{@dex+=6}}
{if my_weapon=club:{@dex+=3}}
{if my_weapon=bat:{@dex+=1}}
{if my_weapon=sword:{@dex+=1}}
{if my_weapon=small pistol:{@dex+=5}}
{if my_weapon=handgun:{@dex+=2}}
{if my_weapon=heavy pistol:{@dex-=1}}
{if my_weapon=shotgun:{@dex-=7}}
{if my_weapon=rifle:{@dex-=9}}
{if my_weapon=automatic rifle:{@dex-=15}}
{if my_weapon=machinegun:{@dex-=30}}


<END OF WEAPON CHECK>

You've just arrived at your destination. It's almost midnight and the street lies dark and abandoned. You and your comrade, Johnny Mikov, get out of the van, bringing two duffle bags with tools and spare armament with you.

All of a sudden, {if enemies=1:one}{if enemies=2: two}{if enemies=3: three} shadow{if enemies>1:s} appear at the end of the street. 

{if enemies=1: Its {enemy1_name}, and he is carrying a {enemy1_weapon}.}

{if enemies>1:

One of them, {enemy1_name}, is carrying a {enemy1_weapon}. The other, {enemy2_name}, is {if enemy1_weapon=@enemy2_weapon: also} carrying a {enemy2_weapon}. 

{if enemies=3: The third, {enemy3_name}, is{if enemy2_weapon=@enemy3_weapon: also} carrying a {enemy3_weapon}}.

}

Johnny: *Shit! it must be Kreugers men!*

You've just gotten your {my_weapon} out when {if enemies=1:the lone enemy}{if enemies=2: two enemies}{if enemies=3: three enemies} pull up {if enemies=1: his}{if enemies>1: their} weapon{if enemies>1:s} and attack you!

As you throw yourself behind some crates at the side of the street, you're able to see Johnny fall down to the ground, screaming, with blood gushing from a wound right below his collar.

You engage the enemy alone!

[[Continue]](Your_round)

[[Enemy_round]]:

@inc enemyturn

{if enemy1_alive:{if enemyturn=1:{if alive: [[Enemy 1 ({enemy1_name}) attacks you!]](Enemy_round1)}}}

{if not enemy1_alive:{if enemy2_alive:{if enemyturn=1:{if alive: [[Enemy 2 ({enemy2_name}) attacks you!]](Enemy_round2)}}}}

{if enemy2_alive:{if enemyturn=2:{if enemy1_alive:{if alive: [[Enemy 2 ({enemy2_name}) attacks you!]](Enemy_round2)}}}}

{if enemy3_alive:{if enemyturn=3:{if enemy1_alive:{if enemy2_alive:{if alive: [[Enemy 3 ({enemy3_name}) attacks you!]](Enemy_round3)}}}}}

{if enemy3_alive:{if not enemy1_alive:{if not enemy2_alive:{if enemyturn=1: [[Enemy 3 ({enemy3_name}) attacks you!]](Enemy_round3)}}}}

{if enemy3_alive:{if not enemy1_alive:{if enemyturn=2: [[Enemy 3 ({enemy3_name}) attacks you!]](Enemy_round3)}}}

{if enemy3_alive:{if not enemy2_alive:{if enemyturn=2: [[Enemy 3 ({enemy3_name}) attacks you!]](Enemy_round3)}}}

{if enemy1finish:{if enemy2finish:{if enemy3finish:

[[Your turn]](Your_round)

}}}

[[Enemy_round1]]:
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("enemy_attackroll", randomnumber(1,100));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("mydexroll", randomnumber(1,100));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("enemy_damage", randomnumber(9,80));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("text", randomnumber(1,7));

<h4>Enemy 1: {enemy1_name}</h4>

{if enemy_attackroll<=@enemy1_weaponskill:{if mydexroll<=@dex:

{if text=1: Your foe attacks you, but you duck down and narrowly escape his weapon.}
{if text=2: You dodge the attack. Close one!}
{if text=3: You lower your head just in time - your enemy misses.}
{if text=4: You dive down to the ground and dodge the attack.}
{if text=5: You're able to dodge the attack.}
{if text=6: Your fast footwork saves you just in time - you dodge the attack.}

}}



{if enemy_attackroll>@enemy1_weaponskill:

{if text=1: Your foe attacks you, but misses.}
{if text=2: Your enemy is off balance, and misses you.}
{if text=3: Your enemy misses.}
{if text=4: Your foe misses the attack.}
{if text=5: You're enemy is distracted and misses the attack.}
{if text=6: Your foe attacks way too high, and misses your head.}

}



{if enemy_attackroll<=@enemy1_weaponskill:{if mydexroll>@dex:

<font color="red">The enemy hits you!</font>

{if enemy1_weapon=knife:{@enemy_damage-=12}}
{if enemy1_weapon=club:{@enemy_damage-=12}}
{if enemy1_weapon=bat:{@enemy_damage-=9}}
{if enemy1_weapon=sword:{@enemy_damage-=5}}
{if enemy1_weapon=small pistol:{@enemy_damage-=10}}
{if enemy1_weapon=handgun:{@enemy_damage-=2}}
{if enemy1_weapon=heavy pistol:{@enemy_damage+=7}}
{if enemy1_weapon=shotgun:{@enemy_damage+=14}}
{if enemy1_weapon=rifle:{@enemy_damage+=15}}
{if enemy1_weapon=automatic rifle:{@enemy_damage+=18}}
{if enemy1_weapon=machinegun:{@enemy_damage+=30}}

{@enemy_damage-=@armorsoak}

{if enemy_damage>0:{@health-=@enemy_damage}}

<b>Damage output:</b>{if enemy_damage<=0: {enemy_damage} (*Damaged totally soaked by your armor*)}{if enemy_damage>=1:{if enemy_damage<=5: {enemy_damage} (*Just a scratch!*)}}{if enemy_damage>=6:{if enemy_damage<=15: {enemy_damage} (Fleshwound)}}{if enemy_damage>=16:{if enemy_damage<=30: {enemy_damage} (Heavy wound)}}{if enemy_damage>=31: {enemy_damage} (Mortal wound)}

{if health<=0: <font color="red">You die from your wounds!</font>{@not alive}}

}}

@set enemy1finish

{if alive: [[Continue]](Enemy_round)}

[[Enemy_round2]]:
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("enemy_weaponroll", randomnumber(1,100));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("mydexroll", randomnumber(1,100));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("enemy_damage", randomnumber(9,80));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("text", randomnumber(1,7));

<h4>Enemy 2: {enemy2_name}</h4>

{if enemy_weaponroll<=@enemy2_weaponskill:{if mydexroll<=@dex:

{if text=1: Your foe attacks you, but you duck down and narrowly escape his weapon.}
{if text=2: You dodge the attack. Close one!}
{if text=3: You lower your head just in time - your enemy misses.}
{if text=4: You dive down to the ground and dodge the attack.}
{if text=5: You're able to dodge the attack.}
{if text=6: Your fast footwork saves you just in time - you dodge the attack.}

}}



{if enemy_weaponroll>@enemy2_weaponskill:

{if text=1: Your foe attacks you, but misses.}
{if text=2: Your enemy is off balance, and misses you.}
{if text=3: Your enemy misses.}
{if text=4: Your foe misses the attack.}
{if text=5: You're enemy is distracted and misses the attack.}
{if text=6: Your foe attacks way too high, and misses your head.}

}



{if enemy_weaponroll<=@enemy2_weaponskill:{if mydexroll>@dex:

<font color="red">The enemy hits you!</font>

{if enemy2_weapon=knife:{@enemy_damage-=12}}
{if enemy2_weapon=club:{@enemy_damage-=12}}
{if enemy2_weapon=bat:{@enemy_damage-=9}}
{if enemy2_weapon=sword:{@enemy_damage-=5}}
{if enemy2_weapon=small pistol:{@enemy_damage-=10}}
{if enemy2_weapon=handgun:{@enemy_damage-=2}}
{if enemy2_weapon=heavy pistol:{@enemy_damage+=7}}
{if enemy2_weapon=shotgun:{@enemy_damage+=14}}
{if enemy2_weapon=rifle:{@enemy_damage+=15}}
{if enemy2_weapon=automatic rifle:{@enemy_damage+=18}}
{if enemy2_weapon=machinegun:{@enemy_damage+=30}}

{@enemy_damage-=@armorsoak}

{if enemy_damage>0:{@health-=@enemy_damage}}

<b>Damage output:</b>{if enemy_damage<=0: {enemy_damage} (*Damaged totally soaked by your armor*)}{if enemy_damage>=1:{if enemy_damage<=5: {enemy_damage} (*Just a scratch!*)}}{if enemy_damage>=6:{if enemy_damage<=15: {enemy_damage} (Fleshwound)}}{if enemy_damage>=16:{if enemy_damage<=30: {enemy_damage} (Heavy wound)}}{if enemy_damage>=31: {enemy_damage} (Mortal wound)}

{if health<=0: <font color="red">You die from your wounds!</font>{@not alive}}

}}

@set enemy2finish

{if alive: [[Continue]](Enemy_round)}

[[Enemy_round3]]:
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("enemy_weaponroll", randomnumber(1,100));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("mydexroll", randomnumber(1,100));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("enemy_damage", randomnumber(9,80));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("text", randomnumber(1,7));

<h4>Enemy 3: {enemy3_name}</h4>

{if enemy_weaponroll<=@enemy3_weaponskill:{if mydexroll<=@dex:

{if text=1: Your foe attacks you, but you duck down and narrowly escape his weapon.}
{if text=2: You dodge the attack. Close one!}
{if text=3: You lower your head just in time - your enemy misses.}
{if text=4: You dive down to the ground and dodge the attack.}
{if text=5: You're able to dodge the attack.}
{if text=6: Your fast footwork saves you just in time - you dodge the attack.}

}}



{if enemy_weaponroll>@enemy3_weaponskill:

{if text=1: Your foe attacks you, but misses.}
{if text=2: Your enemy is off balance, and misses you.}
{if text=3: Your enemy misses.}
{if text=4: Your foe misses the attack.}
{if text=5: You're enemy is distracted and misses the attack.}
{if text=6: Your foe attacks way too high, and misses your head.}

}



{if enemy_weaponroll<=@enemy3_weaponskill:{if mydexroll>@dex:

<font color="red">The enemy hits you!</font>

{if enemy3_weapon=knife:{@enemy_damage-=12}}
{if enemy3_weapon=club:{@enemy_damage-=12}}
{if enemy3_weapon=bat:{@enemy_damage-=9}}
{if enemy3_weapon=sword:{@enemy_damage-=5}}
{if enemy3_weapon=small pistol:{@enemy_damage-=10}}
{if enemy3_weapon=handgun:{@enemy_damage-=2}}
{if enemy3_weapon=heavy pistol:{@enemy_damage+=7}}
{if enemy3_weapon=shotgun:{@enemy_damage+=14}}
{if enemy3_weapon=rifle:{@enemy_damage+=15}}
{if enemy3_weapon=automatic rifle:{@enemy_damage+=18}}
{if enemy3_weapon=machinegun:{@enemy_damage+=30}}

{@enemy_damage-=@armorsoak}

{if enemy_damage>0:{@health-=@enemy_damage}}

<b>Damage output:</b>{if enemy_damage<=0: {enemy_damage} (*Damaged totally soaked by your armor*)}{if enemy_damage>=1:{if enemy_damage<=5: {enemy_damage} (*Just a scratch!*)}}{if enemy_damage>=6:{if enemy_damage<=15: {enemy_damage} (Fleshwound)}}{if enemy_damage>=16:{if enemy_damage<=30: {enemy_damage} (Heavy wound)}}{if enemy_damage>=31: {enemy_damage} (Mortal wound)}

{if health<=0: <font color="red">You die from your wounds!</font>{@not alive}}

}}

@set enemy3finish

{if alive: [[Continue]](Enemy_round)}

[[Your_round]]:

{if enemy1_alive: {@not enemy1finish}}
{if enemy2_alive: {@not enemy2finish}}
{if enemy3_alive: {@not enemy3finish}}

@set enemyturn = 0

{if enemies=0: 

You have defeated {if enemiesfo=1: your enemy!}{if enemiesfo>1: your enemies!} The battle is over.

[[Continue]](LINK TO YOUR STORY)

}

{if enemiesfo=1:

{if enemy1_alive: [[Attack]](Att1)}{else: Attack} - {enemy1_name} {if enemy1_health>=1:{if enemy1_health<=20: <font color="red">Wounded!</font>}}{if not enemy1_alive: <font color="red">DEAD!</font>}

}

{if enemiesfo=2:

{if enemy1_alive: [[Attack]](Att1)}{else: Attack} - {enemy1_name} {if enemy1_health>=1:{if enemy1_health<=20: <font color="red">Wounded!</font>}}{if not enemy1_alive: <font color="red">DEAD!</font>}


{if enemy2_alive: [[Attack]](Att2)}{else: Attack} - {enemy2_name} {if enemy2_health>=1:{if enemy2_health<=20: <font color="red">Wounded!</font>}}{if not enemy2_alive: <font color="red">DEAD!</font>}

}

{if enemiesfo=3:

{if enemy1_alive: [[Attack]](Att1)}{else: Attack} - {enemy1_name} {if enemy1_health>=1:{if enemy1_health<=20: <font color="red">Wounded!</font>}}{if not enemy1_alive: <font color="red">DEAD!</font>}


{if enemy2_alive: [[Attack]](Att2)}{else: Attack} - {enemy2_name} {if enemy2_health>=1:{if enemy2_health<=20: <font color="red">Wounded!</font>}}{if not enemy2_alive: <font color="red">DEAD!</font>}


{if enemy3_alive: [[Attack]](Att3)}{else: Attack} - {enemy3_name} {if enemy3_health>=1:{if enemy3_health<=20: <font color="red">Wounded!</font>}}{if not enemy3_alive: <font color="red">DEAD!</font>}

}

...............................

<b>Your health:</b> {if health>=1:{if health<=10: <font color="red"> Mortally wounded!</font>}}{if health>=11:{if health<=25: <font color="red">Critically wounded!</font>}}{if health>=26:{if health<=40: <font color="red">Badly wounded!</font>}}{if health>=41:{if health<=79: <font color="red">Wounded!</font>}}{if health>=80: Fresh!}

[[Att1]]:
    clearTimeout(squiffy.myVar);
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("my_weaponroll", randomnumber(1,100));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("my_damage", randomnumber(9,95));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("enemydexroll", randomnumber(1,100));

{if my_weaponroll<=@weaponskill:{if enemydexroll<=@enemy1_dex:

You attack the enemy, but he is able to take cover.

}}

{if my_weaponroll>@weaponskill:

You miss the enemy!

}


{if my_weaponroll<=@weaponskill:{if enemydexroll>@enemy1_dex:

<font color="red">You aim high and hit the enemy with your {my_weapon}!</font>

{if my_weapon=knife:{@my_damage-=12}}
{if my_weapon=club:{@my_damage-=12}}
{if my_weapon=bat:{@my_damage-=9}}
{if my_weapon=sword:{@my_damage-=5}}
{if my_weapon=small pistol:{@my_damage-=10}}
{if my_weapon=handgun:{@my_damage-=2}}
{if my_weapon=heavy pistol:{@my_damage+=7}}
{if my_weapon=shotgun:{@my_damage+=14}}
{if my_weapon=rifle:{@my_damage+=15}}
{if my_weapon=automatic rifle:{@my_damage+=18}}
{if my_weapon=machinegun:{@my_damage+=30}}

{@my_damage-=@enemy1_armorsoak}

{if my_damage>0:{@enemy1_health-=@my_damage}}

<b>Damage output:</b>{if my_damage<=0: {my_damage} (*Damaged totally soaked by enemy armor*)}{if my_damage>=1:{if my_damage<=5: {my_damage} (*Just a scratch!*)}}{if my_damage>=6:{if my_damage<=15: {my_damage} (Fleshwound)}}{if my_damage>=16:{if my_damage<=30: {my_damage} (Heavy wound)}}{if my_damage>=31: {my_damage} (Mortal wound)}

}}

{if enemy1_health<=0:

The enemy is mortally wounded and cannot continue the fight!

{@enemies-=1}{@not enemy1_alive}{@enemy1finish}

}

[[Next round]](Enemy_round)

[[Att2]]:
    clearTimeout(squiffy.myVar);
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("my_weaponroll", randomnumber(1,100));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("my_damage", randomnumber(9,95));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("enemydexroll", randomnumber(1,100));

{if my_weaponroll<=@weaponskill:{if enemydexroll<=@enemy2_dex:

You attack the enemy, but he is able to dodge.

}}

{if my_weaponroll>@weaponskill:

You miss the enemy!

}


{if my_weaponroll<=@weaponskill:{if enemydexroll>@enemy2_dex:

<font color="red">You hit the enemy with your {my_weapon}!</font>

{if my_weapon=knife:{@my_damage-=12}}
{if my_weapon=club:{@my_damage-=12}}
{if my_weapon=bat:{@my_damage-=9}}
{if my_weapon=sword:{@my_damage-=5}}
{if my_weapon=small pistol:{@my_damage-=10}}
{if my_weapon=handgun:{@my_damage-=2}}
{if my_weapon=heavy pistol:{@my_damage+=7}}
{if my_weapon=shotgun:{@my_damage+=14}}
{if my_weapon=rifle:{@my_damage+=15}}
{if my_weapon=automatic rifle:{@my_damage+=18}}
{if my_weapon=machinegun:{@my_damage+=30}}

{@my_damage-=@enemy2_armorsoak}

{if my_damage>0:{@enemy2_health-=@my_damage}}

<b>Damage output:</b>{if my_damage<=0: {my_damage} (*Damaged totally soaked by enemy armor*)}{if my_damage>=1:{if my_damage<=5: {my_damage} (*Just a scratch!*)}}{if my_damage>=6:{if my_damage<=15: {my_damage} (Fleshwound)}}{if my_damage>=16:{if my_damage<=30: {my_damage} (Heavy wound)}}{if my_damage>=31: {my_damage} (Mortal wound)}

}}

{if enemy2_health<=0:

The enemy is mortally wounded and cannot continue the fight!

{@enemies-=1}{@not enemy2_alive}{@enemy2finish}

}

[[Next round]](Enemy_round)

[[Att3]]:
    clearTimeout(squiffy.myVar);
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("my_weaponroll", randomnumber(1,100));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("my_damage", randomnumber(9,95));
    var randomnumber = function rng(min, max) {
      return Math.floor(Math.random() * (max - min) + min);
    }

    set ("enemydexroll", randomnumber(1,100));

{if my_weaponroll<=@weaponskill:{if enemydexroll<=@enemy3_dex:

You attack the enemy, but he is able to take cover.

}}

{if my_weaponroll>@weaponskill:

You miss the enemy!

}


{if my_weaponroll<=@weaponskill:{if enemydexroll>@enemy3_dex:

<font color="red">You aim high and hit the enemy with your {my_weapon}!</font>

{if my_weapon=knife:{@my_damage-=12}}
{if my_weapon=club:{@my_damage-=12}}
{if my_weapon=bat:{@my_damage-=9}}
{if my_weapon=sword:{@my_damage-=5}}
{if my_weapon=small pistol:{@my_damage-=10}}
{if my_weapon=handgun:{@my_damage-=2}}
{if my_weapon=heavy pistol:{@my_damage+=7}}
{if my_weapon=shotgun:{@my_damage+=14}}
{if my_weapon=rifle:{@my_damage+=15}}
{if my_weapon=automatic rifle:{@my_damage+=18}}
{if my_weapon=machinegun:{@my_damage+=30}}

{@my_damage-=@enemy3_armorsoak}

{if my_damage>0:{@enemy3_health-=@my_damage}}

<b>Damage output:</b>{if my_damage<=0: {my_damage} (*Damaged totally soaked by enemy armor*)}{if my_damage>=1:{if my_damage<=5: {my_damage} (*Just a scratch!*)}}{if my_damage>=6:{if my_damage<=15: {my_damage} (Fleshwound)}}{if my_damage>=16:{if my_damage<=30: {my_damage} (Heavy wound)}}{if my_damage>=31: {my_damage} (Mortal wound)}

}}

{if enemy3_health<=0:

The enemy is mortally wounded and cannot continue the fight!

{@enemies-=1}{@not enemy3_alive}{@enemy3finish}

}

[[Next round]](Enemy_round)

[[]]:
@clear

[]:
@clear


Awesome work! I've ran your code of squiffy scratchpad and it was amazing!


Thanks!

Working now on adding allies and ammunition count.


how would you clear the bottom values? curious for my own work.
Also love the battle system, seems very versatile!


Glad you like it!

MasterFB:

Once you activate the number through a passage/if statement etc it's "permanent", you can only change its value, it never goes away.

The bottom values I think you're referring to is nothing you'll see in the final game, once you publish it. It's only there for debugging/testing purposes in the editor.


oh i didn't know that, thanks for the info! literally no coding skills and pretty new to this.


It's the same for everyone in the beginning! :)


Thank you for sharing this helpful tutorial, I really like the information you give.


Hi. This is brilliant. Showed it to one of my students because he is creating choices for how Gilgamesh would fight Humbaba.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums