dudeapocalypse Posted June 28, 2020 Share Posted June 28, 2020 I wrote a script on the auto-inject stimpack basis for the custom ingestible to be automatically used and play some sounds when health drops to certain percent. It works great, here it is: scn BloodPotionQuestSCRIPTBEGIN GameMode If ( Player.GetHealthPercentage < 0.35 ) && (Player.IsInCombat == 1) && ( Player.HasMagicEffect RestoreHealth == 0) If ( Player.GetItemCount BloodPotion > 0 ) ShowMessage BloodPotionUsedMSG; PlaySound NPCHumanUsingBloodPotion Player.CastImmediateOnSelf BloodPotion Player.RemoveItem BloodPotion 1 EndIf EndifEND What I want now, is to make the sounds vary depending on the player's gender (female's would be deranged laugh from Violet's cut dialogue, male's would be just some power attack roar).I wrote this, but it doesn't want to save: scn BloodPotionGenderDependantQuestSCRIPTBEGIN GameMode If ( Player.GetHealthPercentage < 0.35 ) && (Player.IsInCombat == 1) && ( Player.HasMagicEffect RestoreHealth == 0) && ( Player.GetIsSex Male == 1 ) If ( Player.GetItemCount BloodPotion > 0 ShowMessage BloodPotionUsedMSG; PlaySound NPCHumanUsingBloodPotionMALE Player.CastImmediateOnSelf BloodPotion Player.RemoveItem BloodPotion 1 ELSEIF ( Player.GetHealthPercentage < 0.35 ) && (Player.IsInCombat == 1) && ( Player.HasMagicEffect RestoreHealth == 0) && ( Player.GetIsSex Female == 1 ) If ( Player.GetItemCount BloodPotion > 0 ) ShowMessage BloodPotionUsedMSG; PlaySound NPCHumanUsingBloodPotionFEMALE Player.CastImmediateOnSelf BloodPotion Player.RemoveItem BloodPotion 1 Endif EndifEND Any ideas what I did wrong here? Pls explain like to a first grader, I'm not experienced in scripting at all. Link to comment Share on other sites More sharing options...
IntenseMute Posted June 28, 2020 Share Posted June 28, 2020 It seems like you forgot to place an "EndIf", it should be above the "ELSEIF" Also you can shorten your script slightly, take a look: scn BloodPotionGenderDependantQuestSCRIPT BEGIN GameMode If ( Player.GetHealthPercentage < 0.35 ) && (Player.IsInCombat == 1) && ( Player.HasMagicEffect RestoreHealth == 0) If ( Player.GetItemCount BloodPotion > 0 ShowMessage BloodPotionUsedMSG; If Player.GetIsSex Male == 1 PlaySound NPCHumanUsingBloodPotionMALE Elseif Player.GetIsSex Female == 1 PlaySound NPCHumanUsingBloodPotionFEMALE Endif Player.CastImmediateOnSelf BloodPotion Player.RemoveItem BloodPotion 1 Endif END Link to comment Share on other sites More sharing options...
dudeapocalypse Posted July 1, 2020 Author Share Posted July 1, 2020 (edited) It seems like you forgot to place an "EndIf", it should be above the "ELSEIF" Also you can shorten your script slightly, take a look: scn BloodPotionGenderDependantQuestSCRIPT BEGIN GameMode If ( Player.GetHealthPercentage < 0.35 ) && (Player.IsInCombat == 1) && ( Player.HasMagicEffect RestoreHealth == 0) If ( Player.GetItemCount BloodPotion > 0 ShowMessage BloodPotionUsedMSG; If Player.GetIsSex Male == 1 PlaySound NPCHumanUsingBloodPotionMALE Elseif Player.GetIsSex Female == 1 PlaySound NPCHumanUsingBloodPotionFEMALE Endif Player.CastImmediateOnSelf BloodPotion Player.RemoveItem BloodPotion 1 Endif END Thanks man, that totally helped. At first it didn't work, but I took a closer look at it, and discovered that now *you* forgot one Endif at the end :smile: So the working script is: scn BloodPotionQuestSCRIPT BEGIN GameMode If ( Player.GetHealthPercentage < 0.35 ) && (Player.IsInCombat == 1) && ( Player.HasMagicEffect RestoreHealth == 0) If ( Player.GetItemCount BloodPotion > 0 ) ShowMessage BloodPotionUsedMSG; If Player.GetIsSex Male == 1 PlaySound NPCHumanUsingBloodPotionMALE Elseif Player.GetIsSex Female == 1 PlaySound NPCHumanUsingBloodPotionFEMALE Endif Player.CastImmediateOnSelf BloodPotion Player.RemoveItem BloodPotion 1 EndifEndifEND Edited July 1, 2020 by dudeapocalypse Link to comment Share on other sites More sharing options...
IntenseMute Posted July 1, 2020 Share Posted July 1, 2020 Wow, doing the same mistake that I was correcting, I'm an idiot :wallbash:. I'm glad it didn't just confuse you more. Link to comment Share on other sites More sharing options...
Recommended Posts