gasti89 Posted May 17, 2012 Share Posted May 17, 2012 (edited) Hey there, it's the scripting noob again. I'm asking the helpful community to help my scripting a duel. I have a quest where after a SetStage the player and the NPC must engage a duel, that will finish when one of them reaches a Health rate. In this quest there are also 2 objectives that can be completed in any order (one of them is winning the duel) What i need in the script is: - engaging the duel after the SetStage - finishing the duel when one reaches (let's say) 20% health - if the player loses, call another stage (that will be the condition for a forcegreet package, where the NPC tells the player to come later after getting stronger) - if the player wins, call two different stages ---> one if the other objective has been completed, the other if not. Both will lead to a forcegreet package. I managed to understand all the stuff involved, such as Start and StopCombat, GetActorValue, etc, but i don't have any idea on how to put them together. Also, where should i put the script? On the fragment for the stage called at the beginning? Thank you in advance! Edited May 17, 2012 by gasti89 Link to comment Share on other sites More sharing options...
fg109 Posted May 17, 2012 Share Posted May 17, 2012 Script fragment on quest stage that uses StartCombat and also assigns the player and the NPC to reference aliases with ForceRefTo.GetActorValuePercentage inside the OnHit event of the reference alias scripts.SetStage called after the health check in the player's reference alias script.SetStage called after the health check in the NPC's reference alias script. Link to comment Share on other sites More sharing options...
gasti89 Posted May 18, 2012 Author Share Posted May 18, 2012 Hey fg, thanks very much as always. - But what if i already have the NPC as an alias? Do i only have to force the player? - Also, do i force it into an empty alias? - Should i call the StopCombat() with the last SetStage? Sorry for all the questions, but i never used thise commands So i guess my scripts should be something like this: - Stage Fragment Alias_Dante.GetReference().StartCombat(Game.GetPlayer()) Alias_EmptyAlias.ForceRefTo(Game.GetPlayer()) - Player Alias Script Event OnHit (ObjectReference akAggressor) if akAggressor == myNPC if Game.GetPlayer().GetActorValuePercentage("health") <= 0.2 if preQuest.GetStageDone(prereqstage) == 1 myNPC.StopCombat() myQuest.SetStage(newStage) endif endif endif EndEvent - NPC Alias Script Event OnHit (ObjectReference akAggressor) if akAggressor == Game.GetPlayer() if myNPC.GetActorValuePercentage("health") <= 0.2 if preQuest.GetStageDone(prereqstage) == 1 && preQuest.IsObjectiveCompleted(prereqObj) == 1 myNPC.StopCombat() myQuest.SetStage(newStage) elseif preQuest.GetStageDone(prereqstage) == 1 && preQuest.IsObjectiveCompleted(prereqObj) == 0 myNPC.StopCombat() myQuest.SetStage(newStage2) endif endif endif EndEvent Am i right? :) Link to comment Share on other sites More sharing options...
fg109 Posted May 18, 2012 Share Posted May 18, 2012 Sort of. You need to list all the parameters for OnHit, but otherwise you're good. You may want to add a StopCombat for any akAggressor that isn't the player or quest NPC, in case someone interferes. Also, in your new stage, remember to clear the alias holding the player. For the alias script on the NPC, you'll want to condition it so that it only tracks the health in the OnHit event while your quest is in the dueling stage. Link to comment Share on other sites More sharing options...
gasti89 Posted May 18, 2012 Author Share Posted May 18, 2012 (edited) Well, no one should interfere, but i'll test if guards get pissed about that ;) Few more questions: How do I kick off the player alias? Do you suggest me to leave the NPC alias alone and create a new empty Alias to give to the NPC only for the duel? EDIT: Found Clear() for the 1st question! Is it ok? Edited May 18, 2012 by gasti89 Link to comment Share on other sites More sharing options...
fg109 Posted May 18, 2012 Share Posted May 18, 2012 For the second question, it's really up to you. One NPC can fill multiple reference aliases. Using a new alias would enure that the script is only in effect during the duel, but you would need to beware of any conflicts between both aliases. Link to comment Share on other sites More sharing options...
gasti89 Posted May 20, 2012 Author Share Posted May 20, 2012 (edited) Uhm, when i try to compile the quest stage fragment i get this Starting 1 compile threads for 1 files... Compiling "QF_HVATrialOfCourage_02021156"... c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_HVATrialOfCourage_02021156.psc(77,6): StartCombat is not a function or does not exist No output generated for QF_HVATrialOfCourage_02021156, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on QF_HVATrialOfCourage_02021156 EDIT: It worked! I just changed the StartCombat() part. Pointing to a "Actor" property instead of the Alias one. Thanks so much fg! ;) Edited May 21, 2012 by gasti89 Link to comment Share on other sites More sharing options...
Recommended Posts