Greenman019 Posted December 31, 2015 Share Posted December 31, 2015 So I've just started coding, got my first NPC in with basic dialogue. I have 2 questions. 1. How do I get the NPC to fight if PC attacks ? Doesn't even turn hostile at the moment. 2. How do I set up XP dependent NPCs? I have all the relevant .cre files made. I did see a tutorial on here for seamless NPC spawning, but as I'm learning I don't want to break my dialogue trigger (times talked to or something I'm using) Would just like the normal way. One level dependent spawn. Thanks Link to comment
Avenger Posted December 31, 2015 Share Posted December 31, 2015 If you meant joinable NPCs, you have to place them into the .gam file. Link to comment
Greenman019 Posted December 31, 2015 Author Share Posted December 31, 2015 Been using WeiDu at the mo. Don't think I've touched a .gam file Link to comment
Avenger Posted January 1, 2016 Share Posted January 1, 2016 I'm pretty sure weidu has a function to do this. Link to comment
Jarno Mikkola Posted January 1, 2016 Share Posted January 1, 2016 The normal BG2 NPCs use the npclevel.2da file in SoA, and npclev25.2da in ToB to "summon" their leveled character according to the level your character is at to summon the .cre in the file. You can extend the file, but I won't guarantee that it will work. Also if you don't want to be bad influence, you should make a level 1 NPC and then just add XP to the further along experienced cre -files, but not level up the character, so the player can choose the proficienies etc. This is unless circumstances dictate otherwise, AKA, the character challenges the player to a duel ... where they need the hit points etc. This should be easy to actually "automate". .tp2 example: COPY ~IJ#esir~ ~override~ WRITE_LONG ~0x0018~ ~0~ COPY ~IJ#esir~ ~override/IJ#esir3~ WRITE_LONG ~0x0018~ ~2000~ COPY ~IJ#esir~ ~override/IJ#esir4~ WRITE_LONG ~0x0018~ ~4000~ COPY ~IJ#esir~ ~override/IJ#esir5~ WRITE_LONG ~0x0018~ ~8000~ COPY ~IJ#esir~ ~override/IJ#esir6~ WRITE_LONG ~0x0018~ ~16000~ COPY ~IJ#esir~ ~override/IJ#esir7~ WRITE_LONG ~0x0018~ ~32000~ And here's a .tp2 patch for the file: APPEND ~npclevel.2da~ ~IJ#esir IJ#esir IJ#esir3 IJ#esir4 IJ#esir5 IJ#esir6 IJ#esir6 IJ#esir7 **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** ****~ The first columns variable is of course the "death variable", while the rest are the .cre files... without the .cre extensions. Link to comment
Greenman019 Posted January 1, 2016 Author Share Posted January 1, 2016 I don't think it makes any difference, but I'm coding for BG1 at the mo. Here's my current code for the leveling problem, taken from a tutorial somewhere. Is there any downside with this method? (Except of course it spawns only once, but it's the same way original worked so doesn't matter.) IF Global("G)SpawnSorv", "GLOBAL", 0) XPLT (Player1,2501) THEN RESPONSE #100 SetGlobal("G)SpawnSorv", "GLOBAL", 1) CreateCreature("G)SORV", [3326.2528], 14) Continue() END IF Global("G)SpawnSorv", "GLOBAL", 0) XPGT (Player1,2500) XPLT (Player1,5001) THEN RESPONSE #100 SetGlobal("G)SpawnSorv", "GLOBAL", 1) CreateCreature("G)SORV2", [3326.2528], 14) Continue() END Also have another question. I'm hoping to have a quest involving my NPC, and am struggling with the dialogue. Here's what I have so far: BEGIN ~G)TRA~ IF ~NumTimesTalkedTo(0)~ THEN BEGIN Tra01 SAY ~WHAT! What is the meaning of th-~ IF ~~ + Tra02 END IF ~~ THEN BEGIN Tra02 SAY ~Savon, isn't it? Yes, I remember you.~ IF ~~ THEN DO ~Enemy()~ EXIT END Moving to the next NPC line works like a charm. But I want to move to another NPC, and have them reply if a certain check is passed, in this case, if that NPC is in the party. (It's "InParty("Savon") isn't it? I obviously need the dialogue written first, but in whose .d file should it be? The original speaker (As it's the same "chain" if you like), or the other NPC, the one that ends up saying the line? And ye, how do I trigger it. Thanks. One final thing that doesn't matter so much, how difficult would I find it to edit the original maps? (If it's even doable). There's one or two doors in Baldur's Gate (The city not game) that return a message about the door being rusty/house abandoned. Is it possible to make these into fully functioning doorways, and adding a new area duplicated from one of the existing house-art tilesets in the game? Link to comment
Jarno Mikkola Posted January 1, 2016 Share Posted January 1, 2016 But I want to move to another NPC--- Then I believe you should use CHAIN. Here's an example ... I can't say that's the best tutorial, as it's the first I was able to find. If you start there and then ingest this, then you are far more forward than I would say I am. The areas can be changed. I won't say that it will be easy though.. there's a DLTCEP tutorial around, it needs to be then converted to be weidu, and I haven't seen a good one for that. Is there any downside with this method? I can't say there to be ... Link to comment
Greenman019 Posted January 1, 2016 Author Share Posted January 1, 2016 But I want to move to another NPC--- Then I believe you should use CHAIN. Here's an example ... I can't say that's the best tutorial, as it's the first I was able to find.If you start there and then ingest this, then you are far more forward than I would say I am. The areas can be changed. I won't say that it will be easy though.. there's a DLTCEP tutorial around, it needs to be then converted to be weidu, and I haven't seen a good one for that. Thanks, I'll check those out now. As for the area changing, is there no tutorials at all ? I know it's complex so I'm not holding my breath. The only other option is to take over an existing building, removing all the commoners and starting from there. Sounds just as difficult though. And I don't really wanna remove stuff from the base game. Link to comment
Kulyok Posted January 1, 2016 Share Posted January 1, 2016 Just write the NPC first. Chances are so high (95%) that a modder would abandon his NPC mod after a few dialogues that, really, there's a very high probability that your current questions are moot. Do the friendship track, the interjections, the NPC banters, the character arc (with or without a quest), event reactions - and then think about coding frills (combat and other such irrelevent stuff - anyway, people only pay attention to it if the mod is 1) written well; 2) written). Link to comment
Roxanne Posted January 1, 2016 Share Posted January 1, 2016 I don't think it makes any difference, but I'm coding for BG1 at the mo. Here's my current code for the leveling problem, taken from a tutorial somewhere. Is there any downside with this method? (Except of course it spawns only once, but it's the same way original worked so doesn't matter.) IF Global("G)SpawnSorv", "GLOBAL", 0) XPLT (Player1,2501) THEN RESPONSE #100 SetGlobal("G)SpawnSorv", "GLOBAL", 1) CreateCreature("G)SORV", [3326.2528], 14) Continue() END IF Global("G)SpawnSorv", "GLOBAL", 0) XPGT (Player1,2500) XPLT (Player1,5001) THEN RESPONSE #100 SetGlobal("G)SpawnSorv", "GLOBAL", 1) CreateCreature("G)SORV2", [3326.2528], 14) Continue() END With this either G)SORV or G)SORV2 will spawn depending on PC's level, nothing will happen if PC has 5001XP or more. Also have another question. I'm hoping to have a quest involving my NPC, and am struggling with the dialogue. Here's what I have so far: BEGIN ~G)TRA~ IF ~NumTimesTalkedTo(0)~ THEN BEGIN Tra01 SAY ~WHAT! What is the meaning of th-~ IF ~~ + Tra02 END IF ~~ THEN BEGIN Tra02 SAY ~Savon, isn't it? Yes, I remember you.~ IF ~~ THEN DO ~Enemy()~ EXIT END CHAIN IF ~NumTimesTalkedTo(0)~ THEN G)TRA Tra01 //G)TRA will talk first ~WHAT! What is the meaning of th-~ ==Savon IF~InParty("Savon")~THEN~Hey, hey~ //Just in case Savon is to say something == G)TRA IF~InParty("Savon")~THEN~Savon, isn't it? Yes, I remember you.~DO ~Enemy()~ //G)TRA will talk again and get hostile EXIT Moving to the next NPC line works like a charm. But I want to move to another NPC, and have them reply if a certain check is passed, in this case, if that NPC is in the party. (It's "InParty("Savon") isn't it? I obviously need the dialogue written first, but in whose .d file should it be? The original speaker (As it's the same "chain" if you like), or the other NPC, the one that ends up saying the line? And ye, how do I trigger it. Thanks. One final thing that doesn't matter so much, how difficult would I find it to edit the original maps? (If it's even doable). There's one or two doors in Baldur's Gate (The city not game) that return a message about the door being rusty/house abandoned. Is it possible to make these into fully functioning doorways, and adding a new area duplicated from one of the existing house-art tilesets in the game? Here is an example (the blocks go into the tp2 file of your mod. //ar8604 new travel region and new entrance for CVORC1 COPY_EXISTING ~ar8604.ARE~ ~override~ // The original area you want to modify LPF fj_are_structure //this puts the travel region into the original area INT_VAR fj_type = 2 // for travel trigger (info would be 1) see WEIDU documentation fj_box_left = 21 fj_box_top = 667 fj_box_right = 190 fj_box_bottom = 801 fj_cursor_idx = 28 // 28 = stairs, 30 = Door 34 = Wheel 22= questionmark fj_vertex_0 = 100 + (666 << 16) fj_vertex_1 = 190 + (730 << 16) fj_vertex_2 = 100 + (801 << 16) fj_vertex_3 = 21 + (726 << 16) fj_vertex_4 = 100 + (666 << 16) fj_flags = 4 // PartyRequired 0 if no flags set fj_loc_x = 105 fj_loc_y = 734 STR_VAR fj_structure_type = region fj_name = OrcPrison //transition name (can be used to activate/deactivate the entrance via area script) fj_destination_area = CVORC1 //the name of the .are file of your new area fj_destination_name = OrcPrison //the name of the entrance in your new area from outside, must match EXACTLY to avoid CtD END LPF fj_are_structure //this puts the exit from the new area into the original area INT_VAR fj_loc_x = 184 // this and next are where you come out of your new area into original fj_loc_y = 699 fj_orientation = 12 // direction your party looks to when coming out of your area STR_VAR fj_structure_type = entrance fj_name = OrcMines //this name needs to match the data in your travel region in your new area EXACTLY END The rest are the coordinates and trigger locations you need to specify your travel region. How you achieve them is depending on your personal choice of modding tools. Link to comment
Greenman019 Posted January 1, 2016 Author Share Posted January 1, 2016 Here is an example (the blocks go into the tp2 file of your mod. //ar8604 new travel region and new entrance for CVORC1COPY_EXISTING ~ar8604.ARE~ ~override~ // The original area you want to modifyLPF fj_are_structure //this puts the travel region into the original area INT_VAR fj_type = 2 // for travel trigger (info would be 1) see WEIDU documentation fj_box_left = 21 fj_box_top = 667 fj_box_right = 190 fj_box_bottom = 801 fj_cursor_idx = 28 // 28 = stairs, 30 = Door 34 = Wheel 22= questionmark fj_vertex_0 = 100 + (666 << 16) fj_vertex_1 = 190 + (730 << 16) fj_vertex_2 = 100 + (801 << 16) fj_vertex_3 = 21 + (726 << 16) fj_vertex_4 = 100 + (666 << 16) fj_flags = 4 // PartyRequired 0 if no flags set fj_loc_x = 105 fj_loc_y = 734 STR_VAR fj_structure_type = region fj_name = OrcPrison //transition name (can be used to activate/deactivate the entrance via area script) fj_destination_area = CVORC1 //the name of the .are file of your new area fj_destination_name = OrcPrison //the name of the entrance in your new area from outside, must match EXACTLY to avoid CtD END LPF fj_are_structure //this puts the exit from the new area into the original area INT_VAR fj_loc_x = 184 // this and next are where you come out of your new area into original fj_loc_y = 699 fj_orientation = 12 // direction your party looks to when coming out of your area STR_VAR fj_structure_type = entrance fj_name = OrcMines //this name needs to match the data in your travel region in your new area EXACTLY END The rest are the coordinates and trigger locations you need to specify your travel region. How you achieve them is depending on your personal choice of modding tools. Thanks for the help guys. The spawning system isn't the whole code, I have a few sets of them up to about 20k xp. Incidentally, is there such a thing as "Average XP per chapter" been documented? Just thinking early about the difficulty of encounters. But doesn't really matter. Maybe they're spawned on an XP basis as well? Just trying out that area script, worked great. Thanks for the dialogue stuff. Trying to get it working but keep getting parsing errors. Link to comment
Roxanne Posted January 1, 2016 Share Posted January 1, 2016 Here is an example (the blocks go into the tp2 file of your mod. //ar8604 new travel region and new entrance for CVORC1 COPY_EXISTING ~ar8604.ARE~ ~override~ // The original area you want to modify LPF fj_are_structure //this puts the travel region into the original area INT_VAR fj_type = 2 // for travel trigger (info would be 1) see WEIDU documentation fj_box_left = 21 fj_box_top = 667 fj_box_right = 190 fj_box_bottom = 801 fj_cursor_idx = 28 // 28 = stairs, 30 = Door 34 = Wheel 22= questionmark fj_vertex_0 = 100 + (666 << 16) fj_vertex_1 = 190 + (730 << 16) fj_vertex_2 = 100 + (801 << 16) fj_vertex_3 = 21 + (726 << 16) fj_vertex_4 = 100 + (666 << 16) fj_flags = 4 // PartyRequired 0 if no flags set fj_loc_x = 105 fj_loc_y = 734 STR_VAR fj_structure_type = region fj_name = OrcPrison //transition name (can be used to activate/deactivate the entrance via area script) fj_destination_area = CVORC1 //the name of the .are file of your new area fj_destination_name = OrcPrison //the name of the entrance in your new area from outside, must match EXACTLY to avoid CtD END LPF fj_are_structure //this puts the exit from the new area into the original area INT_VAR fj_loc_x = 184 // this and next are where you come out of your new area into original fj_loc_y = 699 fj_orientation = 12 // direction your party looks to when coming out of your area STR_VAR fj_structure_type = entrance fj_name = OrcMines //this name needs to match the data in your travel region in your new area EXACTLY END The rest are the coordinates and trigger locations you need to specify your travel region. How you achieve them is depending on your personal choice of modding tools. Thanks for the help guys. The spawning system isn't the whole code, I have a few sets of them up to about 20k xp. Incidentally, is there such a thing as "Average XP per chapter" been documented? Just thinking early about the difficulty of encounters. But doesn't really matter. Maybe they're spawned on an XP basis as well? Just trying out that area script, worked great. Thanks for the dialogue stuff. Trying to get it working but keep getting parsing errors. Average XP may differ very much depending on which games, which mods etc are installed. For big installations there are also mod that reduce XP gain and provide delayed level up. Alternative to checking Player1 XP you could use Level(Player1,1) >>THEN myNPC1 ---- Level(Player1,2) THEN myNPC2 etc Both methods are used in the game. You can as well use the methods of Level1NPC mod that has a feature to give joining NPCs additional XPs according to PC's abilities. (Of course this feature needs to be optional and will only work if both mods are installed.). Link to comment
Jarno Mikkola Posted January 1, 2016 Share Posted January 1, 2016 use the methods of Level1NPC mod that ...Of course this feature needs to be optional and will only work if both mods are installed.).Well, if you adopt the system, not just request the player to always install the mod, you don't need to make it optional as it's you that dictates on how it's run in your own override script the NPC has assigned to up on joining. Link to comment
Greenman019 Posted January 1, 2016 Author Share Posted January 1, 2016 Thanks again. Last thing, do you know why I'm getting parsing errors with that multi npc dialogue code you posted ? Link to comment
Jarno Mikkola Posted January 1, 2016 Share Posted January 1, 2016 If you mean this: CHAIN IF ~NumTimesTalkedTo(0)~ THEN G)TRA Tra01 ~WHAT! What is the meaning of th-~ ==Savon IF~InParty("Savon")~THEN~Hey, hey~ == G)TRA IF~InParty("Savon")~THEN~Savon, isn't it? Yes, I remember you.~DO ~Enemy()~ EXIT It lacks the proper SPACE'ing.... Aka: CHAIN IF ~NumTimesTalkedTo(0)~ THEN G)TRA Tra01 ~WHAT! What is the meaning of th-~ == Savon IF ~InParty("Savon")~ THEN ~Hey, hey~ == G)TRA IF ~InParty("Savon")~ THEN ~Savon, isn't it? Yes, I remember you.~ DO ~Enemy()~ EXIT If there's something else, we need to see the debug and the code to solve the mystery. Roxanne was probably on a phone typing that... Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.