Author Topic: Duel Kit v0.5 released - duel your troops, companions, lord and kings.  (Read 6079 times)

0 Members and 1 Guest are viewing this topic.

MartinF

  • Squire
  • *
  • Down Under
    • View Profile
  • Faction: Neutral
Hi guys,

as some of you have probably already seen I've been working on a kit for duelling based on an idea by Phosphoer in this thread. I've since been adding on bits and pieces until it has come to the stage where I think it's ready to be a standalone kit that you can implement into your own mod if you want to. So I'm hereby releasing version 0.5

Feel free to use this for whatever you want, but a credit would be nice. And please let me know so I can try it out :)

Credits and thanks

  • Phosphoer - original idea and original code
  • Jinnai - help with the coding and explanation of slots.
  • HokieBT - Screenies and bugfix

Features

  • Practice duelling with your own troops, from recruits to knights
  • Duel your companions. Firentis bitching about Katrin again? Beat the shit out of him! :D
  • As your renown increases, duel lord and eventually even kings!
  • Duel mounted or on foot using a range of weapons options: your own weapons, sword and shield, 2-handed weapons or ranged weapons.
  • The kit keeps track of how many times you fight a certain npc and whether you win or lose. The dialog changes accordingly.
  • Duels take place in arenas

They way it works is very straightforward. You start a conversation with a (neutral or friendly) lord or king and say "I want to ask you something". It will then come up with the option to challenge them to a friendly duel. They'll either accept or decline based on your renown.
If they accept, they'll ask you a series of questions which determine whether you'll fight mounted or unmounted and which weapons you'll use.
For your own party members, go to the party screen, select a unit and press 'Talk'. Then for your normal units the option will show up straight away, for companions again you click "I want to ask you something".

Note: After the dialog closes, it will put you back into the party screen or the scene you were in when you addressed the NPC. Press <Tab> to exit the scene and go to the duel menu, or press close in the party screen.


So now to implementing it. No original code needs to be changed, you're just adding stuff. You'll need to edit the following files:

  • module_constants.py - 2 places
  • module_dialogs.py - 1 place
  • module_game_menus.py - 1 place
  • module_mission_templates.py - 1 place

module_constants.py

I use slots which have to be added to the constants file, as well as two constants for setting the minimum renown needed to duel lords and kings. Where you put them doesn't really matter. For consistancy I put the slot_troop pieces with the other troop slots and the constants all the way at the end of the file.
Note, if you've already added extra slots, you might want to change the numbers. These are the first 'empty' slots for troop.

(click to show/hide)

module_dialog.py

This is where most of the jazz happens. There are different dialog bits for the four different types (troops, companions, lords and kings). The dialog also sets up the fight. All this is explained in the comments in the code itself.

Where you place it is not hugely important, but I would suggest just above the line "### COMPANIONS" as that works well for me

[edit] changed the first king dialog option to fix a bug, see post by Hokie[/edit]

(click to show/hide)

module_game_menus.py

This is the start and end of the each duel. This is where you see how many duels you've fought/won/lost against this troop.

Search for "simple_encounter" and put the right above that one.

(click to show/hide)

module_mission_templates.py

This is where the actual duel options are defined. I've used several different 'visitors' with different equipment. By assigning the player and his opponent to the different visitor numbers, they get different equipment. If you want to change the items you duel with, do it here. Of course you might have to change the dialog to reflect these changes. I've commented so you can see which one is which option.

Again, doesn't really matter where you put it, I've got it plugged in just under the "arena_challenge_fight" tuple.

(click to show/hide)

If you've done all thise like I told you, it should work. Build and play, my friends!

Some observations:

Duelling on horseback is somewhat lame, the AI seems to mostly just run around in circles, for future versions I'll have to look at that, maybe include the jousting thing from janus' arena expansion. Problem with that is that I would have to include scenes and it wouldn't really be a 'kit' anymore but a proper mod.
Kings are evil :D
Some Lords are more equal than others.. I guess this should already be obvious in the game and from looking at the troops.py but it's VERY obvious when one is bashing your head in with dramatic fervor.
It's all quite a lot of fun.

Future features and fixes
  • Make the transition from dialog to duel more smooth
  • Defeating a lot of lords and kings without losing will give renown gain
  • Report option so you can see your duel results with the various lords
  • Result based dialog for companions
  • More expanded dialog for lords and kings, make them really worked up or smug depending on results.
  • more, different and more useful duel options

If you have any problems or questions please let me know. Any bugs also. I've tested it quite extensively but you never know what can pop up.

Have fun!
« Last Edit: February 17, 2009, 09:13:12 AM by MartinF »

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #1 on: February 17, 2009, 05:47:30 AM »
just when I was about to go to bed you post this and I feel I must try it out..... If I'm tired at work tomorrow I'm blaming you!   ;)

edit 1: you might want to put your code in a code tag on the forum so long lines won't wrap around to new lines
edit 2: I only have 3 lords, the code was easy enough to fix, but maybe you could use a try_in_range and the kings_begin/end instead?

edit 3: this is AWESOME, nice work!!!

 

