caramellcube Posted May 3, 2012 Share Posted May 3, 2012 The mod I'm working on at the moment relies heavily on this script but it keeps causing a CTD. It's the base effect for an ingestible chem, but there's a quest script that uses CastImmediateOnSelf to give the player 1 dose of that chem if their rad count gets too high. If I select it in the pipboy, it works fine, as long as the code is in the ScriptEffectStart block which runs with the pipboy up. If the same code is in ScriptEffectFinish, or if it gets called by the quest script, it CTDs. There is 1 exception I've found though, if the player has the Organ Failure 'perk' then it runs as normal even with the pipboy down. I think it has something to do with either the AddPerk commands, or the random variable used, but I have no idea what causes this. Any suggestions?(BTW, the script isn't complete yet, that's why there are a few blank spaces for extra routines to go into) scn CaCuMuScriptBefMutagen short CaCuCount Begin ScriptEffectStart Set CaCuCount to GetRandomPercent IMOD MS04InjectISFX If HasPerk CaCuMuPerkOrganFail DamageAV Health 1000 elseif (GameDaysPassed - CaCuMuVarDay) < 1 If HasPerk CaCuMuPerkXeroderma==0 AddPerk CaCuMuPerkXeroderma ShowMessage CaCuMuMsgXero else AddPerk CaCuMuPerkOrganFail ShowMessage CaCuMuMsgOrganFail endif elseif IsSpellTarget MS05NukalurkMeat If HasPerk CaCuMuPerkAmphib==0 AddPerk CaCuMuPerkAmphib ShowMessage CaCuMuMsgAmphib elseif HasPerk CaCuMuPerkRadBurst==0 AddPerk CaCuMuPerkRadBurst ShowMessage CaCuMuMsgRadBurst else AddPerk CaCuMuPerkAllergyJet ShowMessage CaCuMuMsgAllergyJet endif elseif CaCuCount < 10 If HasPerk CaCuMuPerkShapeshift==0 SexChange ShowMessage CaCuMuMsgGender else AddPerk CaCuMuPerkAllergyMedX ShowMessage CaCuMuMsgAllergyMedX endif elseif CaCuCount < 20 If HasPerk CaCuMuPerkShapeshift==0 AddPerk CaCuMuPerkShapeshift ShowMessage CaCuMuMsgShapeshift elseif HasPerk CaCuMuPerkRadBurst==0 AddPerk CaCuMuPerkRadBurst ShowMessage CaCuMuMsgRadBurst elseif HasPerk CaCuMuPerkGas==0 AddPerk CaCuMuPerkGas ShowMessage CaCuMuMsgGas endif elseif CaCuCount < 30 If HasPerk CaCuMuPerkGas==0 AddPerk CaCuMuPerkGas ShowMessage CaCuMuMsgGas else AddPerk CaCuMuPerkAllergyJet ShowMessage CaCuMuMsgAllergyJet endif elseif CaCuCount < 40 If HasPerk MS04StrengthPerk==0 AddPerk MS04StrengthPerk ShowMessage MS04AntMightMessage elseif HasPerk MS04PerceptionPerk==0 AddPerk MS04PerceptionPerk ShowMessage MS04AntSightMessage elseif HasPerk CaCuMuPerkAllergyJet==0 AddPerk CaCuMuPerkAllergyJet ShowMessage CaCuMuMsgAllergyJet endif elseif CaCuCount < 50 If HasPerk CaCuMuPerkBioShock==0 AddPerk CaCuMuPerkBioShock ShowMessage CaCuMuMsgBioShock endif elseif CaCuCount < 60 If HasPerk CaCuMuPerkAmphib==0 AddPerk CaCuMuPerkAmphib ShowMessage CaCuMuMsgAmphib endif elseif CaCuCount < 70 If HasPerk CaCuMuPerkGas==0 AddPerk CaCuMuPerkGas ShowMessage CaCuMuMsgGas endif elseif CaCuCount < 80 If HasPerk CaCuMuPerkRadBurst==0 AddPerk CaCuMuPerkRadBurst ShowMessage CaCuMuMsgRadBurst endif elseif CaCuCount < 90 else endif Set CaCuMuVarDay to GameDaysPassed End Link to comment Share on other sites More sharing options...
caramellcube Posted May 4, 2012 Author Share Posted May 4, 2012 I still don't know what was causing this to happen, but if anyone else gets the same problem in the future and finds this page, there seems to be a solution.I moved the script to a quest, changed all the HasPerk, AddPerk and other commands that need a reference to Player.HasPerk Player.AddPerk and so on, and now it seems to work fine. Just adding the Player reference to the ingestible wasn't enough, it didn't work properly until it was moved to the quest script. Link to comment Share on other sites More sharing options...
prensa Posted May 5, 2012 Share Posted May 5, 2012 caramellcube - Hello! Thanks for coming back & saying how you resolved the issue, it may help others. I'm pretty new to scripting myself. A few script things seem to work slightly differently to how you might expect. :) Prensa Link to comment Share on other sites More sharing options...
Recommended Posts