Jump to content

Vylssius

Premium Member
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Vylssius

  1. 1. Create a Global Variable. Name: MyMod_MedicineActive. Value: 0. Constant = false. 2. Create a Quest. Name: MyModQuest. Click on Scripts tab. Add new script. Name: MyQuestScript. Namescape: MyModFolder. Here's the script: Scriptname MyModFolder:MyQuestScript extends Quest Const GlobalVariable Property MyMod_MedicineActive Auto Const float Property MedicineEffectTime = 0.5 Auto Const ;Medicine effect time. 0.5 == 30 ingame minutes. Function MedicineON() ;Called by the magic effect script. See point 7. MyMod_MedicineActive.SetValueInt(1) ;This global variable is used as a condition in the onCombatStateChange event. See point 8. StartTimerGameTime(MedicineEffectTime, 555) ;Medicine effect timer starts. 555 is the timer ID. EndFunction Event OnTimerGameTime(int aiTimerID) ;This event fires when the timer expires. If aiTimerID == 555 MyMod_MedicineActive.SetValueInt(0) ;Sets the global variable back to 0. EndIf EndEvent 3. Compile the script, then open its Properties. Click on "Auto-Fill all" to fill the properties with the FormIDs. 4. Create a Potion item. Data: Food item = true, leave everything else blank / none. 5. Create a Magic Effect. Name: MyModEffect. Data: No Area = true, Painless = true, No Hit Effect = true, Effect Archetype: Script, Casting Type: Fire and Forget, Delivery: Self, leave everything else blank / none. 6. Open your potion item. To add new effect: right click, then "New". You should see the "Effect Item" window now. Choose your magic effect (MyModEffect) from the dropdown menu. 7. Open your magic effect. Add new script. Name: MyMagicEffectScript. Namescape: MyModFolder. Const = true, leave everything else unchecked. Open the script. Here's the code: Scriptname MyModFolder:MyMagicEffectScript extends activemagiceffect Const GlobalVariable Property MyMod_MedicineActive Auto Const Quest Property MyModQuest Auto Const Event OnEffectStart(Actor akTarget, Actor akCaster) (MyModQuest as MyModFolder:MyQuestScript).MedicineON() ;When you take the medicine, the effect starts. When the effect starts, the magic effect script calls the function "MedicineON()" that's been defined in the quest script. EndEvent 8. Modify the Reference Alias script that I made earlier: Scriptname YOURSCRIPTNAME extends ReferenceAlias Const GlobalVariable Property MyMod_MedicineActive Auto Const Event OnCombatStateChanged(Actor akTarget, int aeCombatState) ;***aeCombatState values: 0: not in combat. 1: in combat. 2: searching. If MyMod_MedicineActive.GetValueInt() == 1 If aeCombatState == 0 Debug.Notification("I am no longer in combat.") ElseIf aeCombatState == 1 Debug.Notification("I am in combat.") EndIf ElseIf MyMod_MedicineActive.GetValueInt() == 0 ;*** medicine effect is inactive. You can put additional functions here. EndIf EndEvent 9. Don't forget to fill the script Property. very detailed and helpful response again, thank you for the help! :)
  2. So doing what was recommended by LarannKiar seemed to work, the only problem I am having now is what do I do if i want that quest with the script to only affect the player after they use a specific item i.e. a medicine?
  3. That looks awesome! Thank you for your reply, I'll give that a try when I get some free time! I thought about using a quest, but I wasn't sure how it all worked because I'm still trying to get the hang of the ck lol But I really appreciate your reply!
  4. That is some very useful information! Thank you for clarifying, I wish this information was more widely available, seems like a lot of information around papyrus is a secret lol I wish I knew people who were into this stuff so I wouldn't have to make so many forum posts when I need help, but I am not very good at making friends :/
  5. Hello, I was looking to get some help with the OnCombatStateChanged function for a mod I'm working on. Currently my setup is potion>Magic Effect>Script It all compiles the way it should, but when I actually get into combat the rest of my code doesn't execute. I wouldn't be surprised if I am simply overlooking something, but I am still really new to modding on Fallout 4 so I would appreciate the help! Thank you in advance for the help :)
  6. Ohhh! That makes so much sense now! I'm so upset that flew over my head. Thank you for the explanation DieFeM!
  7. Yeah I have that (Container Property ContainerName Auto Const) Or do you mean something else?
  8. If you want to open the container then use activate on the container. I have that, under the event OnEffectStart i have the line ContainerName.Activate(game.GetPlayer(), true) but im still getting the error :/
  9. I'm pretty new to modding and all that so I'm sorry if I am overlooking something blatantly obvious. I am trying to make a mod where you have an aid item, and when you use it, it will open a container to store things in. I have a script on a magic effect that is using the activate function on the player to open the container. Problem is I keep getting the error (Activate is not a function or does not exist) I have tried a lot of things to fix this, but it seems like all the documentation I have found is incredibly vague. I assume I'm overlooking or missing something but I haven't been able to find anything on it. As far as the official creation kit wiki is concerned, I am using it exactly how it is meant to be used... so I don't understand why it isn't working. Thank you in advance for your help! [sOLVED] Well I kind of feel stupid but at least I learned something. For anyone else who might be having the same problem, you have to define your container as an ObjectReference instead of Container, because activate works on objectreference. ObjectReference Property ContainerName auto const NOT Container Property ContainerName auto const even though its a container you are activating...
×
×
  • Create New...