edit 4: more screenshots, this is really fun.

    
« Last Edit: February 18, 2009, 04:08:41 AM by HokieBT »
 

Keedo420

  • Knight at Arms
  • *
  • All glory to the Hypnotoad!!
    • View Profile
    • All glory to the Hypnotoad!
  • Faction: Bandit
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #2 on: February 17, 2009, 05:55:47 AM »


Yet another awesome script that I must add to my mod! Many thanks to all those involved.

MartinF

  • Squire
  • *
  • Down Under
    • View Profile
  • Faction: Neutral
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #3 on: February 17, 2009, 06:12:07 AM »
just when I was about to go to bed you post this and I feel I must try it out..... If I'm tired at work tomorrow I'm blaming you!   ;)

edit 1: you might want to put your code in a code tag on the forum so long lines won't wrap around to new lines
edit 2: I only have 3 lords, the code was easy enough to fix, but maybe you could use a try_in_range and the kings_begin/end instead?

edit 3: this is AWESOME, nice work!!!

 

Thanks mate.. yeah I think I had the try_in_range first, but it wasn't working properly.. something to do with the overlap of units but there's no reason it shouldn't work, so I'll change accordingly.

[edit] after looking at my own code, it must've been an oversight, cause I did use (is_between..) for the second bit of king code.. oops :) [/edit]

As for the <code>, when I use that, I lose all the indentations and when I cope/paste it all just comes out as one line but maybe that's a problem on my end so I'll change that as well.

[edit2] I also found a bug and fixed it so if you've already implemented the code, check it over. In the lord_decline_duel option in the dialog, it is supposed to say 'a lord' instead of 'a king', which is not such a big deal but also the dialog it refers to is wrong. It's supposed to be "lord_talk_ask_something_2" instead of whatever it said. Make sure you change it or the game will get stuck when you try to duel a lord and don't have enough renown.
« Last Edit: February 17, 2009, 09:15:49 AM by MartinF »

jik

  • Knight
  • *
    • View Profile
  • Faction: Neutral
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #4 on: February 17, 2009, 03:44:37 PM »
hey, about the having to hit TAB to start the menu option, This is similar to the dialog for dueling on the lady's behalf.  in the code near the bottom,
(click to show/hide)

they have this:
    (set_jump_mission, "mt_arena_challenge_fight"),
    (jump_to_scene, ":arena_scene"),
    (try_begin),
      (neq, "$talk_context", tc_court_talk),
      (jump_to_menu, "mnu_arena_duel_fight"),


I'm going to try this (the set_jump_mission thingie) with what I have right now.  It don't understand the tc_court_talk.  The constant equals 1, but not sure what this is testing.
« Last Edit: February 17, 2009, 04:00:00 PM by jik »

MartinF

  • Squire
  • *
  • Down Under
    • View Profile
  • Faction: Neutral
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #5 on: February 17, 2009, 04:41:30 PM »
yeah, not sure what that does either.

I moved that whole jump_to_scene bit to the game menu because of the way it's built, this was after a tip from jinnai. Can't think of the reason right now but it's in the other thread. I think it was to enable the 'duel again' function. In fact, come to think of it, I'm sure of it.

In the duel for lady quest, everything is done in the dialog and you go straight into the fight, there's no menu. But I wanted that as it's also where I show the scores and what not. Plus, the 'duel again' option means you don't have to go through the whole dialog again every time.

Anyway if you get it to work better, please let me know!

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #6 on: February 17, 2009, 06:13:44 PM »
MartinF - thanks for the bug fix, I updated my code.   It would be cool if you could add the ability to bet money on the duel, probably limit that functionality to only kings and lords tho, since otherwise people could easily cheat by dueling their recruits.  ;)   I was also wondering if you could use this concept in non-friendly encounters....  Like challenge the opposing leader to a duel before a battle, and if you win then your side gets a tactics bonus or something?   Or challenge a friendly lord and if you win you get to choose 5 soldiers from his army...  Not sure if either of those really make sense, but this is a really nice piece of code, so I'm just trying to think of other uses for it...

edit: it might be nice if we could choose to switch weapons after a duel, not sure if that is possible.
« Last Edit: February 18, 2009, 04:09:31 AM by HokieBT »
 

jik

  • Knight
  • *
    • View Profile
  • Faction: Neutral
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #7 on: February 17, 2009, 08:53:08 PM »
yeah, not sure what that does either.

I moved that whole jump_to_scene bit to the game menu because of the way it's built, this was after a tip from jinnai. Can't think of the reason right now but it's in the other thread. I think it was to enable the 'duel again' function. In fact, come to think of it, I'm sure of it.
...
Anyway if you get it to work better, please let me know!

Well, leaving your menu changes alone, I added some of the stuff to my dialog.  Seems to work for both the end of the conversation going to the duel, and the duel again menu still there (though I need to clean that part out for the tutorial).  The code looks like this:
(click to show/hide)

ya, I hard coded the scene, and probably put too much in there since I could have just picked the scene, but this was just a test.  But it worked at both ends.


bravesirknight

  • Knight
  • *
    • View Profile
  • Faction: Vaegir
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #8 on: February 17, 2009, 09:29:32 PM »
Very cool for mods ... damn I say that a lot lately.  :mrgreen:

