baldur46233 Posted July 24, 2010 Share Posted July 24, 2010 I'm having trouble understanding how to code restrictions for friendshhip tracks and such. Is this how you code it, or is there more to it? Is there more coding you have to do with restrictions? And I did look at the tutorial (Coding Friendships and Romances) by K'aeloree, just saying. IF InParty(Myself) Global("##MyNPCFriendCheck","GLOBAL",0) Global("##MyNPCFriendship","GLOBAL",0) Global("##MyNPCFriendTalks","GLOBAL",0) OR(3) Race(Player1,GNOME) Race(Player1,DWARF) Race(Player1,HALFLING) !Alignment(Player1,MASK_GOOD) THEN RESPONSE #100 RealSetGlobalTimer("##MyNPCFriendTalksTimer","GLOBAL",1200) SetGlobal("##MyNPCFriendTalks","GLOBAL",1) SetGlobal("##MyNPCFriendCheck","GLOBAL",1) SetGlobal("##MyNPCFriendship","GLOBAL",1) By the way, hello Link to comment
Guest Guest_Ipsy_* Posted July 24, 2010 Share Posted July 24, 2010 IF InParty(Myself) Global("##MyNPCFriendCheck","GLOBAL",0) Global("##MyNPCFriendship","GLOBAL",0) Global("##MyNPCFriendTalks","GLOBAL",0) OR(3) Race(Player1,GNOME) Race(Player1,DWARF) Race(Player1,HALFLING) !Alignment(Player1,MASK_GOOD) THEN RESPONSE #100 RealSetGlobalTimer("##MyNPCFriendTalksTimer","GLOBAL",1200) SetGlobal("##MyNPCFriendTalks","GLOBAL",1) SetGlobal("##MyNPCFriendCheck","GLOBAL",1) SetGlobal("##MyNPCFriendship","GLOBAL",1) For restrictions, this is basically all you'll need. You can put material restricted to a particular class/race/alignment/area/chapter/gender in your mod, but this is via D rather than this script. You can also use a lot of different stuff as conditions for this script, everything from being in a particular chapter of the game to PC gender or class. An example with comments: IF InParty(Myself) // NPC is in party Global("i-EnyaRomanceCheck","GLOBAL",0) // This global variable has not yet been checked Global("i-EnyaRomance","GLOBAL",0) // Romance currently not active/in progress Global("i-EnyaLovetalks","GLOBAL",0) // Player has received no lovetalks yet. // Note: InParty, RomanceCheck, Romance, and Lovetalk (or FriendCheck, Friendship, and Friendtalk) checks are standard, and required in all cases. Gender(Player1,MALE) // checks that Player1, aka CHARNAME, is male ReputationGT(Player1,9) // the party has reputation of 10 or higher GlobalGT("Chapter","GLOBAL",2) // the game is currently in chapters 3 or later THEN RESPONSE #100 RealSetGlobalTimer("i-EnyaLovetalksTimer","GLOBAL",1800) // first talk will occur 1800 seconds from now, i.e. half an hour SetGlobal("i-EnyaLovetalks","GLOBAL",1) // sets lovetalk global to 1 SetGlobal("i-EnyaRomanceCheck","GLOBAL",1) // romance eligibility has now been checked SetGlobal("i-EnyaRomance","GLOBAL",1) // romance is now "progressing," stage 1. END //ends this script There is more code necessary for full friendships/romances, but this is all you need to ensure that the friendship/romance occurs only under certain conditions. What in particular are you finding hard to understand, though? Link to comment
baldur46233 Posted July 24, 2010 Author Share Posted July 24, 2010 I don't really know how to phrase my question, but... if that's a script what should it be saved into D file or etc. (that was not my question, but I was curious) What exactly does that mean when you need *more* coding? Link to comment
Guest Guest_Ipsy_* Posted July 24, 2010 Share Posted July 24, 2010 Scripts are saved with the extension baf. So yours would be JQ#[NPCname].baf. You tell WeiDU to compile scripts like this the same way you would tell it to compile D files: COMPILE ~MyMod/Script.baf~ in your tp2 file. Your example in your OP and my example are just what you'd use to ensure that your NPC's friendship is made active (set to 1), friendship check performed (set to 1), and variable/timer set such that the first talk will occur after the amount of time specified. For scripted talks, you'd need a block of code to initiate the talks. Example: IF InParty(Myself) See(Player1) // can also use InMyArea(Player1) !StateCheck("i-Enya",CD_STATE_NOTVALID) !StateCheck(Player1,CD_STATE_NOTVALID) RealGlobalTimerExpired("i-EnyaLovetalksTimer","GLOBAL") CombatCounter(0) !See([ENEMY]) OR(8) // if any of these conditions is met Global("i-EnyaLovetalks","GLOBAL",1) Global("i-EnyaLovetalks","GLOBAL",3) Global("i-EnyaLovetalks","GLOBAL",5) Global("i-EnyaLovetalks","GLOBAL",7) Global("i-EnyaLovetalks","GLOBAL",9) Global("i-EnyaLovetalks","GLOBAL",11) Global("i-EnyaLovetalks","GLOBAL",13) Global("i-EnyaLovetalks","GLOBAL",15) THEN RESPONSE #100 MoveToObject(Player1) // character moves over to Player 1 to talk to them Dialogue(Player1) // dialogue begins END That block initiates all the actual talks, as I said. But you need this to ensure that "i-EnyaLovetalks" is set to 1, 3, 5, etc. Like this: IF InParty(Myself) See(Player1) RealGlobalTimerExpired("i-EnyaLovetalksTimer","GLOBAL") // checks that the lovetalks timer is expired OR(7) Global("i-EnyaLovetalks","GLOBAL",2) Global("i-EnyaLovetalks","GLOBAL",4) Global("i-EnyaLovetalks","GLOBAL",6) Global("i-EnyaLovetalks","GLOBAL",8) Global("i-EnyaLovetalks","GLOBAL",10) Global("i-EnyaLovetalks","GLOBAL",12) Global("i-EnyaLovetalks","GLOBAL",14) THEN RESPONSE #100 IncrementGlobal("i-EnyaLovetalks","GLOBAL",1) // increases the value of "i-EnyaLovetalks" by 1 END IIRC, K'aeloree's tutorial included several sample files - a J file with sequential talks, a BAF file with a script to make them occur in a given order, and a dream script file to make a rest-triggered dialogue fire. Eventually (from my experience at least) what all the code does starts making sense. Take things one step at a time. Try changing the generic variables in those files so that they will fire for your NPC. Link to comment
baldur46233 Posted July 25, 2010 Author Share Posted July 25, 2010 Scripts are saved with the extension baf. So yours would be JQ#[NPCname].baf. You tell WeiDU to compile scripts like this the same way you would tell it to compile D files: COMPILE ~MyMod/Script.baf~ in your tp2 file. Your example in your OP and my example are just what you'd use to ensure that your NPC's friendship is made active (set to 1), friendship check performed (set to 1), and variable/timer set such that the first talk will occur after the amount of time specified. For scripted talks, you'd need a block of code to initiate the talks. Example: IF InParty(Myself) See(Player1) // can also use InMyArea(Player1) !StateCheck("i-Enya",CD_STATE_NOTVALID) !StateCheck(Player1,CD_STATE_NOTVALID) RealGlobalTimerExpired("i-EnyaLovetalksTimer","GLOBAL") CombatCounter(0) !See([ENEMY]) OR(8) // if any of these conditions is met Global("i-EnyaLovetalks","GLOBAL",1) Global("i-EnyaLovetalks","GLOBAL",3) Global("i-EnyaLovetalks","GLOBAL",5) Global("i-EnyaLovetalks","GLOBAL",7) Global("i-EnyaLovetalks","GLOBAL",9) Global("i-EnyaLovetalks","GLOBAL",11) Global("i-EnyaLovetalks","GLOBAL",13) Global("i-EnyaLovetalks","GLOBAL",15) THEN RESPONSE #100 MoveToObject(Player1) // character moves over to Player 1 to talk to them Dialogue(Player1) // dialogue begins END That block initiates all the actual talks, as I said. But you need this to ensure that "i-EnyaLovetalks" is set to 1, 3, 5, etc. Like this: IF InParty(Myself) See(Player1) RealGlobalTimerExpired("i-EnyaLovetalksTimer","GLOBAL") // checks that the lovetalks timer is expired OR(7) Global("i-EnyaLovetalks","GLOBAL",2) Global("i-EnyaLovetalks","GLOBAL",4) Global("i-EnyaLovetalks","GLOBAL",6) Global("i-EnyaLovetalks","GLOBAL",8) Global("i-EnyaLovetalks","GLOBAL",10) Global("i-EnyaLovetalks","GLOBAL",12) Global("i-EnyaLovetalks","GLOBAL",14) THEN RESPONSE #100 IncrementGlobal("i-EnyaLovetalks","GLOBAL",1) // increases the value of "i-EnyaLovetalks" by 1 END IIRC, K'aeloree's tutorial included several sample files - a J file with sequential talks, a BAF file with a script to make them occur in a given order, and a dream script file to make a rest-triggered dialogue fire. Eventually (from my experience at least) what all the code does starts making sense. Take things one step at a time. Try changing the generic variables in those files so that they will fire for your NPC. That makes a lot more sense! Thank you And this is the same for LoveTalks, except you change the Friendship stuff to different words, like yours. Right? Or is there something else that's different? And for all the coding you did above (stupid question), where would you put it in your baf? For example, the beginning of it, or maybe in the middle, or even when you're writing. Link to comment
Ipsy Posted July 25, 2010 Share Posted July 25, 2010 A romance is a tad different. Friendships are generally nonexistent, active, or dead. Romances can have a lot more variation, but the minimum is 0 (nonexistent), 1 (progressing), 2 (active and committed), and 3 (killed off at some point). The examples I posted are just what would go in the baf file. For actual dialogue, you'd need: IF ~Global("i-EnyaLovetalks","GLOBAL",1) RealGlobalTimerExpired("i-EnyaLovetalksTimer","GLOBAL")~ THEN BEGIN i-EnyaLT1 SAY ~(dialogue)~ But you can handle changing the romance variable in dialogue. For instance: IF ~Global("i-EnyaLovetalks","GLOBAL",21) RealGlobalTimerExpired("i-EnyaLovetalksTimer","GLOBAL")~ THEN BEGIN i-EnyaLT21 SAY ~<CHARNAME>, I love you.~ ++ ~Too bad.~ + i-EnyaLT21.1 ++ ~Yay!~ + i-EnyaLT21.2 END IF ~~ i-EnyaLT21.1 SAY ~(sniff) IF ~~ DO ~SetGlobal("i-EnyaRomance","GLOBAL",3)~ EXIT END IF ~~ i-EnyaLT21.2 SAY ~(smiles)~ IF ~~ DO ~SetGlobal("i-EnyaRomance","GLOBAL",2)~ EXIT END Ye gods, I hope that I never stoop to that level of *writing*... Link to comment
baldur46233 Posted July 25, 2010 Author Share Posted July 25, 2010 A romance is a tad different. Friendships are generally nonexistent, active, or dead. Romances can have a lot more variation, but the minimum is 0 (nonexistent), 1 (progressing), 2 (active and committed), and 3 (killed off at some point). The examples I posted are just what would go in the baf file. For actual dialogue, you'd need: IF ~Global("i-EnyaLovetalks","GLOBAL",1) RealGlobalTimerExpired("i-EnyaLovetalksTimer","GLOBAL")~ THEN BEGIN i-EnyaLT1 SAY ~(dialogue)~ But you can handle changing the romance variable in dialogue. For instance: IF ~Global("i-EnyaLovetalks","GLOBAL",21) RealGlobalTimerExpired("i-EnyaLovetalksTimer","GLOBAL")~ THEN BEGIN i-EnyaLT21 SAY ~<CHARNAME>, I love you.~ ++ ~Too bad.~ + i-EnyaLT21.1 ++ ~Yay!~ + i-EnyaLT21.2 END IF ~~ i-EnyaLT21.1 SAY ~(sniff) IF ~~ DO ~SetGlobal("i-EnyaRomance","GLOBAL",3)~ EXIT END IF ~~ i-EnyaLT21.2 SAY ~(smiles)~ IF ~~ DO ~SetGlobal("i-EnyaRomance","GLOBAL",2)~ EXIT END Ye gods, I hope that I never stoop to that level of *writing*... I understand how to write it, but not the scripting part, which I do know a bit now thanks to you And I must ask, when scripting do you have to write BEGIN blah or anything like that? Also, when do you know when to use FriendCheck, Friendship, and Friendtalk, or RomanceTalk and Romance active? Link to comment
baldur46233 Posted July 25, 2010 Author Share Posted July 25, 2010 A romance is a tad different. Friendships are generally nonexistent, active, or dead. Romances can have a lot more variation, but the minimum is 0 (nonexistent), 1 (progressing), 2 (active and committed), and 3 (killed off at some point). The examples I posted are just what would go in the baf file. For actual dialogue, you'd need: IF ~Global("i-EnyaLovetalks","GLOBAL",1) RealGlobalTimerExpired("i-EnyaLovetalksTimer","GLOBAL")~ THEN BEGIN i-EnyaLT1 SAY ~(dialogue)~ But you can handle changing the romance variable in dialogue. For instance: IF ~Global("i-EnyaLovetalks","GLOBAL",21) RealGlobalTimerExpired("i-EnyaLovetalksTimer","GLOBAL")~ THEN BEGIN i-EnyaLT21 SAY ~<CHARNAME>, I love you.~ ++ ~Too bad.~ + i-EnyaLT21.1 ++ ~Yay!~ + i-EnyaLT21.2 END IF ~~ i-EnyaLT21.1 SAY ~(sniff) IF ~~ DO ~SetGlobal("i-EnyaRomance","GLOBAL",3)~ EXIT END IF ~~ i-EnyaLT21.2 SAY ~(smiles)~ IF ~~ DO ~SetGlobal("i-EnyaRomance","GLOBAL",2)~ EXIT END Ye gods, I hope that I never stoop to that level of *writing*... The worlds shortest replies and sayings for a NPC I understand how to write it, but not the scripting part, which I do know a bit now thanks to you And I must ask, when scripting do you have to write BEGIN blah or anything like that? Also, when do you know when to use FriendCheck, Friendship, and Friendtalk, or RomanceTalk and Romance active? Link to comment
baldur46233 Posted July 25, 2010 Author Share Posted July 25, 2010 I posted twice sorry, ignore one of them, they're both the same.... Link to comment
Ipsy Posted July 25, 2010 Share Posted July 25, 2010 I understand how to write it, but not the scripting part, which I do know a bit now thanks to you And I must ask, when scripting do you have to write BEGIN blah or anything like that? Also, when do you know when to use FriendCheck, Friendship, and Friendtalk, or RomanceTalk and Romance active? No, no BEGIN needed. You need to have an END at the end of every script block though. Variable names can be basically whatever you want. You could use CharacterRA or FA for romance active/friendship active, or CharacterRomanceActive, or CharacterRomance. Romance/friendship talk tracks the current talk # in the friendship/romance path. Romance/friendship active tracks if the friendship/romance is still active. The different labels are primarily for your convenience Link to comment
berelinde Posted July 25, 2010 Share Posted July 25, 2010 Global variable names must be <32 characters long. Local variable names must be <24 characters long. I'm not sure about area variables, but you won't go wrong by keeping them short. Generally, the shorter the variable name, the better. If nothing else, less characters = less chance of typos. Link to comment
baldur46233 Posted July 25, 2010 Author Share Posted July 25, 2010 Global variable names must be <32 characters long. Local variable names must be <24 characters long. I'm not sure about area variables, but you won't go wrong by keeping them short. Generally, the shorter the variable name, the better. If nothing else, less characters = less chance of typos. Thanks! I'll keep that in mind... Link to comment
baldur46233 Posted July 30, 2010 Author Share Posted July 30, 2010 I understand how to write it, but not the scripting part, which I do know a bit now thanks to you And I must ask, when scripting do you have to write BEGIN blah or anything like that? Also, when do you know when to use FriendCheck, Friendship, and Friendtalk, or RomanceTalk and Romance active? No, no BEGIN needed. You need to have an END at the end of every script block though. Variable names can be basically whatever you want. You could use CharacterRA or FA for romance active/friendship active, or CharacterRomanceActive, or CharacterRomance. Romance/friendship talk tracks the current talk # in the friendship/romance path. Romance/friendship active tracks if the friendship/romance is still active. The different labels are primarily for your convenience I must have skipped this post...because I forgot to say thank you. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.