Grim Squeaker Posted August 31, 2009 Share Posted August 31, 2009 I've been thinking about this one for a while and I cannot think of a way to do it. The Fate Spirit lists the possible NPC's in alphabetical order (in FATESP state 6). A modder can figure out where to add their NPC by looking through the list and selecting the right transitions to squeeze their new transition in-between. However, this will screw up if more than one mod NPC is added (because what was, say, Transition #10, could now be Transition #11 etc). So can anyone think of a shiny piece of code to somehow insert a new NPC at the correct place in the list? Link to comment
Grim Squeaker Posted September 1, 2009 Author Share Posted September 1, 2009 Unless someone comes up with something genius I think I'm just gonna settle for adding it at the top or bottom of the list. Actually, how could you add it one from the bottom of the list (i.e. above the "actually I can't think of anyone" option)? I know that state position number but as you don't know how many positions there are... Link to comment
Kaeloree Posted September 1, 2009 Share Posted September 1, 2009 EXTEND_BOTTOM as opposed to EXTEND_TOP. Link to comment
Grim Squeaker Posted September 1, 2009 Author Share Posted September 1, 2009 Does that reorder the transitions then? So #1 is at the bottom, then #2 above it, then #3 etc? I kinda hoped that'd be the case but the the readme doesn't make that one clear. Link to comment
Jarno Mikkola Posted September 1, 2009 Share Posted September 1, 2009 Well, I did it like this: COMPILE ~Esiriak/IJ#es25J.d~ With this:APPEND ~pdialog.2da~~IJ#esir IJ#esirP IJ#esirJ IJ#esirD IJ#es25P IJ#es25J IJ#es25D IJ#esi25 IJ#eprT~ UNLESS ~IJ#esir~ BEGIN IJ#es25J EXTEND_BOTTOM FATESP 6 + ~!Dead("IJ#esir") !InMyArea("IJ#esir") Global("EsiriakSummoned","GLOBAL",0)~ + ~Bring me Esiriak, the Tanar'ri Abjurer.~ /* this is the custom reply you wish the PC to say. */ DO ~CreateVisualEffect("SPPORTAL",[1999.1228]) Wait(2) CreateCreature("IJ#esi25",[1999.1228],0) //this brings the .cre SetGlobal("EsiriakSummoned","GLOBAL",1)~ GOTO 8 END The GOTO 8 is the transition state where it needs to goes next. Link to comment
Grim Squeaker Posted September 1, 2009 Author Share Posted September 1, 2009 Well, yeah. I was just trying to figure how to make it appear at the alphabetical place in the list, but it looks like that's impossible/a pain in the arse, so I'm settling for a simpler version with an EXTEND_BOTTOM very similar to your code. Link to comment
Kulyok Posted September 1, 2009 Share Posted September 1, 2009 It's possible. It will look veeery ugly for another coder, but the user won't notice a thing. Create a separate file for your FATESP interjection. In fact, you'll need several - most likely about a dozen. First file - "vanilla" file - is compiled if no other NPC mods are installed(=no NPC mods that might interfere). For example, in Xan mod my line will be EXTEND_BOTTOM FATESP 6 #2 If, for example, someone created a Xena or Xzar mod(does it exist?), I could check for them in my .tp2 and compile "Xena-adjusted" file instead of "vanilla" file. Yes, it will take several .tp2 lines and several long .tp2 checks and several .d files, but as I said, the players won't notice. It's easy to note that my "Xena-and-Xzar-adjusted" file will have this line: EXTEND_BOTTOM FATESP 6 #4 I'd also ask to put it into Crossmod Banter Pack, for obvious reasons. (I'm not going to do this, because although it's relatively simple, the payoff is not worth it. But I might've considered it, if my NPC's name was Kate, for example). Link to comment
Grim Squeaker Posted September 1, 2009 Author Share Posted September 1, 2009 The problem is you'd have to start guessing or keep updating the files. But it's a nice idea. The ridiculous thoughts I was thinking of were along the lines of: - DECOMPILE_DLG_TO_D FATESP and regexp each transition or something to read the deathvariable from each transition (as each one starts with !Dead("Foo") - COPY_EXISTING regexp cre files so we can find out the name that matches the death variable. - Sort all the names including my NPC's and then we know where to insert it. Perhaps possible but it'd be so hidiously inefficient that it's just not worth it. Oh well. Link to comment
the bigg Posted September 1, 2009 Share Posted September 1, 2009 Build a lookup table for #2 (using arrays) before doing #1. For #3, I'm sure that if you look hard enough you should find a bubble sort implementation in tp2 (which is fast enough for up to about a thousand of entries, and being a stable sort algorithm it deals natively with NPCs with multiple Fate Spirit lines). I and SC developed one once for a worldmap patching macro, but I can't find it anywhere. PS: IMHO, this component should be added to the crossmod banter pack rather than to individual NPCs to make sure all NPCs are patched (including those from that five years old mod that is only available from Geocities). Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.