CoM_Solaufein Posted September 24, 2007 Share Posted September 24, 2007 It has come to the time of creating something complex in scripting. Complex to me that is. I've been looking over some samples like Mazzy's and Korgan's, on how their quests works relating to GlobalTimers. I have to say it makes my head hurt. In laymen's terms, A non joinable npc approaches my mods NPC, after leaving the Underdark. They talk, this triggers my mods NPC's quest. They have two days to go and complete this quest or my mods NPC says see ya! One day passes by the NPC complains about what is taking so long. At the end of day two if the quest is not complete, the NPC leaves. Sounds easy, just trying to code this is hard or I may be making it harder than what it should be. Link to comment
Miss Sakaki Posted September 24, 2007 Share Posted September 24, 2007 After the nonjoinable NPC shows up, at the end of the conversation have a timer set like so: DO ~SetGlobalTimer("NPCComplainTime","GLOBAL",ONE_DAY)~ Then in the NPC's script, have: IF GlobalTimerExpired("NPCComplainTime","GLOBAL") Global("NPCComplain","GLOBAL",0) !AreaCheck("Any areas you don't want the NPC to complain in") !StateCheck("NPC",Any states you don't want the NPC to be in, eg sleeping or helpless) Global("QuestHasn'tBeenCompleted","GLOBAL",0) THEN RESPONSE #100 SetGlobal("NPCComplain","GLOBAL",1) StartDialogueNoSet(Player1) END In the interjection dialogue file, have this: IF ~Global("NPCComplain","GLOBAL",1)~ THEN BEGIN NPCComplain SAY ~It's been a day since I wanted to go do that thing. I want to go and do it.~ IF ~~ THEN DO ~SetGlobalTimer("NPCComplainTime","GLOBAL",ONE_DAY) SetGlobal("NPCComplain","GLOBAL",2)~ EXIT END And then in the script again: IF GlobalTimerExpired("NPCComplainTime","GLOBAL") Global("NPCComplain","GLOBAL",2) Global("QuestHasn'tBeenCompleted","GLOBAL",0) !AreaCheck("Blah, as before") !StateCheck("NPC",as before) THEN RESPONSE #100 StartDialogueNoSet(Player1) END Back to the dialogue file: IF ~Global("NPCComplain","GLOBAL",2) Global("QuestHasn'tBeenCompleted","GLOBAL",0)~ THEN BEGIN NPCComplain2 SAY ~You didn't go and do my quest. I'm off!~ IF ~~ THEN DO ~SetGlobal("NPCComplain","GLOBAL",3) LeaveParty() EscapeArea() EXIT END Hope that's useful. Link to comment
berelinde Posted September 24, 2007 Share Posted September 24, 2007 Stick this in your NPC's override script: /* start the timer - 10 minutes after start of Chapter 6 */ IF InParty(Myself) !StateCheck(Myself,CD_STATE_NOTVALID) GlobalGT("Chapter","GLOBAL",5) Global("Quest","GLOBAL",0) THEN RESPONSE #100 RealSetGlobalTimer("QuestTime","GLOBAL",600) SetGlobal("Quest","GLOBAL"1) END /* spawn the quest giver - have him talk to MyNPC immediately */ IF RealGlobalTimerExpired("QuestTime","GLOBAL") InParty(Myself) !StateCheck(Myself,CD_STATE_NOTVALID) Global("Quest","GLOBAL"1) AreaType(OUTDOOR) THEN RESPONSE #100 CreateCreatureObjectOffset("MyCRE","MyNPCDV",[100.100] SetGlobal("Quest","GLOBAL",2) ActionOverride("MyCREDV",Dialog("MyNPCDV")) END /* set up warning that time is running out - timer and global set in quest giver dialogue */ /* note that this action is split into a trigger block and an action block to ensure that it happens */ IF GlobalTimerExpired("QuestTime","GLOBAL") Global("Quest","GLOBAL",3) InParty(Myself) !StateCheck(Myself,CD_STATE_NOTVALID) !StateCheck(Player1,CD_STATE_NOTVALID) InMyArea(Player1) THEN RESPONSE #100 SetGlobal("Quest","GLOBAL",4) END /* warn player that time is running out */ IF Global("Quest","GLOBAL",4) InParty(Myself) !StateCheck(Myself,CD_STATE_NOTVALID) !StateCheck(Player1,CD_STATE_NOTVALID) InMyArea(Player1) THEN RESPONSE #100 StartDialogueNoSet(Player1) END /* set up leaving dialogue */ IF GlobalTimerExpired("QuestTime","GLOBAL") Global("Quest","GLOBAL",5) InParty(Myself) !StateCheck(Myself,CD_STATE_NOTVALID) !StateCheck(Player1,CD_STATE_NOTVALID) InMyArea(Player1) THEN RESPONSE #100 SetGlobal("Quest","GLOBAL",6) END /* MyNPC tells PC he's outa there */ IF Global("Quest","GLOBAL",6) InParty(Myself) !StateCheck(Myself,CD_STATE_NOTVALID) !StateCheck(Player1,CD_STATE_NOTVALID) InMyArea(Player1) THEN RESPONSE #100 StartDialogueNoSet(Player1) END And this for the quest giver dialogue (MyCRE for dialogue file, MyCREDV for DV): IF ~Global("Quest","GLOBAL",2)~ GiveQuest SAY ~I want you to do this quest.~ IF ~~ THEN DO ~SetGlobal("Quest","GLOBAL",3) SetGlobalTimer("QuestTime","GLOBAL",ONE_DAY) ActionOverride("MyCREDV",EscapeArea())~ EXIT END And this for MyNPC's warning and leaving: IF ~Global("Quest","GLOBAL",4)~ Complain SAY ~You said you'd do my quest.~ IF ~~ THEN DO ~SetGlobal("Quest","GLOBAL",5) SetGlobalTimer("QuestTime","GLOBAL",ONE_DAY)~ EXIT END IF ~Global("Quest","GLOBAL",6)~ Quit SAY ~You aren't going to do this, are you? Never mind. I'm outa here.~ IF ~~ THEN DO ~SetGlobal("Quest","GLOBAL",7) SetGlobalTimer("QuestTime","GLOBAL",ONE_DAY) SetGlobal("KickedOut","LOCALS",1) LeaveParty() EscapeArea()~ EXIT END Of course, you'll want to set the quest global higher than 7 if the quest is completed successfully. Edit: Miss Sakaki is faster than me. She does it a bit different, but there is seldom only one right way to do something. Link to comment
Miss Sakaki Posted September 24, 2007 Share Posted September 24, 2007 Miss Sakaki is faster than me. She does it a bit different, but there is seldom only one right way to do something. Yep, there are lots of variations for the same thing, so there's plenty of flexibility. And the code I posted was just the timer rather than the spawning of the NPC, so that's also something to bear in mind. Link to comment
Avenger Posted September 24, 2007 Share Posted September 24, 2007 Add in PartyRested() too, it is nicer to complain only when the team is in top shape. Link to comment
CoM_Solaufein Posted October 5, 2007 Author Share Posted October 5, 2007 Thanks by the way. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.