login

Author Topic: Creating scripted battles?  (Read 14971 times)

Smaug_the_dragon

  • Guest
Creating scripted battles?
« 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)


Smaug_the_dragon

  • Guest
Re: Creating scripted battles?
« 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?

Offline Winter

  • I am Tek Jansen!
  • Administrator
  • *****
  • Posts: 476
  • MBX Forum owner
    • View Profile
    • Street of Eyes: The Writing of Ryan A. Span
Re: Creating scripted battles?
« 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!

Offline nema

  • Journeyman
  • ***
  • Posts: 272
  • ... what nema made was outside reality...
    • View Profile
    • Guardians party
Re: Creating scripted battles?
« 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")], []),
    ],
  ),

Offline Ahadhran

  • Mysterious Old Man
  • Craftsman
  • **
  • Posts: 137
    • View Profile
Re: Creating scripted battles?
« 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... ;)

Smaug_the_dragon

  • Guest
Re: Creating scripted battles?
« Reply #5 on: May 18, 2007, 06:18:11 PM »
Thank you very much.  Very helpful! :D

Smaug_the_dragon

  • Guest
Re: Creating scripted battles?
« 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?

Highlander

  • Guest
Re: Creating scripted battles?
« 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.

Offline nema

  • Journeyman
  • ***
  • Posts: 272
  • ... what nema made was outside reality...
    • View Profile
    • Guardians party
Re: Creating scripted battles?
« 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 »

Smaug_the_dragon

  • Guest
Re: Creating scripted battles?
« 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 »

Offline Fisheye

  • Blues Brother
  • Guildsman
  • ****
  • Posts: 427
  • My scalp's so bright, I gotta wear shades.
    • View Profile
Re: Creating scripted battles?
« 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,[]),

Smaug_the_dragon

  • Guest
Re: Creating scripted battles?
« 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.

Offline Fisheye

  • Blues Brother
  • Guildsman
  • ****
  • Posts: 427
  • My scalp's so bright, I gotta wear shades.
    • View Profile
Re: Creating scripted battles?
« 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 »

Offline nema

  • Journeyman
  • ***
  • Posts: 272
  • ... what nema made was outside reality...
    • View Profile
    • Guardians party
Re: Creating scripted battles?
« 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.


Smaug_the_dragon

  • Guest
Re: Creating scripted battles?
« 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?