Author Topic: M&B Scripting Q&A  (Read 63561 times)

Highlander

  • Guest
Modding Q&A
« Reply #30 on: January 18, 2007, 02:42:32 PM »
yeah,  I'll have to use 3 several mission templates to get 3 options for the player, not very elegant, but at least it works,

Offline Winter

  • I am Tek Jansen!
  • Administrator
  • *****
  • Posts: 476
  • MBX Forum owner
    • View Profile
    • Street of Eyes: The Writing of Ryan A. Span
Modding Q&A
« Reply #31 on: January 18, 2007, 02:47:39 PM »
yeah,  I'll have to use 3 several mission templates to get 3 options for the player, not very elegant, but at least it works,

I'm going to have to look into this more deeply when I start porting Storymod anyway, so I'll let you know what happens.

Truthfully I don't like M&B getting more fiddly than it already was . . .

Illusionistically,
Winter

Offline Hellequin

  • Journeyman
  • ***
  • Posts: 254
    • View Profile
Modding Q&A
« Reply #32 on: January 18, 2007, 04:07:23 PM »
I've successfully got the player spawning at entry 4 during a custom mission template in Schattenlander.  What changed is the spawn record in the mission template; player uses mtef_scene_source, as compared with mtef_visitor_source for most entry points in the town_default mission template.  That spawn record isn't the first one listed, either, it's after some visitor_source spawn records.

That mission template does also have an entry-point-0 spawn record with an mtef_scene_source (player-friendly) entrance, so you should be okay if you just use one mission template with player-friendly spawn records at each of the entry points you want to use.  If, that is, I'm understanding correctly why mine worked, anyway.

Offline Winter

  • I am Tek Jansen!
  • Administrator
  • *****
  • Posts: 476
  • MBX Forum owner
    • View Profile
    • Street of Eyes: The Writing of Ryan A. Span
Modding Q&A
« Reply #33 on: January 18, 2007, 05:10:48 PM »
I've successfully got the player spawning at entry 4 during a custom mission template in Schattenlander.  What changed is the spawn record in the mission template; player uses mtef_scene_source, as compared with mtef_visitor_source for most entry points in the town_default mission template.  That spawn record isn't the first one listed, either, it's after some visitor_source spawn records.

This usually works, but with the new unpredictable nature of mission templates, there may be problems with multiple (variable) playerspawns in a scene.


Quote
That mission template does also have an entry-point-0 spawn record with an mtef_scene_source (player-friendly) entrance, so you should be okay if you just use one mission template with player-friendly spawn records at each of the entry points you want to use.

That's one idea worth exploring/verifying. Are you sure this works, and the scene_source doesn't override or spawn a duplicate player anywhere?

Intransitively,
Winter

Offline Hellequin

  • Journeyman
  • ***
  • Posts: 254
    • View Profile
Modding Q&A
« Reply #34 on: January 18, 2007, 05:25:11 PM »
Absolutely.  The entry points 0 and 4 are quite close together, #4 was created basically to start the player looking at a specific other character in the bar, rather than standing by the counter.  Here's the code:

("inn_at_game_start",0,-1,"Default town visit plus PC at entry four allowed, entry points over 16 removed, and triggers added",
    [
(0,mtef_scene_source|mtef_team_1,af_town_overrides,group(1),1,[]),
(1,mtef_visitor_source|mtef_team_1,af_town_overrides,0,1,[]),(2,mtef_visitor_source|mtef_team_1,af_town_overrides,0,1,[]),(3,mtef_visitor_source|mtef_team_1,af_town_overrides,0,1,[]),
(4,mtef_scene_source|mtef_team_1,af_town_overrides,group(1),1,[]),
(5,mtef_visitor_source|mtef_team_1,af_town_overrides,0,1,[]),(6,mtef_visitor_source|mtef_team_1,af_town_overrides,0,1,[]),(7,mtef_visitor_source|mtef_team_1,af_town_overrides,0,1,[]),(8,mtef_visitor_source,af_town_overrides,0,1,[]),(9,mtef_visitor_source,af_town_overrides,0,1,[]),(10,mtef_visitor_source,af_town_overrides,0,1,[]),(11,mtef_visitor_source,af_town_overrides,0,1,[]),(12,mtef_visitor_source,af_town_overrides,0,1,[]),
   (13,mtef_visitor_source,0,0,1,[]),(14,mtef_visitor_source,0,0,1,[]),(15,mtef_visitor_source,0,0,1,[]),(16,mtef_visitor_source,0,0,1,[]),
     ],
    [
   (various triggers here)
    ]),


