Noob want to make combat system

Hello, I understand i need Attributes, and have Verbs with scripts that effect those Attributes, but apparently i am an idiot.
my game concept involves hp/mp/skills the usual rpg stuff. Can someone please tutor me?


^ same question as him tehee~


SoapyBen, hope both our problems can get solved here


is this for Text Adventure or Game Book, as they're a bit different in the methods we got for doing it.
Also, off-line/desktop or on-line/web ???


if this is for Text Adventure (and off-line/desktop):

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk

and here's a step-by-step walkthough guide demo game that you actually make (only on the basics of using Attributes, including the 'status attributes', but doesn't cover scripting, and thus not a combat system, but it shows you how to set up the Attributes and their displayment/adjustment during game play, such as... Life: 999/999):

http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help#37375


as for some combat examples:

http://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread#22485 (download Pertex' cleaned-up file for my combat code), and you can open it up, and take a look at it, and/or play/study it too) ... (oops, I forgot, this is still old code, and hasn't been updated for current quest version)

you can still take a look at the code (but probably won't make sense to you) by simply right clicking on the downloaded 'test.aslx' game file, and opening it up with a text editor software: notepad, wordpad, Apple: text editor, notepad++, etc

if you want to be really brave... you can try updating the code yourself... lol:

top most line, change: <asl version="530"> , to: <asl version="560"> , or to (whichever is Pixie's current version of quest): <asl version="570">

scour through the code (or use the top menu bar's 'edit' option/feature 'find' option), looking for: type="stringlist" , and,  type="stringdictionary" , and change them by adding 'simple' in front of them, like so: type="simplestringlist" , and, type="simplestringdictionary" , and hopefully that's all the updating that is needed...

(I'll see if I'll not be lazy and get it updated, and cleaned-up too, and uploaded for you sometime tomarrow)

and here's my legend/key for it (I've learned to NEVER ever do/use abrevs ever again, lol. As I get them mixed up, I got my 'pd: physical damage' mixed up with my 'pr: physical resistance' I think in some of my code, argh:

http://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread#22486


ask if you need help with anything.


creating text adventure with offline/desktop Quest. the first link is more technical level so i am still quite uncertain.

perhaps i should be a bit specific: under the player object attributes i have
KEY VALUE
HP 100
Immunity Fire
Weakness Ice


alright, first see if you can follow this (and if you need help, ask me), as let's do this first, learning how to do the basics of Attribute usage:

http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help#37375

let's get this understood and done/finished, and then we'll move onto learning how to do the scripting (usage of your Attributes), okay? let's take this learning in steps to make it easier for both of us, hehe.


combat requires the use of Attributes and scripting, so we got to learn these first, before we can get into combat designs.


oh i was looking just at "Status Attributes" thats one mistake solved....
also, can't i just skip putting attributes on the game object and put them on the player object?


sure, I was jsut showing that you can use the special 'game' Game Settings Object and the 'player' Player Object, so you can see how they work through having them in effect at the same time, but go ahead and only do the stuff for one of them (don't do all the stuff for the other one). If you choose to use the 'game' Game Settings Object, then only do all of the 'game' stuff, don't do any of the 'player' stuff. And the same for if you use the 'player' Player Object, in vice-versa.

the 'status attributes' are only for (and only work for Attributes within) the special 'game' Game Settings Object and Player Objects (such as the default 'player' Player Object -- you can create more Player Objects and switch between them too).


here's a sample game for you, showing a simple (only the 'attack' as an option, no 'magic/cast', no 'item usage', no 'escape/flee', no 'defend', no etc etc etc combat options) example combat design:

(create a new text adventure game, save it somewhere you can find it at, such as the 'desktop', right click on this 'xxx.aslx' game file you made, open it in/with notepad, highlight all of it, delete all of it, highlight my code below, copy my code below, paste my code into your game file, save your game file. open your game file in the GUI/Editor and study it, and play it too, to see it in action)

<asl version="550"> // or do: <asl version="560"> // or do: <asl version="570">

  <include ref="English.aslx" />
  <inlcude ref="Core.aslx" />

  <game name="combat_sample_game">
    <gameid>14940bcf-bfa0-45ad-8c7c-4ec787b5586b</gameid>
    <version>2.0</version> // adding in some prompts (msg scripts) for how much damage done and life remaining as you fight, and also for the looting part too.
    <firstpublished>2017</firspblished>
    <author>HegemonKhan</author>
    <category>DEMO</category>
    <description>This is 100% free fom the public to, use and modify, its parts and/or in-full too</description>
  </game>

  <object name="room">
    <inherit name="editor_room" />
  </object>

  <object name="player">
    <inherit name="editor_object" />
    <inherit name="editor_player" />
    <attr name="parent" type="object">room</attr>
    <attr name="current_life" type="int">999</attr>
    <attr name="damage" type="int">100</attr>
    <attr name="current_experience" type="int">0</attr>
    <attr name="current_currency" type="int">0</attr>
  </object>

  <object name="orc">
    <inherit name="editor_object" />
    <attr name="parent" type="object">room</attr>
    <attr name="dead" type="boolean">false</attr>
    <attr name="current_life" type="int">500</attr>
    <attr name="damage" type="int">50</attr>
    <attr name="experience" type="int">300</attr>
    <attr name="currency" type="int">600</attr>
    <attr name="fight" type="script">
      <![CDATA[
        if (orc.dead) { // if orc is dead
          firsttime {
            player.current_experience = player.current_experience + orc.experience
            player.current_currency = player.current_currency + orc.currency
            msg ("You loot the dead orc's corpse.")
            msg ("You gain +" + orc.experience + " experience, now having " + player.current_experience + " experience")
            msg ("You gain +" + orc.currency + " currency, now having " + player.current_currency + " currency")
          } otherwise {
            msg ("The orc is already dead, and also its corpse has already been looted by you, silly.")
          }
        } else { // if orc is alive
          orc.current_life = orc.current_life - player.damage // you go first, attacking/damaging the orc
          msg ("You attack the orc for " + player.damage + " damage, the orc now has only " + orc.current_life + " life remaining")
          if (orc.current_life < 1) { // if orc killed
            orc.dead = true // setting the orc as actually being dead (via this 'orc.dead' Boolean Attribute)
            msg ("You killed the orc")
          } else { // if orc not killed
            player.current_life = player.current_life - orc.damage // orc's turn, attacking/damaging you
            msg ("The orc attacks you, doing " + orc.damage + " damage, you now only have " + player.current_life + " life remaining")
            if (player.current_ life < 1) { // if you were killed
              msg ("You were killed by the orc")
              msg ("GAME OVER")
              finish
            } else { // you were not killed
              do (orc, "fight") // the fight continues (looping this 'fight' Script Attribute / Verb) until one of you is dead
            }
          }
        }
      ]]>
    </attr>
  </object>

  <verb>
    <property>fight</property>
    <pattern>fight</pattern>
  </verb>

</asl>

set variable player.life = [expression] player.current_life + "/" + player.maximum_life not working: says unknown variable or object"player"

i thought this was since i had named the player object to Alex, so i replaced "player." with "Alex." on attributes and test objects
but this somehow made it worse


if you (re)named your 'player' Player Object as 'Alex', you'll ahve to replace every use of 'player' with 'Alex' (it's easier to do this in code... if trying to do this in the GUI/Editor, you'll have to go look at all of the Attributes of the 'Attributes' Tabs of various Objects, including the special 'game' Game Settings object,, and also look at all of your Functions too, or whatever else... again, much easier to do in code)

if you simply used 'Alex' as the 'alias' (String Attribute or in the GUI/Editor: the 'alias' text box) for your 'player' Player Object, then you do NOT replace any use of 'player' with 'Alex' !!!!

the 'name' String Attribute is the 'ID' for quest, whereas, the 'alias' is just a String Attribute that quest really doesn't care about, lol.

LASTLY, QUEST IS CASE-SENSITIVE:

'Alex' is NOT the same as 'alex'
'alex' is NOT the same as 'ALEX'

etc tons of combinations of upper/lower case usage, lol


also...

instead, you can use 'game.pov' (replace all uses of 'player' with it), which will work regardless of what you (re)named your 'player' Player Object as, for example:

set variable game.pov.strength = [EXPRESSION] 100
// is the same as doing:
set variable player.strength = [EXPRESSION] 100
// is the same as doing (if you named/re-named your 'player' Player Object as 'Alex'):
set variable Alex.strength = [EXPRESSION] 100

the 'game.pov' references who-ever is your currently controlled Player Object, thus it's universal, it works regardless of what you named your 'player' Player Object as, and regardless of which Player Object (if you got multiple Player Objects) you are currently controlling. Though, it has a con/neg side effect, in that if you don't want something to be applying to specific Player Objects, then you'll not want to use 'game.pov', to prevent it from happening.


let me know if you still need help or are confused


understanding Attributes (VARIABLE usage) and scripting is a big step up from just going going through the tutorial and learning the basics of using the Text Adventure and its GUI/Editor and/or Game Book and its GUI/Editor.

this is NOT easy to do, it'll take some time, and even if you kinda start to get it, all of the different terms will get confused and/or you don't really understand them fully, being totally overwhelmed (like I was 5 years ago when I found quest, no knowing anything at all about programming/coding, nor game making, hehe).

Jumping into this immediately, will cause you to be very confused... don't worry, you shouldn't even be jumping into this so soon. This is quite advanced stuff if you're completely new to programming coding and/or with using quest.

However, if you can learn Attribute usage and scripting, you can do 90% of everything/anything you want to do with/for/in your game! Attributes and scripting open up nearly everything for your game making, but it's not easy to learn.


@ soapy (and chesiretiger):

are you able to understand/follow this stuff a bit?

if not, let me know, and I'll try to help you on getting it understood.


"
perhaps i should be a bit specific: under the player object attributes i have
KEY VALUE
HP 100
Immunity Fire
Weakness Ice
(chesiretiger)
"


we're NOT going to be doing damage types and effects (fire vs water, earth vs air, etc etc etc ----- strong, weak, immunity, absorption, reflection, etc effects) for awhile ... that's too complicated/advanced for us to get into right now as you're still trying to just learn Attribute usage and scripting.

Doing damage types and effects uses Dictionary Attributes (which are even more advanced than List Attributes, and List Attributes are more advanced than the normal/basic Attributes of: String, Boolean, Integer/Double, and Object reference/pointer Attributes), and some advanced logic/concepts too with it.


as you probably already realize/experience, even the seemingly simpliest of things/mechanics/etc are actually not so simple...


SyntaxError: unexpected token"/"; expected one of "-"
this is constant weather i use "player." "Alex." or "game.pov."

it seems ive mistyped that specific part of the player object's attributes


The simplest, absolutely simplest system would be to add "hit" to the enemy object...
That way, when you encounter the creature, you can "hit" it, and if you do, hurt it, but have code so that it could hit you back.
And, if you hit it enough, it will drop dead...
The combat could be avoided if you never "hit" the creature.
Then, just expand that as you want to add other options..


i am trying to figure out players HP for when the player object does get hit back.

maybe it would be simpler if i removed 'maximumHP' from attributes?
but then "Player HP: !" dosent work...

At this point, it might be easier to put in something like
End Game if "Alex" is 'hit' by "first Enemy" 5 times


No, keep it.
If player is hit...
damage=GetRandomInt(1,6)
player.HP=player.hp-damage
msg("You were hit for " + damage +" points")
if (player.hp >0){
msg(".")
else
msg(", and died.")
// add something here to stop the game
}


Just to be clear, that would mean
HP as interger at 100
currentHP as script: Set Attribute at player.currentHP = player.HP - damage
Under player object Attributes, right?
and the rest can be done with scripts when interacting with the enemy object?


Yes.
I set-up all my variables at the start of the game.
If you add a room called "intro" and put the player object in that room...
You can set-up every thing needed in the game and give the player a starting point.


all of your (dark lizerd and chsiretiger) code lines within your posts, would be errors, as the spelling of the 'names' (of the Objects and their Attributes) must be EXACT/CONSISTANT:

If player is hit...
damage=GetRandomInt(1,6)
player.HP=player.hp-damage // ERROR: player.HP vs player.hp
msg("You were hit for " + damage +" points")
if (player.hp >0){ // ERROR: player.HP vs player.hp
msg(".")
else
msg(", and died.")
// add something here to stop the game
}


currentHP as script: Set Attribute at player.currentHP = player.HP - damage // ERROR: player.currentHP vs player.HP


names are the 'ID' in quest (IDs are unique: DNA is an ID, I and only I have my DNA, and your DNA is your and only your DNA, it's the same with the 'name' String Attribute in quest), you must be precise/exact/consistant!

if I want 'Joe' to go to the movie with me, I don't call 'Mat' go to the movie with me, nor do I call 'joe' to go to the movie with me, as 'Mat' and 'joe' are NOT 'Joe'.


@ ChesireTiger:

I would try again/start over (create a new text adventure), with my step by step guide, and just follow everything in it, just to see and understand it, and/or anything you don't understand, we can go over it so you do understand it.

As right now, you're trying to change stuff, and you don't fully understand how Attributes and scripting works, and thus you don't know how to change stuff so that it works for you, and thus you're running into errors.


or...

you can just post your entire game code here, and I can look over it, fix it up, and explain your mistakes to you and about what you were messing with and why you messed it up and how I was able to fix it up, etc etc etc

to get at your entire game code (the easiest way):

simply right click on your 'xxx.aslx' game file, and open it with notepad (or if on Apple computer: text editor), everything that you see, is your entire game code, so we want to highlight all of it, copy it, and then paste it here as a post.

to add (paste) it to a post, you need to put it into a code box, as this preserves all of the formatting (making it much easier for us to read it and fix it up):

m```
(paste your entire game code here)
m```

but without the m's in front, producing this:

(paste your entire game code here)

also, try out my combat code (a few posts up) to see it in action:

create a new text adventure, save it somewhere you can find it at (such as the desktop), close out of it, right click on it (the 'xxx.aslx' game file itself), open it with notepad (or if Apple: text editor), highlight all of its code, delete its code, highlight my combat game code, copy my combat game code into your blank 'xxx.aslx' game file, save your game, close out of it, open it up in the GUI/Editor and study it, and also play it to see it in action.


You can check out this https://www.youtube.com/watch?v=gKwVvT5Tyy0 tutorial i did in the gui editor, never finished the series but should get you going. Also here is a weapon and combat system https://www.youtube.com/watch?v=yiQRfCjl1Lg there is a download link below in the description of the video to copy and use for reference. The video itself shows you how to use the system to make new weapons, ammo and so on.


awesome! onimike's videos to the rescue !!! (hopefully, hehe) :D (bookmark/favorited the url/youtube page, so I can now reference it for people, ... if I remember that I did... lol)

watching videos might be best for you guys/girls, than trying to understand our attempts at explaining and guiding with words/posts.


I just know i always had a hard time trying to under stand code when typed, thats why i tried these basic tuts. Also learned the gui editor by coping code and seeing what it changed to to be able to use in editor lol.


watched briefly some of your vids, they're very good and well done!


Sorry... BASIC is not case sensitive....
That is one thing that is so bad with Quest.


it's not big deal, though for people new to coding (not used to the 100% error free sensitivity of typing that coding / game making requires), it causes un-needed errors which confuse people even more and freak them out, not realizing it's a simple error and fix.

For people who're familiar with the sensitivity of coding, it's not a big deal, as we understand to go back and fix up the code lines so the typing/spelling matches up.

it's just good to be as error free as you can be for people new to coding, so that they can use your code, and it actually works for them. Though, we/I do use a lot of pseudo-code, which I need to explain and make more clear of when doing so, myself.


o.k. i think i can handle it with this info you guys have shared.
Big thanks to DarkLizard and hegemonkhan.
:-)


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

Support

Forums