Simple combat code update + working on a new system

*cough Sorry.
I made this in reply to this old thread.
Basic simple combat 2
Turn based 2
The old thing was getting too big, and I'm working on a new system which will lock and unlock multiple rooms. I will post the code here when I'm done.
It's a fantasy-something or other game where the goal is to fight monsters with a fish (exactly how it sounds), then defeat the monster at the end. There are 100+ (have not counted exactly) rooms, and I'm just a few hours from completing it.

Made on web quest. If you use a different program, do not attempt unless you know what you are doing.

I would just like to put that I've updated the game's code.
Link to the game here:


I've edited the attack script. (Because grammar) It looks like this now:

if (not game.notarealturn) {
  list = NewObjectList()
  foreach (obj, GetDirectChildren(player.parent)) {
    if (HasBoolean(obj, "dead")) {
      if (not obj.dead) {
        do_attack (obj, obj, player, false)
        list add (list, obj)
  foreach (obj, ListExclude(player.attackers, list)) {
    if (not obj.dead and RandomChance(80)) {
      obj.parent = player.parent
      msg (CapFirst(obj.alias) + " shambles into the area.")
      list add (list, obj)
  player.attackers = list
game.notarealturn = false

Adding this here for filler.
I also have a new function. It looks like this:

if (firearm) {
  damageatt = "firearmdamage"
  attackatt = "firearmattack"
  weapon.ammo = weapon.ammo - 1
else {
  damageatt = "damage"
  attackatt = "attack"
roll = GetRandomInt(1, 20) + GetInt(weapon, attackatt) - target.defence
if (HasInt(weapon, damageatt)) {
  damage = GetInt(weapon, damageatt)
else {
  damage = DiceRoll(GetString(weapon, damageatt))
damage = damage * (100 - target.armour) / 100
if (damage < 1) {
  damage = 1
if (roll > 15) {
  damage = damage * 3
  msg (CapFirst(attacker.alias) + " attacks " + target.alias + " and gets a critical (" + damage + " hits)!")
  target.hitpoints = target.hitpoints - damage
else if (roll > 5) {
  msg (CapFirst(attacker.alias) + " attacks " + target.alias + " and hits (" + damage + " hits).")
  target.hitpoints = target.hitpoints - damage
else {
  msg (CapFirst(attacker.alias) + " attacks " + target.alias + " and misses...")

(Same parameters as DoAttack)

I've also been working and testing out some new systems. First, I tried a lock system which would lock a player in a room. But that's taking too long. Then I tried making a teleport system, but I made a never ending loop where I spawn monsters and keep spawning back to the same place.

Will come back if anything changes.

Give us somee more informations please. Which code did you update (files? Quest core code or Libraries?)? Why did you do it?

Oops. Sorry.

In reply to this old thread.

(Look up for rest)

I finally got the lock system done.

How to Lock and Unlock multiple rooms at once.
I did this to make the game more difficult (and also thanks to a suggestion). If you want to do this yourself, I suggest using a Show Menu system or a teleport (move both the player and the enemy to a different room) instead. I would have done the menu system, but that would mess up too much of my too fragile code, and I tried making a teleport system, but I made an infinite loop where I spawn back and forth into the same two rooms.

Edit: The teleport code works now. You can use it now.

I use the online editor/web Quest. If you don't use those programs, don't proceed unless you know what you are doing.

This also uses the Code View.

You can see the code in action yourself:

Teleport system
Again, I use the online/web Quest. Do not proceed unless you know what you are doing.

I also tried making a Teleport code too. Use it for reference.

You will need a way to control the monsters spawning to do this. Maybe the First function, or something.

(Also, does anyone know why that when I try to edit my post up there, and I add some enters between the code to make it easier to read, the thing says "Sorry, You can't post that here," or something?)

some kind of posting/editing restrictions/rules, the method I use that I found to work is this:

pretend that this is my post:

blah blah blah blah post writing and/or code

then I go to edit it:

blah blah blah blah post writing and/or code mmmmmmmmmm

ERROR, you can't update/post your edited post.

so I do this:

(filler for getting my edited post updated/posted)


blah blah blah blah post writing and/or code mmmmmmmmmm

it seems you got to add a certain amount new content/characters/symbols and it helps to add it at the top, if you want to quickly edit your post, otherwise, you got to wait like 5-10 minutes before you can edit your post.

I haven't quite figured out the exact rules/restricts of the posting/editing.... though.

However, using the '(filler..............)' at the top has always worked so far.... lol.


if you do a 2nd editing and get blocked again, then just add another '(filler..........)' line, lol:

(filler for getting my edited post updated/posted)
(again, filler for getting my edited post updated/posted)


blah blah blah blah post writing and/or code mmmmmmmmmm pppppppppppppppppppppp

Thanks HK. Seems to work perfectly.

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