No duplicate players present.  No chance to override since those entry points are reserved for the player only, which is probably wise.  Likewise the fact that my spawn records are in order, one per entry point, strictly ascending, may have mattered.  In any event it works just fine - apparently better than I deserve.  Amusingly, it was your cryptic hint, Winter, which made me try the change of mtef_ flag, and it worked first try after that.

- Hellequin

Offline Winter

  • I am Tek Jansen!
  • Administrator
  • *****
  • Posts: 476
  • MBX Forum owner
    • View Profile
    • Street of Eyes: The Writing of Ryan A. Span
Modding Q&A
« Reply #35 on: January 18, 2007, 08:10:07 PM »
Absolutely.  The entry points 0 and 4 are quite close together, #4 was created basically to start the player looking at a specific other character in the bar, rather than standing by the counter.  Here's the code:

("inn_at_game_start",0,-1,"Default town visit plus PC at entry four allowed, entry points over 16 removed, and triggers added",
    [
(0,mtef_scene_source|mtef_team_1,af_town_overrides,group(1),1,[]),
(1,mtef_visitor_source|mtef_team_1,af_town_overrides,0,1,[]),(2,mtef_visitor_source|mtef_team_1,af_town_overrides,0,1,[]),(3,mtef_visitor_source|mtef_team_1,af_town_overrides,0,1,[]),
(4,mtef_scene_source|mtef_team_1,af_town_overrides,group(1),1,[]),
(5,mtef_visitor_source|mtef_team_1,af_town_overrides,0,1,[]),(6,mtef_visitor_source|mtef_team_1,af_town_overrides,0,1,[]),(7,mtef_visitor_source|mtef_team_1,af_town_overrides,0,1,[]),(8,mtef_visitor_source,af_town_overrides,0,1,[]),(9,mtef_visitor_source,af_town_overrides,0,1,[]),(10,mtef_visitor_source,af_town_overrides,0,1,[]),(11,mtef_visitor_source,af_town_overrides,0,1,[]),(12,mtef_visitor_source,af_town_overrides,0,1,[]),
   (13,mtef_visitor_source,0,0,1,[]),(14,mtef_visitor_source,0,0,1,[]),(15,mtef_visitor_source,0,0,1,[]),(16,mtef_visitor_source,0,0,1,[]),
     ],
    [
   (various triggers here)
    ]),


No duplicate players present.  No chance to override since those entry points are reserved for the player only, which is probably wise.  Likewise the fact that my spawn records are in order, one per entry point, strictly ascending, may have mattered.  In any event it works just fine - apparently better than I deserve.  Amusingly, it was your cryptic hint, Winter, which made me try the change of mtef_ flag, and it worked first try after that.

- Hellequin

Well, if the set_jump_entry operation works nowadays, we'll never need to use visitor_source for the player ever again. Which is a good thing because visitor_source for the player doesn't seem to work anymore.

Though I have most certainly used visitor_source succesfully in Craftmod on 0.808 . . .

Fuck, I just don't know anymore. I'm tired of it.

Senatorially,
Winter

Offline Hellequin

  • Journeyman
  • ***
  • Posts: 254
    • View Profile
Modding Q&A
« Reply #36 on: January 18, 2007, 09:24:58 PM »
Yeah - I'm actually rather glad I came to modding only recently, when it seems to be simmering into a much less baroque form - and that's certainly saying something.  But yes; as far as I can tell, there is neither a need nor a reason to use the (set_visitor/mtef_visitor_source) pair with the player, ever.  The (set_jump_entry/mtef_scene_source) pair seems to do the trick just dandy.

