News:

SMF - Just Installed!

Main Menu

[Mod] Heroes

Started by ImpassIve, October 18, 2012, 09:21:35 PM

Previous topic - Next topic

ImpassIve

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.




Moo

#1
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.

ImpassIve

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

#3
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




Moo

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

#5
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
QuoteIf 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.




ImpassIve

#6
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)




Stephen

Very nice work ImpassIve! I will have a look at this later :)

ImpassIve

I have made a new 0E snapshot.

I hope, it will fix current bugs.

P.S. Moo & Stephen - thanks)




Moo

Yes, I haven't been able to find any problems with this version.

doublejack


ImpassIve

#11
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).




Stephen

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

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

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.