Guest Keldon Posted February 21, 2007 Share Posted February 21, 2007 Hello, I am currently creating an evil NPC whos initial conversation can go in a number of different directions. (from joining to going hostile) The one that I need help on is the one where she goes hostile. originally, I only wanted her to go hostile and then either die or kill the PC, but now am interested in having the option of, at a certain point, having the hostility end, and she becomes available for allegiance again if the PC does "X". Can you please show me 1) the coding to make an NPC go hostile 2) the coding to make an NPC go hostile, and then once again be available to join your team? Thank you Keldon Link to comment
Domi Posted February 21, 2007 Share Posted February 21, 2007 The code for NPC to go hostile is Enemy() in the dialogue DO function, ie IF ~~ GoHostile SAY ~I am going cut you down in a gazzillion of very little pieces.~ IF ~~ THEN DO ~Enemy()~ EXIT END To Change NPC's allegience after a certain condition is met (ie NPC dropped below certain amount of hp) you need to add a block to his or her Override script with this Action from IESDP: IF //Some condition, f.ex: HPPercentLT(Myself,90)// Allegiance(Myself,ENEMY) THEN RESPONSE #100 ChangeEnemyAlly(Myself,NEUTRAL) END Link to comment
Guest Guest Posted February 21, 2007 Share Posted February 21, 2007 Thank you very much for this quick response. I will go code it now and let you know how it turned out for me! Keldon Link to comment
Guest Guest Posted February 21, 2007 Share Posted February 21, 2007 Hello, Ok, it uhh, sorta worked and sorta didnt.... My NPC did indeed go hostile, but then just stood there. How do I get her to actually attack the PC? Thank you Keldon Link to comment
Miloch Posted February 21, 2007 Share Posted February 21, 2007 You should have a default script that the NPC uses to attack enemies (something like WTASIGHT usually). Or you can just add this block somewhere: IF See(NearestEnemyOf(Myself)) THEN RESPONSE #100 Attack(NearestEnemyOf(Myself)) END Link to comment
Guest Guest Posted February 21, 2007 Share Posted February 21, 2007 Hi Miloch, I tried this just like you showed and got parsing errors. I then tried a couple of other variations and well.....I geuss this is why I am a NOOB modder and this is my first mod. All I was getting was parsing errors in what was, before this, an NPC that was working. =/ Since I am such a NOOB at modding, could you please give me a clearer example so that my dumb a$$ can figure it out? Thank you Keldon Link to comment
Miloch Posted February 21, 2007 Share Posted February 21, 2007 Well, lesson 1 is never take scripting advice from a half-orc. I forgot a closing parenthesis on the first line - went back and added it. Link to comment
Guest Guest Posted February 21, 2007 Share Posted February 21, 2007 LOL! That is indeed really funny when you stop to think about it! Ok, on a more serious note, I went back and put the parenthesis in....still got the parsing error. In the first post, you said to put this coding "somewhere"...I took this to mean putting it in the .d file would be fine, is this so? Thank you Keldon Link to comment
Miloch Posted February 21, 2007 Share Posted February 21, 2007 Uh, no. I guess I should've been more specific. That is a script block, so it needs to go in a script file (.baf uncompiled or .bcs/.bs compiled) not a dialog file (.d). It can go in the override script after Domi's block, or you can add it to the NPC's general or default script, or you can put it in a new script file, compile that and assign it to a script slot. Or you can just skip it and use an existing general script like WTASIGHT that works similarly. Link to comment
Guest Guest Posted February 21, 2007 Share Posted February 21, 2007 Hmm, I think this is something I am going to have do more reading up on. Thank you for your help. Keldon Link to comment
Miloch Posted February 21, 2007 Share Posted February 21, 2007 Here's some good bedtime reading: Complete Scripting GuideI'm not sure if it has a happy ending though. I never got that far through it. Link to comment
berelinde Posted February 21, 2007 Share Posted February 21, 2007 Just to add a little extra confusion, you don't really need the Myself between the parenthesis. For that kind of scripting, you can get away with See(NearestEnemyOf()) and the Myself will be assumed. I try to do that wherever I can, because the less actual characters I have to type, the less chance there is that something will go wrong. Link to comment
Guest Guest Posted February 21, 2007 Share Posted February 21, 2007 Hi everyone! Ok, I have coded this and saved it in .baf I have it in my NPCName folder because I don't have an override folder for her and don't really know what else to do with it. So far, throughout the NPC's life, there are two possible times when she is supposed to attack the PC. The first time, she goes hostile but then just stands there and doesnt attack, not even if the PC attacks her. The second time, everything runs exactly as it should. She goes hostile and attacks the PC. I thought that maybe I coded something different, so I just redirected both of these events to the one that was working. I ended up with the same result. No attack first time, attack the second time. Can you tell me exactly, what I am supposed to do with this .baf file? I think miloch tried telling me last night, but I found his directions too vague for me to understand. As well, can you tell me why she won't attack the first time but will the second? Thank you Keldon Link to comment
Miloch Posted February 21, 2007 Share Posted February 21, 2007 Can you tell me exactly, what I am supposed to do with this .baf file? I think miloch tried telling me last night, but I found his directions too vague for me to understand.I was giving you options because I'm not sure of a number of things, including what you're trying to do with the NPC exactly, whether you have other scripts assigned to her, whether you're copying an existing NPC, which toolsets (NI/DLTCEP) you're using, which race/class your NPC is, etc., etc. I'm going to assume, for the sake of example, you have an NPC you started from scratch and she's not a spellcaster. If so, you'll need a lot more language in your script telling how she'll attack with spells rather than with just whatever weapon she might have. But first things first, let's start with the simple scenario. So you have a file for this NPC you've created with your favourite editor and you've made her appear in the game, so you've gotten that far. So you also have this .baf you want to assign. In your TP2 installer then, you'll have something like this: COPY ~YourMod/baf/yourbaf.baf~ ~YourMod/baf/yourbaf.baf~ COMPILE ~YourMod/baf/yourbaf.baf~ COPY ~YourMod/cre/yournpc.cre~ ~override~ SAY NAME1 @# //TRA file entry for NPC's name SAY NAME2 @# //ditto WRITE_ASCII 0x260 ~YOURBAF~ #8 //General script You could probably get away with leaving out line 6 if you assign it to your NPC via your editor. Now as to why your NPC would attack in one situation and not another, I guess I'd have to see more of your code and know more about the scenarios. And even then, I'm not really a scripting expert. You might need to put more aggressive attack language in your script - that link I posted probably has some examples. Or you can use them from other scripts already in game - this is perhaps best anyhow, as I suggested above, rather than trying to reinvent the wheel. Link to comment
berelinde Posted February 21, 2007 Share Posted February 21, 2007 You'd get more useful advice if you posted the relevant code. What do you already have in place, and where, exactly, is it going wrong? Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.