Author Topic: [Mod] Heroes  (Read 7075 times)

ImpassIve_rus

  • Sr. Member
  • ****
  • Posts: 84
  • 0_o
[Mod] Heroes
« on: October 18, 2012, 09:21:35 PM »
Heroes v1.1


Last update:
June 26, 2014


Description
This mod adds a new game type - Heroic quest.
Main features are:
1) New monster type (available only during this quest) - Barbarians. Fast, strong and furious. (Or, at least, they supposed to be such)
2) No unlimited respawn. The death is permanent.
3) New items:
   - Barbaric gem (tiny violet gem) - can be picked up from a barbarian's corpse. You will not lost them after death.
   - Reviving gem (big red gem) - you can carry only one in a same time and you can't drop it (will be dropped after death). Allows you to revive once.
4) Victory condition - you should obtain 6 barbaric gems without being killed. (in fact, you can still win by eliminating all other knights, but I am not able to fix this)

To-do list
1) Any display of other's score.
2) A special room for barbarian's respawn (something like their base).
3) Medkit, shield and some other stuff.
4) ??

Additional notes
- Did you know... what barbarians can be trapped using bear trap?
- Amount of barbarians depends on number of players and can't be changed.
- Use 'number of gems' field to determine amount of reviving gems.
- This mod requires Toolbox mod of, at least 2b version (current version... 4.1).
- If you are using dev version of knights, you can unlock a 'Heroes++' mission type. You can do this by editing 'config.lua' file and setting up 'DEV = true'
    At this moment I am making a ranking system based on this type of mission.

Known bugs
- There are some troubles with combining gems of barbarians killed in motion. Solved?
- If you will "override" barbarian's corpse by killing another creature on the same tile - barbaric gem on the floor will be lost. Solved?
- It is incompatible with Romanio's Rat Rider mod. For this reason I forbid players to add any rat riders during heroic quest.
Installation
1) Download and install toolbox mod first! If you already had it - make sure that it is up to date. (at least 2b version)
2) Download "heroes_0E.zip" from attachments
3) Unzip it into "<path to your knights>\knights_data\server"
4) Put 'require ("heroes")' line into "knights_data\server\main.lua"

____________________________________________
Any questions, comments and suggestions are welcome.
Feel free to study and use any part of the source code.
« Last Edit: August 05, 2017, 12:57:58 PM by ImpassIve_rus »


Moo

  • Sr. Member
  • ****
  • Posts: 62
Re: [Mod] [WIP] Heroes
« Reply #1 on: October 18, 2012, 10:22:05 PM »
Very nice  :)

It seems to sometimes not add the gem amount when I pick them up though... For example, I find one gem, it says I picked up a gem, total:1. I get another, it says I picked up a gem, total:1 again. I've even seen it say total:0 when getting first gem.
Also it seems killing barbarians sometimes doesn't add to the number of gems in that spot either.
« Last Edit: October 18, 2012, 10:26:51 PM by Moo »

ImpassIve_rus

  • Sr. Member
  • ****
  • Posts: 84
  • 0_o
Re: [Mod] [WIP] Heroes
« Reply #2 on: October 19, 2012, 12:21:26 PM »
I tried to reproduce this bug, but was unable to do this (will try again, maybe, using crossbow/throwing axe instead of just a sword).
Anyway, I have some suggestions about that - and found another bug, caused by the same error.

1) If you killed a barbarian and got his gem - you can bring on this tile another barbarian and kill him - in this case you will get 2 gems instead of 1 (3 instead of 2 in total), and so on. I can fix this.
2) Also, getting '0' gems can be fixed.

But I still don't know the root cause of this problem.
Can you in detail describe the situation?
Do you have any other mods installed, who killed this barbarian, was he (barbarian) standing or moving at this moment and so on.


ImpassIve_rus

  • Sr. Member
  • ****
  • Posts: 84
  • 0_o
Re: [Mod] [WIP] Heroes
« Reply #3 on: October 19, 2012, 12:27:08 PM »
I have changed one function. Please, try this again:

P.S. Main thoughts about cause of this bug are:
1) A barbarian was killed while moving, so, information about his corpse for some reason was written by my function in a wrong slot.
2) Maybe, he was killed without sound? (I should try some wands on it)

UPD: I have found another possible cause of the bug:
I was using "cxt.actor" after calling "Delay" function. That was my fail
« Last Edit: October 19, 2012, 02:46:57 PM by ImpassIve_rus »


Moo

  • Sr. Member
  • ****
  • Posts: 62
Re: [Mod] [WIP] Heroes
« Reply #4 on: October 19, 2012, 02:56:47 PM »
Ok, using 0c I was able to isolate one issue - killing a bat or zombie on a square which should have gems erases them. You get no message about picking up a gem.

So this wasn't my original issue, but that seems to be mostly fixed now. The only reliable thing I've managed to find for that in 0c is when you kill two barbarians in the same place using the wand of destruction, you only get one gem. I think I've had similar things happen at other times too, but hard to tell really, and certainly much less than I was having with the original version.

One other little issue; if there's a dead barbarian in a doorway and you close the door, the corpse is drawn on top of the closed door.


ImpassIve_rus

  • Sr. Member
  • ****
  • Posts: 84
  • 0_o