MartinF

  • Squire
  • *
  • Down Under
    • View Profile
  • Faction: Neutral
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #9 on: February 18, 2009, 05:50:04 PM »
MartinF - thanks for the bug fix, I updated my code.   It would be cool if you could add the ability to bet money on the duel, probably limit that functionality to only kings and lords tho, since otherwise people could easily cheat by dueling their recruits.  ;)   I was also wondering if you could use this concept in non-friendly encounters....  Like challenge the opposing leader to a duel before a battle, and if you win then your side gets a tactics bonus or something?   Or challenge a friendly lord and if you win you get to choose 5 soldiers from his army...  Not sure if either of those really make sense, but this is a really nice piece of code, so I'm just trying to think of other uses for it...

edit: it might be nice if we could choose to switch weapons after a duel, not sure if that is possible.

Hokie, thanks for the input. The betting is a good idea and will be easy to implement, I'll look at that tomorrow. I want to make it so your opponent will only take your bet if you haven't beaten him too many times more than he has beaten you. No one likes to be hussled after all :)

The other idea could be interesting.. settling a battle with a duel if army sizes are similar for instance. Not sure how easy that would be to implement, what with the hardcoded transition to battle in a hostile encounter, but it's worth testing.

Switching weapons for the next duel would be difficult with the way it works now. The way around that would be to move the whole duel setup process out of the dialog and into a game menu. However that would also make it somewhat less personal but I'll look into it.

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #10 on: February 18, 2009, 06:35:06 PM »
thanks, this is a really great feature, I hope it gets integrated into a lot of mods.  Switching weapons wouldn't be a big priority for me but the betting would be very fun.  I like your idea to put some logic in there so you can only bet if you haven't beaten them a lot so far, but you should still leave a way to have a friendly duel without a bet.    I added the Blackjack mod into my star wars mod and when you win/lose your relationship goes down/up by 1 point, but your idea of changing the renown is probably better.  You could even have a bet option to wager a castle/town if you both owned one, but that is probably a bad idea since people could cheat pretty easily just by loading a saved game multiple times...   :)
 

MartinF

  • Squire
  • *
  • Down Under
    • View Profile
  • Faction: Neutral
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #11 on: February 18, 2009, 06:49:14 PM »
Just checked out the new screenies from this kit in your topic here.

Looks really cool! It's great to see this implemented and the way you're adapting it great. Means I didn't waste all those hours coding the bastard :D

Can't wait to duel Darth Vader, hahaha!

BTW I will def make it so you can duel without betting, it's just going to be an extra option tacked on to the end.

jik

  • Knight
  • *
    • View Profile
  • Faction: Neutral
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #12 on: February 18, 2009, 07:17:02 PM »
I think betting should be a bit more complex.  I am looking to add that into my tournaments once my mod gets off the ground.

The amout they may wager should be based on a win/loss of money, not fight ratio.  If you do it that way, people will just throw some no bet matches and then bet big and smote the loser.  That's M&B hussling. :mrgreen:

I am hoping to implement betting of land in jousting, which I think I will move to after this week of updating the tutorial.  It's been a lot of work, and I have to keep passing up threads that would help me a lot in my mod.  I may end it for now at making a menu.

As to changing equipment between duels, why not have an inventory option from the menu screen.  This would mean that your first duel would be with what you have, but after that, go with what you want.

[EDIT]
Just thought of something and checked it out.  When you are confronted by a bandit, they offer to leave you alone for a sum of money.  If you pay it, the battle doesn't happen.  This is a hostile encounter, so there is a way out of a hostile encounter without going to a full out battle.  Here is the dialog, though since this just popped into my head, I haven't explored it at all. 
(click to show/hide)
But it may help with you confrontation with an enemy lord.  Maybe if your relation with him alone is good enough, or something.
« Last Edit: February 18, 2009, 08:23:36 PM by jik »

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #13 on: February 18, 2009, 08:58:27 PM »

jik - good find on the bandit encounter and paying money!  I can see the game menu now...  When a hostile encounter happens, you can choose a new option to duel the enemy lord.  If you lose then they attack, but if you win then they say they will be back later with reinforcements and you are  "protected_until" X hours.    ;)
 

jik

  • Knight
  • *
    • View Profile
  • Faction: Neutral
Re: Duel Kit v0.5 released - duel your troops, companions, lord and kings.
« Reply #14 on: February 18, 2009, 09:32:25 PM »

jik - good find on the bandit encounter and paying money!  I can see the game menu now...  When a hostile encounter happens, you can choose a new option to duel the enemy lord.  If you lose then they attack, but if you win then they say they will be back later with reinforcements and you are  "protected_until" X hours.    ;)

Sounds good, but I would put more polish on it.  Sounds too easy, though with the way the things are in the star wars universe, the outcome of a duel between Jedi might go that way.  Allowing an ambush in which you quickly (maybe a timed trigger as well) take out the opponent's leader, the band falls apart.  Not sure, but adds some interesting twists.  Let's just not take it too far.  Also, this is from the dialogs, though, I don't see why it can't work from a menu...