Offline Raz

  • Deus Vult Dev
  • *****
  • Posts: 212
    • View Profile
Modding Q&A
« Reply #37 on: January 22, 2007, 04:30:48 PM »
Hey, here's me with a simple question agian. The meaning of this trigger is to provide each city with new troops each day. I copied this from the tavern refresh, but for some reason this has a total different effect. It chooses just 1 city and keeps it each day. What am I doing wrong?

Quote
#CITY GARRISON
  (24.0, 0, 0.0,
   [ ],
   [   
#REPLENISH
# Refresh Jerusalem Cities

   (try_for_range, reg(1), towns_begin, towns_end),
   (store_faction_of_party, reg(2), reg(1)),
   (try_begin,0),
   (store_random,reg(12),10),
   (val_add,reg(12),3),
   (store_random,reg(13),5),
   (val_add,reg(13),2),
   (store_random,reg(14),3),
   (val_add,reg(14),2),
   (store_random,reg(15),2),
   (val_add,reg(15),1),
   (party_add_members, reg(1), "trp_jerusalem_sergeant1", reg(12)),
   (party_add_members, reg(1), "trp_jerusalem_sergeant2", reg(13)),
   (party_add_members, reg(1), "trp_jerusalem_sergeant3", reg(14)),
   (party_add_members, reg(1), "trp_jerusalem_sergeant_mounted", reg(14)),
   (party_add_members, reg(1), "trp_jerusalem_bowman", reg(13)),
   (party_add_members, reg(1), "trp_jerusalem_crossbowman", reg(12)),
   (party_add_members, reg(1), "trp_jerusalem_knight1", reg(14)),
   (party_add_members, reg(1), "trp_jerusalem_knight2", reg(15)),
]

Yoshiboy

  • Guest
Modding Q&A
« Reply #38 on: January 22, 2007, 04:34:14 PM »
you need to end the try :)

Offline Raz

  • Deus Vult Dev
  • *****
  • Posts: 212
    • View Profile
Modding Q&A
« Reply #39 on: January 22, 2007, 05:29:44 PM »
Right, thanks! Problem solved, case closed. :D

Offline fujiwara

  • Master
  • *****
  • Posts: 858
    • View Profile
Modding Q&A
« Reply #40 on: January 22, 2007, 11:30:14 PM »


This just popped up out of nowhere...please don't tell me I've got to go back and recompile everything from Native >:(

The horses tend to get their legs caught in the catapult rather than being properly launched.

Offline Hellequin

  • Journeyman
  • ***
  • Posts: 254
    • View Profile
Re: Modding Q&A
« Reply #41 on: January 23, 2007, 08:24:31 AM »
I seem to recall the above happening when I tried to run a save that was no longer compatible due to ID_strings having substantially changed.  Might that be the cause?

Offline fujiwara

  • Master
  • *****
  • Posts: 858
    • View Profile
Re: Modding Q&A
« Reply #42 on: January 23, 2007, 12:42:37 PM »
I thought that too, so I started a new game. Same problem. Last time this happened, I had to completely clean out all the module files and start with empty lists *grr*  >:(

The horses tend to get their legs caught in the catapult rather than being properly launched.

Offline Hellequin

  • Journeyman
  • ***
  • Posts: 254
    • View Profile
Re: Modding Q&A
« Reply #43 on: January 23, 2007, 01:13:24 PM »
You could try wiping out all the xx.txt and ID_xx.py generated files, and replacing them with the ones from the unchanged Native modsys build, maybe.  Worth a shot, anyway.

Leprechaun

  • Guest
Re: FAQ project!
« Reply #44 on: January 24, 2007, 03:16:28 PM »
Can't find any mention of this - if both values are the same, will a val_min operation bugger up or simply do nothing?

Like, say reg(4) is 2, and so is reg(5), will [val_min,reg(4),reg(5)] cause an error or simply leave reg(4) as 2?