Re: [Mod] [WIP] Heroes
« Reply #5 on: October 19, 2012, 03:36:55 PM »
1) Killed 3 barbarians in the same tile using wand of destruction but got only 2 gems. The problem is located, so it will be easier to fix it.
2) Yes, a problem with other corpses overrides barbarian's corpse exists. "Pick up a gem" event linked to <Tile>.on_walk_over function. So, no corpse - no gems.
I was supposing to implement barbaric gems using items (just as reviving gem), but there is a problem, because kts.PlaceItem
Quote
If an item is already present at the given location, then this function will fail (and return false).
So it is hard to place gem(s) in one particular spot.

UPD: yes, as I have supposed, if a barbarian will be killed while moving (usually happens while using powerful weapons, such as wand of destruction) - hook "HOOK_CREATURE_SQUELCH" will get (at least, sometimes) an "old" position of this barbarian while the corpse in fact will be placed in the next cell. I don't know how to solve such issue. Possibly, I will have to do add more complex checking to this function.
« Last Edit: October 19, 2012, 04:06:56 PM by ImpassIve_rus »


ImpassIve_rus

  • Sr. Member
  • ****
  • Posts: 84
  • 0_o
Re: [Mod] [WIP] Heroes
« Reply #6 on: October 19, 2012, 04:36:50 PM »
Ok, the last snapshot for today (I will continue bug-fighting tomorrow)

- Removed wand of destruction (1 - it will be harder to cause a "killed in motion" bug, and I will try to fix it later. 2 - too easy to kill 6 barbarians using it. Not interesting).
- Added "Debug" option. Edit config.lua and set DEBUG_ENABLED to true. If you would do so, you will not be eliminated after death and you will get some debug messages.
- A first attempt to fix "replacing corpse" bug. If some creature (not a barbarian) was killed, and there were barbarian's corpse - the mod will try to place a new barbaric corpse over it. May cause a duplicating if combined with "killed in motion" bug. Also, not stable.

(ah, that is sad, that we don't have a separate "CREATURE_DEATH" hook. In that case "killed in motion" bug would be auto-fixed)

P.S. Note: 0d (just as other versions) is unstable. I will improve the code today (have several ideas)
« Last Edit: October 20, 2012, 01:33:25 PM by ImpassIve_rus »


Stephen

  • Administrator
  • Hero Member
  • *****
  • Posts: 259
Re: [Mod] [WIP] Heroes
« Reply #7 on: October 20, 2012, 12:54:41 PM »
Very nice work ImpassIve! I will have a look at this later :)

ImpassIve_rus

  • Sr. Member
  • ****
  • Posts: 84
  • 0_o
Re: [Mod] [WIP] Heroes
« Reply #8 on: October 20, 2012, 07:00:56 PM »
I have made a new 0E snapshot.

I hope, it will fix current bugs.

P.S. Moo & Stephen - thanks)


Moo

  • Sr. Member
  • ****
  • Posts: 62
Re: [Mod] [WIP] Heroes
« Reply #9 on: October 21, 2012, 11:08:16 AM »
Yes, I haven't been able to find any problems with this version.

doublejack

  • Jr. Member
  • **
  • Posts: 10
Re: [Mod] [WIP] Heroes
« Reply #10 on: October 22, 2012, 05:20:42 PM »
added to modlist

ImpassIve_rus

  • Sr. Member
  • ****
  • Posts: 84
  • 0_o
[Mod] Heroes v1.0 is out!
« Reply #11 on: October 25, 2012, 12:48:02 PM »
Heroes v1.0 is out!

Since those pesky bugs were removed I decided to clear [WIP] tag.

Also, some changes were made in this release:

1) In 'Heroes' mission some restrictions were decreased.
Just as it was before v0E, you can use Wand of Destruction again, "Tiny" size of dungeon is available and some other...

2) Romanio have released his "Rat Rider" mod today. Unfortunately, these mods are incompatible now (because they both using kts.Delay to detect creature's death. This problem would be solved by Stephen's Monster Proposal ). For this reason you can't place rat riders during heroic quest.

3) I began making 'Dev' version of the mod. It uses some functions what are not implemented in current 21 release but already exists in dev versions of knights.
It is in testing right now. A bit more information about this can be found in the first post (additional notes).
« Last Edit: October 25, 2012, 01:43:10 PM by ImpassIve_rus »


Stephen

  • Administrator
  • Hero Member
  • *****
  • Posts: 259
Re: [Mod] Heroes
« Reply #12 on: October 25, 2012, 04:30:10 PM »
I tried this, it is quite good fun. Would be interesting to try as a multiplayer game.

I didn't find any bugs.

The permadeath is interesting... for example, drinking potions is risky (without a reviving gem) because if you get poison, then it's game over :)

Moo

  • Sr. Member
  • ****
  • Posts: 62
Re: [Mod] Heroes
« Reply #13 on: October 25, 2012, 05:03:43 PM »
The revive-gem system works very nicely to make a challenging single-player knights game, but I think there could be problems for multiplayer... We'll see, I guess.

ImpassIve_rus

  • Sr. Member
  • ****
  • Posts: 84
  • 0_o
Re: [Mod] Heroes
« Reply #14 on: October 25, 2012, 05:18:22 PM »
Hmm ... Yes, it seems to be true. =(
There is way less direct interaction between players... Because they will either kill each other (and the game will ends pretty fast for one of them) or they will try to co-operate against barbarians (especially if there is no reviving gems in the dungeon)... but there is  no strict reason for cooperation because even single player with a bit of luck can kill them all and win.

P.S. According to the original idea, all players should be in the one same team. But I have tried to do this... The game finishes with "Win" message as soon as anybody dies, because obviously there is no 'opponents' (members of other teams) alive.