Author Topic: Customizable sparring matches  (Read 10173 times)

0 Members and 1 Guest are viewing this topic.

Jinnai

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Khergit
Customizable sparring matches
« on: February 18, 2009, 10:34:40 PM »
So I got bored a couple weeks ago and wrote some code which has been immensely helpful in testing mission triggers and troop or item changes, so I thought I would share with everyone.

What this code does is let you create customizable sparring matches.  When you go to a town and talk to the arena master there will be a new option to spar with your troops.  You then get to select how many teams will be fighting (2 to 4) and you are assigned to the first team.  Then you get to choose which troops from your party will fill out the rest of each team with up to 8 people per team.  Once you've selected it all you get thrown into the arena and the battle commences.  No damage is permanent and everyone has their standard gear.  If the player is knocked out, the battle does not end, that way you can watch how the battle goes between the remaining troops.  Hit tab to end the scene.

The code segments below are in two colors.  The black text is what should already exist in your file, and will help people who don't fully understand the module system to place the new code correctly.  The blue text is what to add.

module_mission_templates.py:
(click to show/hide)

module_dialogs.py: (Yeah I could have done some of this in a loop, but I didn't so people would be able to see what's going on easier)
(click to show/hide)

module_particle_systems.py:
(click to show/hide)

I think those are the only three files you need to edit, but it's been a while since I wrote this.  Let me know if it works or if I left something out and I'll fix it.  And if I'm in a good mood later I'll even share the code I use to let the player move the camera around after death to watch the fight from a better view.

EDIT: I added little flame clouds above the heads of all combatants.  The colors depict what team they're on. The player is always red, but feel free to play around with the team colors in the particle system thingy.
« Last Edit: February 19, 2009, 01:10:02 AM by Jinnai »
Native Expansion - A mod for M&B version 1.010/11

jik

  • Knight
  • *
    • View Profile
  • Faction: Neutral
Re: Customizable sparring matches
« Reply #1 on: February 18, 2009, 11:46:01 PM »
Cool.

Today I looked at your reply to the FALCON PUNCH thread, and though, if you can make a constant particle system around a troop, could you not make something like a flag floating above thier heads to show which team they are part of?  Ya it is more fun if you don't know, but it would be nice to have a marker of some type.  Jut curious if this is possible, or is it only possible with particles?

Jinnai

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Khergit
Re: Customizable sparring matches
« Reply #2 on: February 19, 2009, 12:00:08 AM »
The particle system for the falcon punch bit was by doing a burst every half second or so on the troop.  That's easy, just loop the agents and call the burst.  It's not a persistent item.  A marker over an NPC is an interesting idea, but requires generating static props, then linking those props to the agents (relatively easy using a slot), but then you need to update the locations of those props constantly and quickly.  Since you're limited to only 32 agents on the field it could probably work without a slowdown.  I'll look into it later tonight or tomorrow and see what I can come up with.
Native Expansion - A mod for M&B version 1.010/11

bravesirknight

  • Knight
  • *
    • View Profile
  • Faction: Vaegir
Re: Customizable sparring matches
« Reply #3 on: February 19, 2009, 12:24:28 AM »
Well if it's a very simply poly item like just a square flag or something shouldn't cause slowdown right?

Cool script btw.

Jinnai

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Khergit
Re: Customizable sparring matches
« Reply #4 on: February 19, 2009, 01:11:14 AM »
There you go, I added colored flames over the heads of all the living combatants which will reveal which team they're on.  That works a lot better than I expected, actually, and looks pretty cool at the same time.
Native Expansion - A mod for M&B version 1.010/11

HokieBT

  • Grandmaster Knight
  • *
  • may the force be with you
    • View Profile
  • Faction: Neutral
  • M&BWB
Re: Customizable sparring matches
« Reply #5 on: February 19, 2009, 06:17:59 AM »
well damn, you guys are coming up with some great scripts!   I added this to my star wars mod, very cool, thanks!

 

edit:  I wanted to remove the particle effects from the player so I added this code to the mission template.  It works fine but let me know if there is a better way I should be doing this...

(click to show/hide)

Also, is there anyway to add a battle summary at the end or something like that?   Its somewhat weird how you just jump back to the tournament master.   Regardless, very cool tho.
« Last Edit: February 19, 2009, 06:40:49 AM by HokieBT »
 
PC Gamer - "Uninstall KOTOR. Forget TIE Fighter and Star Wars Battlefront. There is only one Star Wars video game, and it's an unfinished mod for a six-year-old medieval RPG built by an indie studio from Turkey."

Jinnai

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Khergit
Re: Customizable sparring matches
« Reply #6 on: February 19, 2009, 11:11:52 AM »
That's exactly how I would remove it for the player.  I considered removing it as well, but figured I'd leave it in just to make it clear to the player which team they were on. ;)
Native Expansion - A mod for M&B version 1.010/11

jik

  • Knight
  • *
    • View Profile
  • Faction: Neutral
Re: Customizable sparring matches
« Reply #7 on: February 19, 2009, 01:19:04 PM »
can you post your update?

I was thinking more of a 'ping' box that would appear every so often (sonar ping).  The flame thing seems kind of an overkill for what we are using it for.  A faded (alpha-ed) circle would have been good and less overhead.  Even a colored disc around the feet (like in EA sports games to denote which player you are controlling on the ice).

But I guess this works good.

Next you need on the field body looting!

MartinF

  • Squire
  • *
  • Down Under
    • View Profile
  • Faction: Neutral
Re: Customizable sparring matches
« Reply #8 on: February 19, 2009, 04:00:33 PM »


Next you need on the field body looting!

That should be possible.. on agent death, spawn a chest and move his inventory into it :)

This looks nice btw Jinnai!

Jinnai

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Khergit
Re: Customizable sparring matches
« Reply #9 on: February 19, 2009, 05:51:20 PM »
Hokie, glad it worked for you.  I do love the look of your mod, it looks like you've changed almost everything about its appearance.

Post what update?  The flames over the heads is in there, I added that right after I made the post about the update.  I originally tried something on the ground like you describe, but the problem is it doesn't conform to the terrain, so large portions were hidden under hills and things due to rough terrain.  So I just went with the over the head method.

Martin: Thanks for the compliment.  Spawning a chest would be easy, linking the contents of the chest to the inventory of the defeated without having to create a TON of chest entries in the troops file would be a little more difficult.  I wonder if you could do it with props instead and just have the items themselves actually on the ground to be picked up like can happen with random gear after you kill someone.  Might look into it later.
Native Expansion - A mod for M&B version 1.010/11

I_am_a_Spoon

  • Regular
  • *
  • Was born. Is living. Will die.
    • View Profile
  • Faction: Sarranid
  • MP nick: Spoonius
Re: Customizable sparring matches
« Reply #10 on: October 21, 2010, 06:00:22 PM »
I know I'm posting in a 182 day old thread, but I wanted to point out that the particle_system code comes up as invalid syntax when compiling.

Apart from that small issue, it works perfectly! Thanks.