Jump to content

vkz89q

Members
  • Posts

    203
  • Joined

  • Last visited

Everything posted by vkz89q

  1. It will work with just kmyQuest.Test(-5) so yes, you can just add negative value. If the value is 0 and you do that, it will be -5. If the value was 10, it will be 5 after that. You get the idea. But if you need more functions you can always make more. It's pretty handy to call them from fragments. Once you get familiar with properties and couple scripts, soon you can make lots of cool stuff :smile: Oh, and also when you are testing your mod ingame, you can do this console command "help xxx 3" and it will list all globals(that have xxx on their name) and you can see if it changes.
  2. The name should not matter at all actually(unless it's something the CK wont let you use for some reason). It could be "GlobalVariable Property xDLOL Auto".. which global it affects depends on this: Go to your quest -> Scripts, you see your script name, click on it, press Properties and then you just click on the property, select object "YourGlobalName" from the list and that is the global it's gonna change. Press OK to finish. Now, for your function to work, you can go to stage or dialogue, anything with Fragment. Then: 1. see kmyQuest -> select the script you just made, and in the fragment write: kmyQuest.Test() and it will do that function for you when the fragment is run. It can be in dialogue or quest stage. Now, if you want to make your function better, do this: Scriptname JustTestingDeleteLater extends Quest GlobalVariable Property KimberlyGlobal Auto Function Test(float fNumberToSet) KimberlyGlobal.SetValue(fNumberToSet) EndFunction then, in the fragment you can do: kmyQuest.Test(10) and it will set the global to 10. Or, if you want to add to that number you can do this: Scriptname JustTestingDeleteLater extends Quest GlobalVariable Property KimberlyGlobal Auto Function Test(float fNumberToSet) KimberlyGlobal.SetValue(KimberlyGlobal.GetValue()+ fNumberToSet) EndFunction Then, in fragment when you do: kmyQuest.Test(2) it will add 2 to the total number. Hope this helps.
  3. Hmm, so does your script compile if you do this? Scriptname JustTestingDeleteLater extends Quest GlobalVariable Property KimberlyGlobal Auto if you try do this it won't compile: Scriptname JustTestingDeleteLater extends Quest GlobalVariable Property KimberlyGlobal Auto KimberlyGlobal.SetValue(1) because the script doesn't know when to do that SetValue. Instead you need to have event or function to do it and call that function from somewhere(or have event fire), for example: Scriptname JustTestingDeleteLater extends Quest GlobalVariable Property KimberlyGlobal Auto Event OnStageSet(int auiStageID, int auiItemID) ;int auiStageId is the stage that was set if(auiStageID == 50) ; if its stage 50 lets set global KimberlyGlobal.SetValue(1) Debug.Notification("stage 50, setting global!") endIf endEvent But first, does the first example work on you? It compiles if you copy all but NOT the script name line to your script, that you made in ck using Add -> [new script]? (in your quest window).
  4. Yes, you can do this for example: GlobalTest.SetValue(someRandomFloat / 2 + 4 * 8 - 14 + GlobalTest.GetValue()) GlobalVariable Property GlobalTest Auto Const float someRandomFloat or you can just do: GlobalTest.SetValue(GlobalTest.GetValue() + 1) or you can do: float tempFloat = GlobalTest.GetValue() tempfloat = tempFloat + 100 ; or do more stuff here GlobalTest.SetValue(tempfloat) You need to post your whole script you have problems with. Just post your script you are trying to do :smile:
  5. Okay, I got this one to work: (it's on quest, but should work on other places too). Look at the If statements and WornHasKeyword. Scriptname EnterExitPAScript extends Quest Event OnInit() RegisterForRemoteEvent(PlayerRef, "OnSit") EndEvent Event Actor.OnSit(Actor theActor, ObjectReference akFurniture) Utility.Wait(0.05) if(akFurniture.HasKeyword(FurnitureTypePowerArmor) && theActor.WornHasKeyword(isPowerArmorFrame)) ; Enter PA Debug.Notification("entered a PA") Debug.Trace("enter PA") elseif(akFurniture.HasKeyword(FurnitureTypePowerArmor) && !theActor.WornHasKeyword(isPowerArmorFrame)) ; Exit PA Debug.Notification("we exited pa lol") Debug.Trace("exit PA") endIf EndEvent Actor Property PlayerRef Auto Const Keyword Property IsPowerArmorFrame Auto Const Keyword Property FurnitureTypePowerArmor Auto Const For some reason debug.notification gets out of synch, but debug.trace shows it works.. I enter/exited 10 different PA's and all fired both events. Use at your own risk, no idea if it works 100% of the time. OnSit() seems to fire when you enter or exit PA. With WornHasKeyword we can check if we have PA or not after we fired "OnSit".
  6. I'm just guessing here but OnGetUp is an actor event? Again, I'm guessing here but maybe you can do this: Event OnInit() RegisterForRemoteEvent(PlayerRef, "OnGetUp") EndEvent Event Actor.OnGetUp(Actor theActor, ObjectReference akFurniture) if(akFurniture.HasKeyword(PA_check)) ;do stuff endIf EndEvent Actor Property PlayerRef Auto Const I have not tried it, so if you try it, please report back. I have only done similiar things with quest stages. Edit: Seems to work but only when you enter PA, not when you exit it.
  7. Funny, I just tested your file and added your script to ref alias collection, did same state change you did and all works perfectly :D Glad it worked out!
  8. Hmmh, I have only used ref collection with actors. I have a script where I need to do something when actor from collection dies.. and this is how I "identify" which one is it: Event OnDying(ObjectReference AkSenderRef, Actor akKiller) int index = Self.Find(akSenderRef) Actor tempActor = Self.GetAt(index) as Actor ;do stuff to tempActor endEvent Self <- means the whole alias collection in this case so it finds the akSenderRef from the collection. So yes, you are correct that the only reason to use ref collection is to make it easier if you have lot of aliases. But maybe it's not good in this case.. but reading https://www.creationkit.com/fallout4/index.php?title=RefCollectionAlias_Script , I can see it should work same way with OnActivate. I guess there might be something wrong with your script? Maybe you could post just the script in code tag? I don't have experience with workshops, so I can't propably help more than this.. but maybe someone else can.
  9. Change the name. Can't use "MyGlobal", thats what it's telling you. You can also change global in fragment if you don't want to make new script for it. This can be in dialogue or in stage. (and Yes, they can be fired multiple times with setStage even when current stage doesn't change). You can just do: mahGlobal.SetValue(1) and make property named mahGlobal first.
  10. When are you starting your quest? That's when the alias is filled. If it's start game enabled and workbench isn't in loaded area, it will be none. You can do ref collection alias with only one condition: GetIsID WorkShopWorkBench. Then do SQV your quest in console and you see all workbenches in your alias(should be 28 in vanilla game?). If something is missing, you might need additional aliases/conditions for some workbenches. Or you can just use those form lists you made. You can put max initial count high as you want, it will fill up to that point. You can put 50 and the game finds 28, it will not fail because of that. Just don't do Allow Reuse in quest or you can get same workbench several times. I actually just tested it, and with only GetIsID WorkSHopWorkBench, max initial count 50, nothing ticked in settings, and it lists 28 ref aliases in the collection.
  11. I just tested it. Quest with 3 stages, 10, 20 and 30. Each with debug message. I tested with both papyrus setting stages and console commands. First test: no allow repeated stages ticked in ck. I went to stage 30. Debug message plays. I do SQV quest to see current stage: 30. I setstage to 20. Debug message plays. SQV shows current stage 30. I setstage to 10. Debug message plays. SQV shows current stage 30. I setstage 30. Debug message does NOT play, because allow repeated stages is not selected. Current stage still 30. Test 2: Same but with allow repeated stages. Everytime I do setstage, debug message plays but current stage is always 30. So, you can go back with stages. It will fire fragments and mark the stage as done, if you do IsStageDone or GetStageDone. But the current stage is always the highest stage quest has ever been. So, if you want to use stages for conditions, you should always use IsStageDone or GetStageDone, and it works "perfectly".
  12. Try getstagedone instead of getstage. Also is your greeting/hello starting scene(press the greeting and Start scene setting should be there)?
  13. You can also do it with cloak spell that aims concentrated spell like: https://www.creationkit.com/index.php?title=Dynamically_Attaching_Scripts But be careful, you don't want to stack it 10000 times on same npc's.
  14. Uhh, seems like I learn something new everyday. Yes, seems like quest stage can't go lower no matter what. It will still run the fragment tho, that's why I never noticed lol. And thats why vanilla companion quests use globals(or actor values) to see what dialogue to run(like hatred/love etc). For example, it will still run the Pickup companion fragment in stage 80 if you set it from stage 90, but quest stage remains in 90. Only way to go back is to run Reset(), but it resets aliases too.
  15. Okay, I tried: Scriptname LightTestThing extends ReferenceAlias actor playerref Event OnInit() PlayerRef= Game.GetPlayer() RegisterforAnimationEvent(playerref,"pipboyLightOn") RegisterforAnimationEvent(playerref,"pipboyLightOff") EndEvent Event OnAnimationEvent(ObjectReference akSource, string asEventName) if(asEventName=="pipboyLightOn") Debug.Notification("Light on") Debug.Trace("Light on") elseIf(asEventName=="pipboyLightOff") Debug.Notification("Light off") Debug.Trace("Light off") endif EndEvent It works... but not when light is turned off or on.. only when you close/open whole pipboy :pinch: (going to menu)
  16. Are you testing on a save that is done before your mod was installed? Quests might be tricky if testing on "old" save. Also, check that any dialogue isn't setting stages where you don't want it.. tho that doesn't make much sense if it doesn't work even on SetStage command. Other than that.. hmmh, double check you are trying to set stage on right quest and no script is resetting it for some reason. I'm working on a companion mod too and using same function FollowersScript.GetScript().SetCompanion(xxx.GetActorReference()), and everything works here so thats pretty much all ideas I have. Also try checking vanilla companion quests if you can see anything there you are missing.
  17. Thanks for the ideas guys. The mod idea here is simple: Make sneaking during night VERY HARD when flashlight is on. It makes perfect sense, right? F4SE actually has functions to detect keypresses.. but I can see one problem already. When you enter door to new area(loading screen), flashlight turns off and somehow would need to catch that too. I tried to search if there is already mod that does what I want, but I can't find anything, which makes me wonder that it's not that easy to detect :confused: If anyone knows the "secret" and doesn't want to share it, please, make a mod that makes sneaking with flashlight hard :smile: I will keep trying things you guys suggested later today.
  18. Are you setting stages when your quest goes on and then have conditions in your scenes to select which one to play?
  19. I had same problem earlier. How to fix it is simple: verify game files and uninstall all mods and loose files. Not all old mods work nice with newest patch. There is some kind of conflict, I don't know what, but when you edit your own mod and it conflicts with some old mod, whole game refuses to launch. Atleast thats my experience. If you added new dialogue, then some other mods STRING files etc can be why it refuses to launch.
  20. It's propably for game performance. Why say it and run processing power when player is out of range 99% times anyway. You can do it for scenes with "prevent player exit dialogue" and/or dialogue distane override, but for topics like idles? Propably not unless there is some global setting to that distance. And even then, the sound disappears very fast and you only see subtitles if you force them on(could work with global setting). Only thing I can think of is to check GameSettings in ck. There is one named: "fAIDialogueDistance", try adjust that, maybe it works. If it doesn't work, try filtering "dialogue" in game settings window and play with other variables.
  21. Maybe there is better way than having 2 factions, where other is friendly to player and another enemy.. but this is how I do it, in quest scene I set stage at end and do this in quest stage: Actor aOurNpc = (OurNpcRef.GetReference() As Actor) Actor aPlayer = Game.GetPlayer() aOurNpc.RemoveFromFaction(FriendlyFaction) aOurNpc.AddToFaction(EnemyFaction) aOurNpc.StartCombat(aPlayer) You can propably just remove player from the faction or make player enemy in the faction instead of having 2 factions, but I'm now too lazy to check that since this works.
  22. So, I'm trying to detect when player has flashlight on. So far I have tried these things: - Attach script to DefaultPipboyLight Light, Creation kit wiki says they should extend ObjectReference script. I can't get any event, not even oninit to fire from it. Testing on new game so that doesn't work or I'm doing something horribly wrong. - Tried to give player simple perk with 100x damage just to see if I can get any condition to fire when light is on.. According to default object windown in ck, light equip slot is LeftHand, but I tried everything related to equip slot and none reacts to flashlight at all. Also tried everything related to torch and bibed slot etc.. nothing works. - Also tried giving DefaultPipBoyLight keyword and check with conditions wornhaskeyword etc etc, on a new game but nothing works. - I got one condition that kinda works. GetLightLevel. When pipboy flashlight is off, in dark areas lightlevel is like 10-20 and with pipboy light on it's always 75. BUT, this does NOT work for power armor helmet light or mining helm because the light does not hit player :sleep: Also, it can't detect if you are sitting in light turrets light or have pip boy light hitting you. It would be GOOD enough if it worked with other flashlights than pipboy too. I thought this would be simple.. after all you get sound, hud icon and light when you turn that light on. Still I can't find a way to detect it. Any ideas where to look next, I'm running out of ideas? I tried to look F4SE functions too but didn't find anything helpful. This is the script I tried on defaultpipboylight and it even compiles: Scriptname defaultPipboyLightScripttest extends ObjectReference Event OnActivate(ObjectReference akActionRef) Debug.Notification("Light on1") endEvent Event OnEquipped(Actor akActor) Debug.Notification("Light on2") endEvent Event OnOpen(ObjectReference akActionRef) Debug.Notification("Light on3") endEvent Event OnClose(ObjectReference akActionRef) Debug.Notification("Light on4") EndEvent Event OnGrab() Debug.Notification("Light on5") EndEvent Event OnLockStateChanged() Debug.Notification("Light on6") endEvent Event OnRelease() Debug.Notification("Light on7") EndEvent Event OnUnequipped(Actor akActor) Debug.Notification("Light on8") EndEvent Event OnInit() Debug.Notification("Light") RegisterForDetectionLOSGain(Game.GetPlayer(), self) EndEvent Event OnGainLOS(ObjectReference akViewer, ObjectReference akTarget) Debug.Notification("liiiiiiiiiight") EndEvent
  23. No, there seems to not be this function for perks that would do something like: Take % of base value and add it. Like, you want to add extra 10% damage, there is no add 0.1 multi or something like that. You need to multiply and thats how all vanilla perks are done too.
×
×
  • Create New...