How to make combat

I want to make “combat” but i don’t know how. If this is a easy thing to do then please forgive me because I’m new to making these


I had a lot of trouble with this, the first time I tried it. I think the best thing to do is study the documentation on turn-scripts, but I didn't use these. I just made coming into contact with the enemy a danger, and made using each weapon have a variable effect on the enemy and then a variable effect on the player with a message that included both effects and a status attribute pane that showed both changes in enemy health and player health. Then, when the enemy dies, player health is recovered and the player.money increased as well as player.Victories, by one, another status attribute.
Turn scripts just separate the player activity from the enemy's activity (or friend's) and makes the other character act and react after every turn. You can also make NPC's take action (using messages, sounds, and/or pictures etc) on a timer. An action of the player's (maybe pressing the verb "fight") initiates the script that could begin with
''' enabletimer (fight)'''
I'm not sure if I spelled that correctly, but you do not need to worry if you use tabs because everything is spelled already.
Then, add a script to the timer called fight, that says
'''if (enemy.life < 1) {
msg ("You are victorious! It is dead.")
player.victories = player.victories + 1
disabletimer
}'''
player.victories works if you create an attribute for the player and name the attribute victories, then, add it to the list of status attributes, up at the top of the player attribute page, hit +, then name it the same as its name in the attributes list below (make sure that's set to integer not string if you are using integers) when you please enter, the popup box changes slightly and you can type victories : !. The ❗ is code for the integer which changes. Everything else typed in is just a label. You can type in anything you like for that.
Sorry about any spelling errors ahead of time.


K02c
Title: cat god adventure
Description: rpg game
Purpose: free coding template by foxrain4

If you try the following game link and like it, you can copy and paste the following code to startup your game creating adventure immediately.

https://textadventures.co.uk/games/view/jbQnLOzFm0OzS9R5X0GG1g/sword-warrior-adventure-2020

To copy this code:

  1. Startup your quest textadventure, on the right side of the big play button, you can see a code view button </>
  2. Copy my code to replace the code in the text box, click code view button again.
  3. Viola, it is done, press play button to test out the game and modify the code to your preference.
<!--Saved by Quest 5.8.6836.13983-->
<asl version="580">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="test2">
    <gameid>8721a257-c59d-476f-8611-c3b68d264c8d</gameid>
    <version>1.0</version>
    <firstpublished>2024</firstpublished>
    <start type="script">
      player.currenthp = 50
      player.atk = 20
      player.gold = 10
    </start>
    <roomenter type="script">
      ClearScreen
      if (RandomChance(10)) {
        SetForegroundColour ("Gold")
        msg ("You have found a golden treasure.")
        player.gold = player.gold+100
        msg ("You received 100 gold from loot.")
        msg ("You now have "+player.gold+" gold.")
        SetForegroundColour ("Black")
      }
    </roomenter>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <isroom />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <object name="silver sword">
      <inherit name="editor_object" />
      <attr name="feature_wearable" type="boolean">false</attr>
      <take />
      <displayverbs type="stringlist">
        <value>Take</value>
      </displayverbs>
      <inventoryverbs type="stringlist">
        <value>Drop</value>
      </inventoryverbs>
      <equipweapon type="script">
        player.weapon = "silver sword"
      </equipweapon>
    </object>
    <object name="rabbit helm goblin">
      <inherit name="editor_object" />
      <displayverbs type="stringlist" />
      <fight type="script"><![CDATA[
        enemy.weapon = "rabbit helm goblin"
        combat
        if (player.currenthp<1) {
          msg ("")
          msg ("You died.")
          msg ("The archangel have cleansed you of any death penalities.")
        }
        if (player.currenthp>0) {
          msg ("")
          msg ("You have slain the enemy.")
          player.gold = player.gold+1
          msg ("You received 1 gold from loot.")
          msg ("You now have "+player.gold+" gold.")
        }
      ]]></fight>
    </object>
    <object name="enemy">
      <inherit name="editor_object" />
      <visible type="boolean">false</visible>
      <inventoryverbs type="stringlist">
        <value>Drop</value>
        <value>Look at</value>
        <value>Use</value>
      </inventoryverbs>
    </object>
    <exit alias="east" to="boss room">
      <inherit name="eastdirection" />
    </exit>
    <object name="seaweed">
      <inherit name="editor_object" />
      <visible type="boolean">false</visible>
      <attr name="feature_usegive" type="boolean">false</attr>
      <take />
      <useit type="script"><![CDATA[
        if (ListContains(ScopeVisible(), cat god)) {
          msg ("system message: you won.<br/><br/>cat god: You think you can bribe me with some food?<br/>Nibbles, nibbles.<br/>cat god falls asleep.<br/><br/>You: Hurray! I can make my own game now!<br/>That is... at least until the cat god awakes.")
          finish
        }
        else {
          msg ("If fighting doesn't works, try bribing instead.")
        }
      ]]></useit>
      <displayverbs type="stringlist">
        <value>Take</value>
      </displayverbs>
      <inventoryverbs type="stringlist">
        <value>Drop</value>
      </inventoryverbs>
    </object>
  </object>
  <verb>
    <property>equipweapon</property>
    <pattern>equip weapon</pattern>
    <defaultexpression>"You can't equip weapon " + object.article + "."</defaultexpression>
  </verb>
  <verb>
    <property>fight</property>
    <pattern>fight</pattern>
    <defaultexpression>"You can't fight " + object.article + "."</defaultexpression>
  </verb>
  <verb>
    <property>interact</property>
    <pattern>interact</pattern>
    <defaultexpression>"You can't interact " + object.article + "."</defaultexpression>
  </verb>
  <object name="boss room">
    <inherit name="editor_room" />
    <enter type="script">
      msg ("Cough cough cough, a bit too fast, eh?")
      msg ("")
    </enter>
    <exit alias="west" to="room">
      <inherit name="westdirection" />
    </exit>
    <object name="kappa boss">
      <inherit name="editor_object" />
      <displayverbs type="stringlist" />
      <fight type="script"><![CDATA[
        enemy.weapon = "kappa boss"
        combat
        if (player.currenthp<1) {
          msg ("")
          msg ("You died.")
          msg ("The archangel have cleansed you of any death penalities.")
        }
        if (player.currenthp>0) {
          msg ("")
          msg ("You have slain the enemy.")
          msg ("You received 50% chance to receive secret loot.")
          if (RandomChance(50)) {
            MakeObjectVisible (pheonix blade)
            AddToInventory (pheonix blade)
            msg ("You received secret loot: pheonix blade")
          }
          else {
            msg ("You found nothing.")
          }
        }
      ]]></fight>
    </object>
    <object name="pheonix blade">
      <inherit name="editor_object" />
      <visible type="boolean">false</visible>
      <displayverbs type="stringlist">
        <value>Take</value>
      </displayverbs>
      <inventoryverbs type="stringlist">
        <value>Drop</value>
      </inventoryverbs>
      <take />
      <equipweapon type="script">
        player.weapon = "pheonix blade"
      </equipweapon>
    </object>
    <exit alias="east" to="last boss room">
      <inherit name="eastdirection" />
    </exit>
  </object>
  <object name="last boss room">
    <inherit name="editor_room" />
    <enter type="script">
      msg ("Didn't expect you to clear the last boss so fast, here, let me make another one.")
    </enter>
    <exit alias="west" to="boss room">
      <inherit name="westdirection" />
    </exit>
    <object name="dragon of doom">
      <inherit name="editor_object" />
      <displayverbs type="stringlist" />
      <fight type="script"><![CDATA[
        enemy.weapon = "dragon of doom"
        combat
        if (player.currenthp<1) {
          msg ("")
          msg ("You died.")
          msg ("The archangel have cleansed you of any death penalities.")
        }
        if (player.currenthp>0) {
          msg ("")
          msg ("You have slain the enemy.")
          msg ("You received 50% chance to receive secret loot.")
          if (RandomChance(50)) {
            MakeObjectVisible (dragon companion)
            AddToInventory (dragon companion)
            msg ("You received secret loot: dragon companion.")
          }
          else {
            msg ("You found nothing.")
          }
        }
      ]]></fight>
    </object>
    <object name="dragon companion">
      <inherit name="editor_object" />
      <visible type="boolean">false</visible>
      <displayverbs type="stringlist">
        <value>Take</value>
      </displayverbs>
      <inventoryverbs type="stringlist">
        <value>Drop</value>
      </inventoryverbs>
      <take />
    </object>
    <exit alias="east" to="mountain peak">
      <inherit name="eastdirection" />
      <runscript />
      <script type="script"><![CDATA[
        if (Got(dragon companion)) {
          MoveObject (player, mountain peak)
          msg ("The dragon covered the sky with its abyssal wings.<br/>It fetched you to where ever you want, including the top of mountain peak... for no reason...")
        }
        else {
          msg ("The journey is too far and the mountain is too steep.<br/>Hint: Give up on the game, you have better things to do in real life anyway.")
        }
      ]]></script>
    </exit>
  </object>
  <object name="mountain peak">
    <inherit name="editor_room" />
    <description type="string"></description>
    <enter type="script"><![CDATA[
      msg ("merchant bigfoot: Looking for some wares?<br/>merchant bigfoot: I am selling a powerful bow for 100 gold.")
      msg ("")
      MakeObjectVisible (seaweed)
    ]]></enter>
    <exit alias="west" to="last boss room">
      <inherit name="westdirection" />
    </exit>
    <object name="merchant bigfoot">
      <inherit name="editor_object" />
      <displayverbs type="stringlist" />
      <buy type="script"><![CDATA[
        if (player.gold>99) {
          player.gold = player.gold-100
          msg ("You now have "+player.gold+" gold.")
          MakeObjectVisible (red dragon bow)
          AddToInventory (red dragon bow)
        }
        else {
          msg ("You do not have enough funds.")
        }
      ]]></buy>
    </object>
    <object name="red dragon bow">
      <inherit name="editor_object" />
      <visible type="boolean">false</visible>
      <displayverbs type="stringlist">
        <value>Take</value>
      </displayverbs>
      <inventoryverbs type="stringlist">
        <value>Drop</value>
      </inventoryverbs>
      <take />
      <equipweapon type="script">
        player.weapon = "red dragon bow"
      </equipweapon>
    </object>
    <object name="cat god">
      <inherit name="editor_object" />
      <displayverbs type="stringlist" />
      <fight type="script"><![CDATA[
        enemy.weapon = "cat god"
        combat
        if (player.currenthp<1) {
          msg ("")
          msg ("You died.")
          msg ("The archangel have cleansed you of any death penalities.")
        }
        if (player.currenthp>0) {
          msg ("")
          msg ("You have slain the enemy.")
          player.gold = player.gold+20
          msg ("You received 20 gold from loot.")
          msg ("You now have "+player.gold+" gold.")
        }
      ]]></fight>
    </object>
  </object>
  <verb>
    <property>useit</property>
    <pattern>use it</pattern>
    <defaultexpression>"You can't use it " + object.article + "."</defaultexpression>
  </verb>
  <function name="combat">
    playerequip
    enemyequip
    fight
  </function>
  <function name="playerequip">
    if (player.weapon="silver sword") {
      player.maxhp = 90
      player.currenthp = 90
      player.atk = 20
    }
    if (player.weapon="pheonix blade") {
      player.maxhp = 110
      player.currenthp = 110
      player.atk = 30
    }
    if (player.weapon="red dragon bow") {
      player.maxhp = 220
      player.currenthp = 220
      player.atk = 30
    }
  </function>
  <function name="enemyequip">
    if (enemy.weapon="rabbit helm goblin") {
      enemy.maxhp = 100
      enemy.currenthp = 100
      enemy.atk = 15
    }
    if (enemy.weapon="kappa boss") {
      enemy.maxhp = 600
      enemy.currenthp = 600
      enemy.atk = 2
    }
    if (enemy.weapon="dragon of doom") {
      enemy.maxhp = 1200
      enemy.currenthp = 1200
      enemy.atk = 1
    }
    if (enemy.weapon="cat god") {
      enemy.maxhp = 700
      enemy.currenthp = 700
      enemy.atk = 30
    }
  </function>
  <function name="fight"><![CDATA[
    playerskill
    enemyskill
    player.currenthp = player.currenthp-enemy.atk
    enemy.currenthp = enemy.currenthp-player.atk
    msg ("Player atk: "+player.atk+" hp: "+player.currenthp)
    msg ("Enemy atk: "+enemy.atk+" hp: "+enemy.currenthp)
    if (player.currenthp>0) {
      if (enemy.currenthp>0) {
        fight
      }
    }
  ]]></function>
  <function name="enemyskill">
    if (enemy.weapon="dragon of doom") {
      if (RandomChance(20)) {
        msg ("dragon of doom: Let me bring out my inner fire.")
        if (RandomChance(50)) {
          msg ("dragon of doom: Fire roaring blast!")
          enemy.atk = enemy.atk+1
        }
        else {
          msg ("dragon of doom: Still charging.")
        }
      }
    }
    if (enemy.weapon="cat god") {
      if (RandomChance(30)) {
        msg ("cat god: Why are you attacking me?")
        if (RandomChance(40)) {
          msg ("cat god: A thousand cats!")
          enemy.atk = enemy.atk+1
        }
        else {
          msg ("cat god: The trinity weapon!")
          enemy.atk = enemy.atk+enemy.atk
        }
      }
    }
  </function>
  <function name="playerskill">
    if (player.weapon="red dragon bow") {
      if (RandomChance(20)) {
        msg ("red dragon bow: Prepare for the inevitable!")
        if (RandomChance(50)) {
          msg ("red dragon bow: Fire enchanted arrows!")
          player.atk = player.atk+1
        }
        else {
          msg ("red dragon bow: Ooophs, missed!")
        }
      }
    }
  </function>
</asl>

K02d
Title: evil valley
Description: shooting game
Purpose: free coding template by foxrain4

So Jennifer Wren was talking about using Turn scripts to make combat games.
There is more information about Turn scripts at the following link.
https://docs.textadventures.co.uk/quest/using_turnscripts.html

So I did make another game, but first, I want to say I am not good at coding and this is my first time doing Turn scripts.
As a novice, I am completely blind if I am not using Turn scripts properly or efficiently, so if anyone can point out the better way to make use of Turn scripts, do say it.

To copy this code:

  1. Startup your quest textadventure, on the right side of the big play button, you can see a code view button </>
  2. Copy my code to replace the code in the text box, click code view button again.
  3. Viola, it is done, press play button to test out the game and modify the code to your preference.
<!--Saved by Quest 5.8.6836.13983-->
<asl version="580">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="test2">
    <gameid>b5c080ec-dffa-4f49-b691-34d0e3be834e</gameid>
    <version>1.0</version>
    <firstpublished>2024</firstpublished>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <isroom />
    <enter type="script">
    </enter>
    <firstenter type="script">
      game.turns = 0
      player.atk = 10
      player.hp = 100
    </firstenter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <object name="bush">
      <inherit name="editor_object" />
    </object>
    <object name="captain">
      <inherit name="editor_object" />
    </object>
    <object name="zombie">
      <inherit name="editor_object" />
      <shoot type="script">
        firsttime {
          msg ("You missed, try again.")
        }
        otherwise {
          firsttime {
            msg ("You missed, try again.")
          }
          otherwise {
            RemoveObject (zombie)
            msg ("Zombie is down.")
          }
        }
      </shoot>
    </object>
  </object>
  <verb>
    <property>shoot</property>
    <pattern>shoot</pattern>
    <defaultexpression>"You can't shoot " + object.article + "."</defaultexpression>
  </verb>
  <object name="room2">
    <inherit name="editor_room" />
    <object name="trees">
      <inherit name="editor_object" />
    </object>
    <object name="mountain">
      <inherit name="editor_object" />
    </object>
    <object name="river">
      <inherit name="editor_object" />
    </object>
    <object name="zombie2">
      <inherit name="editor_object" />
      <alias>zombie</alias>
      <shoot type="script">
        if (RandomChance(80)) {
          RemoveObject (this)
          msg ("Zombie is down.")
        }
        else {
          msg ("You missed, try again.")
        }
      </shoot>
    </object>
    <object name="zombie1">
      <inherit name="editor_object" />
      <alias>zombie</alias>
      <shoot type="script">
        if (RandomChance(80)) {
          RemoveObject (this)
          msg ("Zombie is down.")
        }
        else {
          msg ("You missed, try again.")
        }
      </shoot>
    </object>
    <object name="zombie3">
      <inherit name="editor_object" />
      <alias>zombie</alias>
      <shoot type="script">
        if (RandomChance(80)) {
          RemoveObject (this)
          msg ("Zombie is down.")
        }
        else {
          msg ("You missed, try again.")
        }
      </shoot>
    </object>
    <object name="zombie4">
      <inherit name="editor_object" />
      <alias>zombie</alias>
      <shoot type="script">
        if (RandomChance(80)) {
          RemoveObject (this)
          msg ("Zombie is down.")
        }
        else {
          msg ("You missed, try again.")
        }
      </shoot>
    </object>
    <object name="zombie5">
      <inherit name="editor_object" />
      <alias>zombie</alias>
      <shoot type="script">
        if (RandomChance(80)) {
          RemoveObject (this)
          msg ("Zombie is down.")
        }
        else {
          msg ("You missed, try again.")
        }
      </shoot>
    </object>
    <object name="zombie6">
      <inherit name="editor_object" />
      <alias>zombie</alias>
      <shoot type="script">
        if (RandomChance(80)) {
          RemoveObject (this)
          msg ("Zombie is down.")
        }
        else {
          msg ("You missed, try again.")
        }
      </shoot>
    </object>
    <object name="zombie7">
      <inherit name="editor_object" />
      <alias>zombie</alias>
      <shoot type="script">
        if (RandomChance(80)) {
          RemoveObject (this)
          msg ("Zombie is down.")
        }
        else {
          msg ("You missed, try again.")
        }
      </shoot>
    </object>
    <object name="bullet refill">
      <inherit name="editor_object" />
      <useit type="script">
        msg ("You have used bullet refill.")
        player.atk = player.atk+1
        msg ("Player atk: "+player.atk)
        RemoveObject (this)
      </useit>
    </object>
    <object name="TNT">
      <inherit name="editor_object" />
      <useit type="script">
        msg ("The bomb has been planted.")
        RemoveObject (TNT)
      </useit>
    </object>
    <object name="gargoyle boss">
      <inherit name="editor_object" />
      <shoot type="script">
        if (RandomChance(player.atk-10)) {
          RemoveObject (this)
          msg ("Gargoyle boss is down.")
        }
        else {
          msg ("You missed, try again.")
        }
      </shoot>
    </object>
    <object name="submachine gun upgrade">
      <inherit name="editor_object" />
      <useit type="script">
        msg ("You have used submachine gun upgrade.")
        player.atk = player.atk+5
        msg ("Player atk: "+player.atk)
        RemoveObject (this)
      </useit>
    </object>
    <object name="med pack">
      <inherit name="editor_object" />
      <useit type="script">
        msg ("You have used med pack.")
        player.hp = 100
        msg ("Player hp: "+player.hp)
        RemoveObject (this)
      </useit>
    </object>
    <object name="helicopter">
      <inherit name="editor_object" />
      <useit type="script"><![CDATA[
        if (ListContains(ScopeVisible(), gargoyle boss)) {
          msg ("The gargoyle boss flies up and slashed the helicopter wings apart.<br/>Half of the troops died including Mira.<br/><br/>You and the other surviving troops have to retreat from the tropical forest on foot.<br/>Radio: Another helicopter is coming your way.<br/><br/>Survivors were able to pull their distance from their undead and reach another helicopter destination.<br/>Everyone: Hurray! We are saved.")
          finish
        }
        else {
          msg ("You have saved everyone including Mira.<br/>Congratulations on eliminating the source of zombies.")
          finish
        }
      ]]></useit>
    </object>
  </object>
  <turnscript name="Spawn turn script">
    <enabled />
    <script><![CDATA[
      game.turns = game.turns+1
      if (game.turns=1) {
        msg ("Captain: Alright, let's reach the destination.<br/>Oh no, enemies spotted.<br/>Help me, help me.")
      }
      if (game.turns=2) {
        msg ("")
        msg ("Zombie bites onto captain, captain perished.")
        msg ("Radio: The mission continues, carry on and prepare to fight!")
      }
      if (game.turns=3) {
        msg ("")
        msg ("You closed the eyes of the captain and marched on.")
        MakeObjectInvisible (captain)
      }
      if (game.turns=4) {
        MoveObjectHere (trees)
        msg ("The forest gets denser and denser as you travel deeper and deeper.")
        msg ("Becareful of getting lost.")
      }
      if (game.turns=5) {
        msg ("The forest gets denser and denser as you travel deeper and deeper.")
        msg ("Becareful of getting lost.")
        MoveObjectHere (zombie2)
      }
      if (game.turns=6) {
      }
      if (game.turns=7) {
        msg ("It is too quiet.<br/>This may be a trap.")
      }
      if (game.turns=8) {
        msg ("We are ambushed!")
        msg ("Radio: Continue forwards, mission is critical.")
      }
      if (game.turns=9) {
        msg ("Soldiers: This is a suicide mission.")
        msg ("Many of the soldiers spread their way to find the destination faster.")
      }
      if (game.turns=10) {
        msg ("You are now together with only another soldier, named Mira.")
      }
      if (game.turns=11) {
        MoveObjectHere (zombie1)
        MoveObjectHere (zombie5)
      }
      if (game.turns=12) {
        MoveObjectHere (zombie3)
        MoveObjectHere (zombie6)
      }
      if (game.turns=13) {
        MoveObjectHere (zombie4)
        MoveObjectHere (zombie7)
      }
      if (game.turns=14) {
        MoveObjectHere (bullet refill)
      }
      if (game.turns=15) {
        MoveObjectHere (zombie2)
        MoveObjectHere (zombie1)
        MoveObjectHere (zombie3)
        MoveObjectHere (zombie4)
      }
      if (game.turns=16) {
        msg ("Mira: We are surrounded!<br/>You: Time to duck into a tunnel.")
      }
      if (game.turns=17) {
        msg ("The tunnel is deep and dark.<br/>You guys cannot see much.")
      }
      if (game.turns=18) {
        MoveObjectHere (mountain)
        MoveObjectHere (zombie2)
        MoveObjectHere (zombie1)
        MoveObjectHere (zombie3)
        MoveObjectHere (zombie4)
      }
      if (game.turns=19) {
        msg ("You found the destination!<br/>Radio: Place the TNT now!")
        MoveObjectHere (TNT)
      }
      if (game.turns=20) {
        msg ("Mira: Oh no, a boss is coming.<br/>You: There is no need to defeat it, just run.")
      }
      if (game.turns=21) {
        msg ("You: Unless you want to be blown into bits and pieces.<br/>Radio: This is your last chance to place the TNT, we need to bomb the heart of the mountain.")
        MoveObjectHere (gargoyle boss)
      }
      if (game.turns=22) {
        if (ListContains(ScopeVisible(), TNT)) {
          msg ("Game over!<br/>Make sure you listen to orders carefully next time.")
          finish
        }
      }
      if (game.turns=23) {
        msg ("Radio: TNT have been placed, this will destroy the undead creating mountain.<br/>Radio: Run, run, run, all agents.")
        MoveObjectHere (zombie2)
        MoveObjectHere (zombie1)
        MoveObjectHere (zombie3)
        MoveObjectHere (zombie4)
        MoveObjectHere (zombie5)
        MoveObjectHere (zombie6)
        MoveObjectHere (zombie7)
      }
      if (game.turns=24) {
        msg ("Radio: Rescue helicopters are on the way.")
        MoveObjectHere (submachine gun upgrade)
      }
      if (game.turns=25) {
        MoveObjectHere (med pack)
      }
      if (game.turns=26) {
        msg ("You have reached the helicopter arrival location, but the helicopter has not arrived yet.<br/>There are no commands for you, do whatever you think is the best choice.")
        MoveObjectHere (river)
      }
      if (game.turns=27) {
        MoveObjectHere (zombie2)
        MoveObjectHere (zombie1)
        MoveObjectHere (zombie3)
        MoveObjectHere (zombie4)
        MoveObjectHere (zombie5)
        MoveObjectHere (zombie6)
        MoveObjectHere (zombie7)
      }
      if (game.turns=30) {
        MoveObjectHere (zombie2)
        MoveObjectHere (zombie1)
        MoveObjectHere (zombie3)
        MoveObjectHere (zombie4)
        MoveObjectHere (zombie5)
        MoveObjectHere (zombie6)
        MoveObjectHere (zombie7)
      }
      if (game.turns=33) {
        msg ("The other troops have arrived, they are helping to shoot off the zombies.<br/>You: We are saved!")
      }
      if (game.turns=34) {
        msg ("Then you saw Mira is bleeding.<br/>You: Do not give up!")
      }
      if (game.turns=34) {
        msg ("System message: The helicopter has arrived, make your way.<br/>You, Mira and all troops: Oh my, finally.")
        MoveObjectHere (helicopter)
      }
    ]]></script>
  </turnscript>
  <turnscript name="enemies attack turn script">
    <script><![CDATA[
      if (ListContains(ScopeVisible(), zombie2)) {
        msg ("Zombie attacks you.")
        player.hp = player.hp-1
        msg ("Player hp: "+player.hp)
      }
      if (ListContains(ScopeVisible(), zombie1)) {
        msg ("Zombie attacks you.")
        player.hp = player.hp-1
        msg ("Player hp: "+player.hp)
      }
      if (ListContains(ScopeVisible(), zombie3)) {
        msg ("Zombie attacks you.")
        player.hp = player.hp-1
        msg ("Player hp: "+player.hp)
      }
      if (ListContains(ScopeVisible(), zombie4)) {
        msg ("Zombie attacks you.")
        player.hp = player.hp-1
        msg ("Player hp: "+player.hp)
      }
      if (ListContains(ScopeVisible(), zombie5)) {
        msg ("Zombie attacks you.")
        player.hp = player.hp-1
        msg ("Player hp: "+player.hp)
      }
      if (ListContains(ScopeVisible(), zombie6)) {
        msg ("Zombie attacks you.")
        player.hp = player.hp-1
        msg ("Player hp: "+player.hp)
      }
      if (ListContains(ScopeVisible(), zombie7)) {
        msg ("Zombie attacks you.")
        player.hp = player.hp-1
        msg ("Player hp: "+player.hp)
      }
      if (ListContains(ScopeVisible(), gargoyle boss)) {
        msg ("Gargoyle boss attacks you.")
        player.hp = player.hp-1
        msg ("Player hp: "+player.hp)
      }
      if (player.hp<1) {
        msg ("You died.")
        finish
      }
    ]]></script>
    <enabled />
  </turnscript>
  <verb>
    <property>useit</property>
    <pattern>use it</pattern>
    <defaultexpression>"You can't use it " + object.article + "."</defaultexpression>
  </verb>
  <function name="enemies attack">
    if (ListContains(ScopeVisible(), zombie2)) {
      msg ("Zombie attacks you.")
      player.hp = player.hp-1
      msg ("Player hp: "+player.hp)
    }
  </function>
</asl>

There's also a library for Combat created by Pixie which I've found very easy to use. I'm currently working a project to integrate it into my Quest Core so it doesn't need to be added separately. In the process, working on updating the tabs in the creation interface so that some of the things mentioned in documentation are easier to do using just the tabs.

https://github.com/ThePix/quest/wiki/CombatLib


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

Support

Forums