User Info
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 02, 2010, 08:04:06 PM

Login with username, password and session length
Search:     Advanced search
News Box
New M&B Version

1.010 is out, and so is the module system. Get modding!

Key Stats
51617 Posts in 2003 Topics by 4425 Members
Latest Member: lovely13
Home Help Search Login Register
M&B Mod Community  |  About Modding  |  User Tutorials  |  Creating scripted battles?
Pages: 1 2 [All] Print
Author Topic: Creating scripted battles?  (Read 6059 times)
Smaug_the_dragon
Apprentice
*
Offline Offline

Posts: 11


View Profile Email
« on: May 16, 2007, 07:29:25 PM »

Is there anyone out there willing to take the time to walk me step by step into how to make a scripted battle?  Ive been trying to learn by examining native and others codes, but I just can't seem to wrap my head around it.  Ive got a scene all ready to go and entry points set up.  Id be ever so grateful.  I'd even be willing to trade some modelling work for it.  (as long as it wasn't too complecated)

Logged

Smaug_the_dragon
Apprentice
*
Offline Offline

Posts: 11


View Profile Email
« Reply #1 on: May 16, 2007, 07:30:49 PM »

Whoops. sorry I noticed this is in the wrong forum, could someone move it please?
Logged

Winter
I am Tek Jansen!
Administrator
*****
Offline Offline

Posts: 448


MBX Forum owner


View Profile WWW Email
« Reply #2 on: May 17, 2007, 12:35:59 AM »

The thread is fine where it is, don't worry about it.

I don't have time to give you a really detailed overview, but I can give you a quick list of what you need. So:

First -- Determine the source you're using for the enemy troops (enemy party or visitors). If visitors, you'll need to set them beforehand in game menu or dialogue. The enemy source you're using here will determine what kind of layout you'll need to use for your mission template.

Second -- Create a custom mission template to put troops on the scene and determine what happens when via the triggers. There are some simple visitor-based templates in Native, and the standard 'lead_charge' template for enemy-party battles, so it's handy to study them before you try anything of your own.

What I recommend for getting acquainted with mission templates is writing a simple duel-type template with visitors, just a one on one match, and then go from there.

Remember that set_visitor uses the mission template spawn entries (starting at 0 and counting from the top), not scene entry points directly!
Logged


STREET: Losing your mind has never been so much fun . . .
nema
Journeyman
***
Offline Offline

Posts: 271



View Profile WWW Email
« Reply #3 on: May 18, 2007, 07:01:30 AM »

simple duel:

___________________________________________________________ ________________________________________________

in module_dialogs.py

#ymira duel

  [trp_ymira,"start", [], "Would you like to fight?", "ymira_fight1", []],

  [trp_ymira|plyr,"ymira_fight1",[], "I guess so.", "ymira_fight2",[]],

  [trp_ymira,"ymira_fight2", [],"Good luck.",  "close_window",
    [[modify_visitors_at_site,"scn_four_ways_inn"],[reset_visitors],
#  [store_shuffled_range,4], for random entry point (you will need four of them)
#( if you don't want random entry, do not use next 5 lines and reg(0) and reg(1) change to some entry point numbers

    [assign,reg(0),0],
    [assign,reg(1),1],
    [assign,reg(2),2],
    [assign,reg(3),3],
    [shuffle_range,0,4],
    [set_visitor,reg(0),0],
    [set_visitor,reg(1),"trp_ymira"],
    [set_jump_mission,"mt_ymira_fight"],
    [jump_to_scene,"scn_four_ways_inn"]]
   ],

___________________________________________________________ ________________________________________________

in module_mission_templates.py

#ymira duel
  (
    "ymira_fight",mtf_arena_fight,-1,
    "Let see.",

    [
      (0,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (1,mtef_visitor_source|mtef_team_2,af_override_horse,aif_start_alarmed,1,[]),
      (2,mtef_visitor_source|mtef_team_3,af_override_horse,aif_start_alarmed,1,[]),
      (3,mtef_visitor_source|mtef_team_4,af_override_horse,aif_start_alarmed,1,[]),
    ],

    [
      (ti_tab_pressed, 0, 0, [],
       [(question_box,"str_give_up_fight")]),
     
      (ti_question_answered, 0, 0, [],
       [(store_trigger_param_1,":answer"),(eq,":answer",0),(jump_to_scene,"scn_four_ways_inn"),]),

      (1, 3, ti_once, [(main_hero_fallen,0)],
       [(jump_to_scene,"scn_four_ways_inn")]),

      (1, 3, ti_once,
       [(store_mission_timer_a,reg(1)),(ge,reg(1),1),(num_active_teams_le,1),(neg|main_hero_fallen,0)],
       [(jump_to_scene,"scn_four_ways_inn")]),
 
     (ti_inventory_key_pressed, 0, 0, [(display_message,"str_cant_use_inventory_arena")], []),
    ],
  ),
Logged

Ahadhran
Mysterious Old Man
Craftsman
**
Offline Offline

Posts: 143



View Profile Email
« Reply #4 on: May 18, 2007, 09:24:42 AM »

Though I wasn't the one to ask for it, that was very helpful Nema. I have been avoiding mission templates for far too long... ;)
Logged
Smaug_the_dragon
Apprentice
*
Offline Offline

Posts: 11


View Profile Email
« Reply #5 on: May 18, 2007, 06:18:11 PM »

Thank you very much.  Very helpful! :D
Logged

Smaug_the_dragon
Apprentice
*
Offline Offline

Posts: 11


View Profile Email
« Reply #6 on: May 24, 2007, 07:45:55 PM »

Allright then, Ive been playing with this script and managed to get it too work very nicely.  But now im trying to figure out how to take it too the next step and add multiple enimies, mabye even multiple teams,  How would I do this?
Logged

Highlander
Journeyman
***
Offline Offline

Posts: 259


View Profile Email
« Reply #7 on: May 25, 2007, 07:00:26 AM »

mabye even multiple teams
(0,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
add multiple enimies
you can use
(add_reinforcements_to_entry,<mt_entry_no>,1),
The "1" is the number of new troops. For some reasons it adds only one new troop to the scene whatever the value is when you use visitors, so just use the command several times.
Logged
nema
Journeyman
***
Offline Offline

Posts: 271



View Profile WWW Email
« Reply #8 on: May 25, 2007, 08:49:06 AM »

Upper code work very nice with at least 4 warriors in 4 teams. You must just add new visitors:

[set_visitor,reg(0),0],#this is player
[set_visitor,reg(1),"trp_ymira"],
[set_visitor,reg(2),"trp_mora"],
[set_visitor,reg(3),"trp_essa"],


They will fight 1 on 1 on 1 on 1 because there are 4 teams (yes you already have 4 teams here):

      (0,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (1,mtef_visitor_source|mtef_team_2,af_override_horse,aif_start_alarmed,1,[]),
      (2,mtef_visitor_source|mtef_team_3,af_override_horse,aif_start_alarmed,1,[]),
      (3,mtef_visitor_source|mtef_team_4,af_override_horse,aif_start_alarmed,1,[]),


Try to change something here:

      (0,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (1,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (2,mtef_visitor_source|mtef_team_2,af_override_horse,aif_start_alarmed,1,[]),
      (3,mtef_visitor_source|mtef_team_2,af_override_horse,aif_start_alarmed,1,[]),


2 on 2 I think

Or:

      (0,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (1,mtef_visitor_source|mtef_team_2,af_override_horse,aif_start_alarmed,1,[]),
      (2,mtef_visitor_source|mtef_team_2,af_override_horse,aif_start_alarmed,1,[]),
      (3,mtef_visitor_source|mtef_team_2,af_override_horse,aif_start_alarmed,1,[]),


Randomly 1 on 3

but of course add_reinforcements is also very interesting and useful idea.
« Last Edit: May 25, 2007, 08:51:42 AM by nema » Logged

Smaug_the_dragon
Apprentice
*
Offline Offline

Posts: 11


View Profile Email
« Reply #9 on: May 25, 2007, 09:44:51 AM »

Allright, I think I'm starting to understand this now, and so to take it one step further, If I wanted to make this battle occur when you enterd the area, I could just put the dialoge code in the game_menus right?

And one more qustion.  Ive modded some of the troops to have no weapons at all (cause I want them to use thier fists) but when the battle commences it gives me an error talking about "no meele"  i can just hit ignore and the battle plays out normally, but it would be nice to have it work without the errors.  Any ideas?

Thanks for all the help guys.
« Last Edit: May 25, 2007, 10:04:07 PM by Smaug_the_dragon » Logged

Fisheye
Blues Brother
Guildsman
****
Offline Offline

Posts: 428


My scalp's so bright, I gotta wear shades.


View Profile Email
« Reply #10 on: May 26, 2007, 06:19:09 AM »

And one more qustion.  Ive modded some of the troops to have no weapons at all (cause I want them to use thier fists) but when the battle commences it gives me an error talking about "no meele"  i can just hit ignore and the battle plays out normally, but it would be nice to have it work without the errors.  Any ideas?

You have to give them some melee weapon (a knife, anything) then override it with nothing in the mission template.

E.g.

      (0,mtef_visitor_source|mtef_team_1,af_override_weapons,aif_start_alarmed,1,[]),
Logged
Smaug_the_dragon
Apprentice
*
Offline Offline

Posts: 11


View Profile Email
« Reply #11 on: May 26, 2007, 10:57:53 PM »

hmm this dosn't seem to work.  When complling it gives me errors from that


Quote
      (0,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (1,mtef_visitor_source|mtef_team_2,af_override_weapons,aif_start_alarmed,1,[]),
      (2,mtef_visitor_source|mtef_team_3,af_override_weapons,aif_start_alarmed,1,[]),
      (3,mtef_visitor_source|mtef_team_2,af_override_weapons,aif_start_alarmed,1,[]),
      (4,mtef_visitor_source|mtef_team_2,af_override_weapons,aif_start_alarmed,1,[]),
      (5,mtef_visitor_source|mtef_team_4,af_override_weapons,aif_start_alarmed,1,[]),
      (6,mtef_visitor_source|mtef_team_3,af_override_weapons,aif_start_alarmed,1,[]),
      (7,mtef_visitor_source|mtef_team_2,af_override_weapons,aif_start_alarmed,1,[]),
      (8,mtef_visitor_source|mtef_team_4,af_override_weapons,aif_start_alarmed,1,[]),
      (9,mtef_visitor_source|mtef_team_2,af_override_weapons,aif_start_alarmed,1,[]),
      (10,mtef_visitor_source|mtef_team_4,af_override_weapons,aif_start_alarmed,1,[]),
      (11,mtef_visitor_source|mtef_team_4,af_override_weapons,aif_start_alarmed,1,[]),
      (12,mtef_visitor_source|mtef_team_2,af_override_weapons,aif_start_alarmed,1,[]),
      (13,mtef_visitor_source|mtef_team_3,af_override_weapons,aif_start_alarmed,1,[]),
      (14,mtef_visitor_source|mtef_team_4,af_override_weapons,aif_start_alarmed,1,[]),
      (15,mtef_visitor_source|mtef_team_3,af_override_weapons,aif_start_alarmed,1,[]),
      (16,mtef_visitor_source|mtef_team_4,af_override_weapons,aif_start_alarmed,1,[]),
      (17,mtef_visitor_source|mtef_team_2,af_override_weapons,aif_start_alarmed,1,[]),
      (18,mtef_visitor_source|mtef_team_4,af_override_weapons,aif_start_alarmed,1,[]),


This is the only thing Ive changed, like fisheye suggested.
Logged

Fisheye
Blues Brother
Guildsman
****
Offline Offline

Posts: 428


My scalp's so bright, I gotta wear shades.


View Profile Email
« Reply #12 on: May 27, 2007, 08:02:44 AM »

What's the error?

You probably stuffed up a comma or bracket somewhere (not in the block you showed).
« Last Edit: May 27, 2007, 08:06:31 AM by Fisheye » Logged
nema
Journeyman
***
Offline Offline

Posts: 271



View Profile WWW Email
« Reply #13 on: May 29, 2007, 02:21:01 AM »

I'd love a script to set up a dialog as soon as a player has been defeated in a scripted battle (like the arena)

Automatic dialog after arena fight? I don't know such. You just go back to arena master and there you can ask him something. Do you think such dialog?

Do you think string display?  (Your soldiers have all fallen.)
Some question? (Do you want to retreat?)...

Can you explain me what exactly do you want.

Logged

Smaug_the_dragon
Apprentice
*
Offline Offline

Posts: 11


View Profile Email
« Reply #14 on: May 29, 2007, 06:51:38 PM »

I'm looking that the player death starts up a dialogue with someone, is that even possible?  or would I have to work it through a menu?
Logged

nema
Journeyman
***
Offline Offline

Posts: 271



View Profile WWW Email
« Reply #15 on: May 30, 2007, 05:58:43 AM »

Change in upper code existing blue with red one

      (1, 3, ti_once, [(main_hero_fallen,0)],
       [ (jump_to_scene,"scn_four_ways_inn") ]),


(1, 3, ti_once, [(main_hero_fallen,0)], [ (start_mission_conversation,"trp_ymira") ]),

In current code you will get loop until you will win. (ha, it is nice to wait that someone kill you :green:)

Maybe you will setup some variables before red replacement, to create a condition for right dialog in module_dialogs.





I'd even be willing to trade some modelling work for it.

Can you tell me something about your modelling work. For my mod I done everything except models (and translations to english, heh) so maybe... ::)

You can check here for body meshes, weapons, dresses, but I also need some very simple things such are skined cubes, balls, pyramids..
« Last Edit: May 30, 2007, 09:07:35 AM by nema » Logged

Smaug_the_dragon
Apprentice
*
Offline Offline

Posts: 11


View Profile Email
« Reply #16 on: May 30, 2007, 07:33:11 PM »

Well, I havn't done anything spectacular, and I'm only par with texturing but for some samples, check out the mod forum in my sig.  Thanks for the help though nema
Logged

nema
Journeyman
***
Offline Offline

Posts: 271



View Profile WWW Email
« Reply #17 on: May 31, 2007, 12:09:32 AM »

Ah it is nothing. I will help you if I will know things you will ask. :) Any new problem with battles to resolve?

( I checked it. Are you still working on it? )
« Last Edit: May 31, 2007, 05:09:33 AM by nema » Logged

Smaug_the_dragon
Apprentice
*
Offline Offline

Posts: 11


View Profile Email
« Reply #18 on: June 02, 2007, 10:29:42 PM »

you bet, its just going slow at the moment, school is getting in the way.
Logged

nema
Journeyman
***
Offline Offline

Posts: 271



View Profile WWW Email
« Reply #19 on: June 04, 2007, 01:10:54 AM »

Maybe we can finish this nonscripting part of our conversation through my topic. You will find link below. ;)

« Last Edit: June 04, 2007, 06:56:49 AM by nema » Logged

bryce
Guildsman
****
Offline Offline

Posts: 357


View Profile Email
« Reply #20 on: June 10, 2007, 08:28:39 PM »

Lot's of good stuff here. Thanks.

I am thinking it may be easier to move to using visitors for all my battles as it's just getting too nightmarish....
Logged
grailknighthero
Craftsman
**
Offline Offline

Posts: 141


View Profile Email
« Reply #21 on: March 28, 2008, 08:31:41 PM »

A long time ago I made a mission and had the problem that the enemy just stood there and only swung their fists at you when you got near by.  I fixed it somehow, but I do not remember how I did it and I have run into this problem again.  Does anyone know how to fix it?  What have I done wrong?

Edit: nm I figured it out.  He didnt have any weapons because the weapons in the mission template are only given if you over ride that weapon slot.
« Last Edit: March 28, 2008, 11:10:46 PM by grailknighthero » Logged
Pages: 1 2 [All] Print 
Jump to:  

Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Arcane Magic based on BlackDay by TechnoDragon.net | Buttons by Andrea