St_Vitruvius Posted April 22, 2007 Author Share Posted April 22, 2007 Ahh.. it works.. Thanks.. I wanted him to stand still and have the player activate the dialogue, but it's good to know how I make the npc initaiate it as well.. What I still need to know is how to make conditional dialogue.. How to check for class/race/alignment and then say the right blok of text.. Link to comment
cmorgan Posted April 22, 2007 Share Posted April 22, 2007 If you grab the values from the IESDP list of triggers, you can get practically anything. Just put them as conditionals on your replies, and the ones appropriate will show up: IF WEIGHT #-1 ~Global("TutorTalks","GLOBAL",1)~ THEN BEGIN TutorStartingDialogue SAY ~OK, I need to figure out what you are, so I am going to get some stuff to happen.~ IF ~~ THEN REPLY ~I don't want to talk to you no matter what~ EXIT IF ~Class(Player1,FIGHTER_ALL)~ THEN ~If I'm a Fighter, this shows up and I go to the Fighter Block~ DO ~SetGlobal("TutuorTalks","GLOBAL",1)~ GOTO FighterTalk IF ~Gender(Player1,MALE)~ THEN ~If I'm a Male, this shows up and I go to the Male Block~ DO ~SetGlobal("TutuorTalks","GLOBAL",1)~ GOTO MaleTalk IF ~Class(Player1,MAGE_ALL) Gender(Player1,MALE)~ THEN ~If I'm a Mage AND Male, this shows up and I go to the MaleMage Block~ DO ~SetGlobal("TutuorTalks","GLOBAL",1)~ GOTO MaleMageTalk IF ~OR(2) Class(Player1,MAGE_ALL) Gender(Player1,FEMALE)~ THEN ~If I'm a Mage OR female, this shows up and I go to the MageOrFemale Block~ DO ~SetGlobal("TutuorTalks","GLOBAL",1)~ GOTO MageOrFemaleTalk END So the conversation (if something has set the global first to 1) goes: Tutor: "OK, I need to figure out what you are, so I am going to get some stuff to happen." PC Replies available if they are Male Fighters: PC: "If I'm a Male, this shows up and I go to the Male Block" PC: "If I'm a Fighter, this shows up and I go to the Fighter Block" PC: "I don't want to talk to you no matter what." PC Replies available if they are female: PC: "If I'm a Mage OR female, this shows up and I go to the MageOrFemale Block" PC: "I don't want to talk to you no matter what." >> note that this is from bottom to top parsing, so the bottom one is evaluated first This means you don't even have to have the talk. If we wanted to hijack the conversation to a completely different thread for Elven Clerics, then we would add an "escape" at the bottom, to move right to another block with none of the other replies ever getting seen: IF ~Race(Player1,ELF) Class(Player1,CLERIC_ALL)~ THEN DO ~SetGlobal("TutorTalks","GLOBAL",1)~ GOTO TutuorWarnsElfClericsAboutJon END Link to comment
berelinde Posted April 22, 2007 Share Posted April 22, 2007 I've got this in Gavin's greeting dialogue. There are 2 conditional PC responses, one for a PC of a particular class and alignment (evil cleric), and one for a party that has a specific item. BEGIN ~B!Gavin~ APPEND ~B!Gavin~ IF ~NumTimesTalkedTo(0)~ THEN BEGIN BGavinHello SAY ~Lathander's blessings upon you! I am Dawnbringer Gavin. What brings you to the temple to<DAYNIGHT>?~ ++ ~We are in need of the temple’s services.~ + BGavin001a ++ ~Just passing through.~ + BGavin001b ++ ~We could use a little divine intervention.~ + BGavin001c ++ ~We’re seeking knowledge.~ + BGavin001d ++ ~Temples and alehouses are the best places to catch up on gossip, and none of us are thirsty.~ + BGavin001d ++ ~Can you tell me about Lathander?~ + BGavin001e IF ~PartyHasItem("X#COWIRO")~ THEN REPLY ~Can you do something with these roses?~ + BGavin001f ++ ~Stand aside.~ EXIT IF ~Alignment(Player1,MASK_EVIL) Class(Player1,CLERIC_ALL) ~ THEN REPLY ~Move away now, we don't need to talk to you.~ EXIT END If you wanted to code a specific thing for alignment in the initial line, you could do IF ~NumTimesTalkedTo(0) Alignment(Player1,MASK_GOOD)~ THEN or any other combination of your choice. Just remember a few things: 1) If you want the player to be able to initiate dialogue with the NPC at a particular state, you need to use some condition. In the above example, the condition is NumTimesTalkedTo(0), but it can be anything. For example, if you want the NPC to react to a PC decision *only* if the PC initiates dialogue, you could set a variable when the decision is made, then use it as a condition for a talk. If the PC chose to work for Bodhi instead of the Shadow thieves, I would add a state trigger to Bodhi's dialogue at the appropriate place. If I wanted Gavin to say something about it, but only if spoken to first (if he had passive-aggressive tendencies), I would do IF ~Global("B!WorkingForBodhi","GLOBAL",1)~ THEN BEGIN BWrongTeam SAY ~After what you said to Bodhi, I have nothing to say to you.~ IF ~~ THEN DO ~SetGlobal("B!WorkingForBodhi","GLOBAL",2)~ EXIT END That would have him say that once, but only once. when the PC initiated dialogue with him. 2) Forgot the all important item number 2: do not write yourself into a dead end. If you have confusing triggers, it will be very easy to write yourself into a situation where the PC falls into none of the categories and you'll get the dreaded No Valid Replies or Links message. Just make sure you cover your bases. Link to comment
St_Vitruvius Posted April 23, 2007 Author Share Posted April 23, 2007 What is the pros and cons of the two different scripting styles? And what exactly does "IF WEIGHT #-1" do, cmorgan? And what does the "++" and "+ BGavin001a" do, berelinde? Link to comment
berelinde Posted April 23, 2007 Share Posted April 23, 2007 WEIGHT #-1 moves the item further up in the dialogue file order. You can read about it doing a quick search on PPG forum. ++ is shorthand for IF ~~ THEN REPLY. If there were conditions, it would look like + ~conditions~ +. The + Gavin001 is shorthand for GOTO Gavin001. I use state names that contain at least one letter. Link to comment
cmorgan Posted April 23, 2007 Share Posted April 23, 2007 We are actually both using the same scripting style, if you mean ++ + vs IF SAY. In coding, we both switch between ++ ~reply~ + NewState and IF ~~ THEN REPLY ~reply~ GOTO NewState The only reason to use one over the other is to save yourself keystrokes (once you have learned to read it!). unless you are talking about CHAIN, or something... WeiDU sees both as identical. Both berelinde and I learned from the same folks, and are passing on the info; the way we learned these styles was just the way you are doing - trying and then posting lots of questions. We also both ended up going and looking at other people's mod's code, and reading the tutorials (many times) then did the trial and error thing. My suggestion here is to crack open Gavin (sorry, berelinde ) Xan (sorry Kulyok ) and Kivan (sorry Domi ) -- ok, don't crack them open literally, just open up the mods and see how they work. Then hit the ttorials and see if you can pick up what these three ladies are doing, and you should be able to see what is going on. Link to comment
berelinde Posted April 23, 2007 Share Posted April 23, 2007 St V.-- Are you writing for a joinable NPC or a quest NPC? Not that it makes a difference in code, but it will help us tailor our responses to suit your needs. Link to comment
St_Vitruvius Posted April 24, 2007 Author Share Posted April 24, 2007 Ahh.. I think I'll stick to the long and slow coding atm., as I still need to learn it.. I'm currently writing for a quest-npc.. He's supposed to add different kits based on different circumstances after completing a specific quest. (It's for my 'Racial Packages'..) I'll probably do a joinable npc in the future. Right now I'm trying to figure out how to use 'CheckStatGT(O:Object*,I:Value*,I:StatNum*Stats)'. Or more precicely: If it automatically checks the specified stat of player doing the talking, or what it does. I need it to check a specific players stats and have them exeed a cirtain amount. Aditionally I need to figure out how to check for cirtain mod-npcs and and how to make my mod add something to them.. AS you said; trial and error.. \St_Vitruvius Link to comment
berelinde Posted April 24, 2007 Share Posted April 24, 2007 If I wanted to check for an attribute, I would do this: IF ~Class(Player1,BARD) CheckStatGT(Player1,15,CHR) OR(2) Alignment(Player1,MASK_GENEUTRAL) Alignment(Player1,MASK_LCNEUTRAL)~ THEN REPLY ~What have you got for a bard like me?~ That would give you a PC response *only* for a bard of some neutral alignment with a charisma of 16 or better. Mind you, bards should all be of some neutral alignment, but players know how to use SK, too. Link to comment
St_Vitruvius Posted April 24, 2007 Author Share Posted April 24, 2007 Can I check for unkitted classes? I tried using 'KIT(Player1,TRUE_CLASS)' but my unkitted Fighter didn't return true.. I tried having the npc add a kit to the character with the following code: IF ~~ THEN BEGIN yesBladesong SAY @17 IF ~~ THEN DO ~AddKit(Player1,SRBladesinger) SetGlobal("SRPlayer1BSR","GLOBAL",1)~ EXIT END But it didn't do anything.. Is it the wrong code I use? Link to comment
berelinde Posted April 24, 2007 Share Posted April 24, 2007 You would have to exclude the kits !Kit(Player1,KIT_NAME) Link to comment
St_Vitruvius Posted April 24, 2007 Author Share Posted April 24, 2007 I'm afraid that will not work in the long rung.. I'd have to add the condition for every Fighter kit ever made in every mod I come across.. But I'll have to do it that way untill I find a better solution.. Link to comment
Miloch Posted April 24, 2007 Share Posted April 24, 2007 I didn't read this whole thing, but KIT(Player1,TRUE_CLASS) probably won't return TRUE for an unkitted fighter. Not sure if even TRUECLASS would, which is the text value in my game, but TRUECLASS = 0x4000 (16384 in decimal) - usually valid for mages without a specific school. You could *try* KIT(Player1,0) but I'm not sure if that's valid either. In theory it should be, but practice often proves different from theory. Link to comment
St_Vitruvius Posted April 25, 2007 Author Share Posted April 25, 2007 I've tried KIT(Player1,NO_KIT), but that didn't work.. I saw in NI that NO_KIT has the value 0, so I don't believe it works either.. I'm trying to have the npc add a kit to my fighter, but i can't seem to get it to work.. In the IESDP it says 'AddKit(I:Kit*KIT)'. But that looks like it sjould be in a script applied to the creature getting the kit. I want my npc to add it to the pc, so I had used it in the d and wrote this: AddKit(Player1,SRElven_Knight) It's obviously incorrect, as it doesn't work. But how do I do the trick then? Link to comment
Miloch Posted April 25, 2007 Share Posted April 25, 2007 I saw in NI that NO_KIT has the value 0, so I don't believe it works either..I don't see NO_KIT in KIT.IDS - I'm not sure how NI manipulates these values. You're better off trying KIT(Player1,0). While you're looking at kit.ids, you might make sure your own kit has an entry. But AddKit does seem to work only on the creature running the script, so I'm not sure how you'd get it to work (thought there was a tutorial or example around here somewhere). Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.