ArgusSCCT Posted June 21, 2014 Posted June 21, 2014 It depends by what they are doing. A GameMode can't be replaced, if it really needs some action is continuously running. But a GameMode can be staged, the best deal would be sticking with the same script, attached to the item, but delaying it with a timer like Odessa wrote some posts ago. If they apply debuff it could be done by a spell which is very reliable for that, but putting some other specific script in a ScriptEffectUpdate wouldn't make sense since you would be in the same exact situation as in the current script. I saw a part of the script was changing the hud, so that part can stick on a Quest Script (delay 0.1 is fine for huds) and OnEquip you only trigger some variable value that activate the Quest Script Block. It all depends by all the functions your armors' scripts execute. Well one of them works by checking if the player has lost health, so it can then apply a stimpak, it is always checking. Another is a proximity detector, which alerts the player if there are enemies nearby and there's another that adds a pulse charge to power armor, which the player can use by pressing a key. I guess the smart thing to do when rewriting them, is to check if the player is using Power Armor, make a single script for that, and depending on what that says, allow or disallow those scripts to execute. Especially, since it seems to me, that there is nothing stopping those scripts from running even if the player might not be using PA, and while it does not run the whole block, I think it runs part of it. Best if it just stops, if there's no power armor.
Guest Posted June 21, 2014 Posted June 21, 2014 well that could be staged in two separated blocks inside the armor itself. OnEquip let switch := 1 OnGameMode if switch docode But I guess all the three functions you wrote up there can be staged inside a Quest Script timed on 0.1 delay, now that's a matter of choice but I personally wouldn't see a faster response time really necessary for that. Anyway if when you test ingame you find you want more "speed", you can still drop the Quest Delay Time. You can also tweak the Quest Delay Time in game concerning events happening (if you use many Returns as me, but yeah that's very much specific by the rest of the code) I would start the quest OnEquip, on GameMode if I want more reliability Armor script: Begin OnEquip let switch := 1 End Begin GameMode if switch ;some code that must stay inside the armor's script if GetQuestRunning MyArmorQuest Return else StartQuest MyArmorQuest endif end
ArgusSCCT Posted June 21, 2014 Posted June 21, 2014 Seems like a sound idea. I'll make an OnEquip script that sets a boolean if the player is using Power Armor. Depending on if it is true or not, then those mod scripts will execute. That saves me from having to write that every time on each individual script, or at least from writing a few lines. EDIT: Don't suppose there's a way to use OnEquip dynamically? I need this to work for every power armor. Otherwise I'll have to find another way to do this, hopefully without GameMode.
Guest tomm434 Posted June 21, 2014 Posted June 21, 2014 Seems like a sound idea. I'll make an OnEquip script that sets a boolean if the player is using Power Armor. Depending on if it is true or not, then those mod scripts will execute. That saves me from having to write that every time on each individual script, or at least from writing a few lines. EDIT: Don't suppose there's a way to use OnEquip dynamically? I need this to work for every power armor. Otherwise I'll have to find another way to do this, hopefully without GameMode. On equip works only on object script. You can do a quest which checks Ref itemRef begin gamemode set ItemRef to GetEquippedObject 2 ; 2 goes for Upper body if itemref.getinlist YourPowerAmorList If getquestrunning PAQUest return else startquest PAQUest endif else If getquestrunning PAQUest stopquest PAQUest endif return endif end
ArgusSCCT Posted June 21, 2014 Posted June 21, 2014 Already did something like that for another script before, instead of a list I just used IsPowerArmor, so that it works with other power armors that are not within the mod. I guess this could do: ref itemRef Begin GameMode Let itemRef := GetEquippedObject 2 If Eval(IsPowerArmor ItemRef) StartQuest PAQuest Else StopQuest PAQuest ;----------------------Now for the mod script I'd do something like this Begin GameMode If Eval(GetQuestRunning PAQuest == 1) ;Do Stuff Otherwise if the quest isn't running at all, then it should not do anything past that conditional. Though it is a good idea to check if it is running to stop it from advancing any further.
Guest tomm434 Posted June 21, 2014 Posted June 21, 2014 Begin GameMode If Eval(GetQuestRunning PAQuest == 1) ;Do Stuff Why would you check if quest running inside quest script gameblock?
ArgusSCCT Posted June 21, 2014 Posted June 21, 2014 To check if the next part should be executed at all. The Power Armor mods each have their own scripts, if I understood correctly the point of creating a PAQuest is to have something to check if the person is wearing power armor or not. scn PPAPowerArmorChecker ref rContainer ref refItem int bQuestInit Begin GameMode Let rContainer := GetContainer Let bQuestInit := GetQuestRunning PAQuest Let refItem := rContainer.GetEquippedObject 2 If Eval (IsFormValid rContainer && IsActor rContainer) If Eval (bQuestInit == 1 && refItem IsPowerArmor == 1) return ElseIf Eval (bQuestInit == 0 && refItem IsPowerArmor == 1) StarQuest PAQuest ElseIf Eval (bQuestInit == 1 && refItem IsPowerArmor == 0) StopQuest PAQuest EndIf EndIf End Anyway this is what I will use to detect if power armor is being worn. If power armor is being used, it starts that quest, and if that quest is running then the appropriate Power Armor mod scripts, that detect it will run as well. Although I'd prefer to use something other than a quest to get things started, maybe a variable, but I don't know if you can use variables between scripts.
Guest tomm434 Posted June 21, 2014 Posted June 21, 2014 You can use variable and even references between scripts. You can set any "int" variable from anywhere. When it comes to references, first you need to set them. You can do it from anywhere. ie. QuestA script ref PowerAmor -------------------------------------- Quest B gamemode block ref ArmorPower begin gamemode set ArmorPower to QuestA.PowerArmor player.removeitem ArmorPower 1 end --------------------------------- OR ---------------------------- Quest B gamemode block begin gamemode set QuestA.PowerArmor to player.GetEquippeditem 2 end ------------------------- and QuestA.PowerArmor will be what you told her to be ps. Yes, that's the right idea - that way you won't be editing any PowerArmor object script which is good in terms of compability.
prideslayer Posted June 21, 2014 Posted June 21, 2014 Already did something like that for another script before, instead of a list I just used IsPowerArmor, so that it works with other power armors that are not within the mod. I guess this could do: ref itemRef Begin GameMode Let itemRef := GetEquippedObject 2 If Eval(IsPowerArmor ItemRef) StartQuest PAQuest Else StopQuest PAQuest Otherwise if the quest isn't running at all, then it should not do anything past that conditional. Though it is a good idea to check if it is running to stop it from advancing any further. That won't work as expected. Calling StartQuest on a quest that's already running will reset all the quest vars -- and you'll be calling that every frame. Let itemRef := GetEquippedObject 2 If Eval(IsPowerArmor ItemRef) if (0 == GetQuestRunning PAQuest) StartQuest PAQuest endif Else if (1 == GetQuestRunning PAQuest) StopQuest PAQuest endif endif
Guest tomm434 Posted June 21, 2014 Posted June 21, 2014 That won't work as expected. Calling StartQuest on a quest that's already running will reset all the quest vars -- and you'll be calling that every frame. you sure? I just tried it and vars didn't reset. What do you mean by that? QuestVars2.rar
ArgusSCCT Posted June 21, 2014 Posted June 21, 2014 Thanks for the help, I think the smart thing to do with all those Power Armor Mod scripts, would be to tie them all to the script that checks if Power Armor is being worn, that way if it isn't being worn a large part of the mod will be shut down, something which I believe the old mod did not handle correctly. I think the hard part is rewriting the PA mod scripts, not sure how I'll do that, and I'm not really quite sure how to work with the ones that use HUD elements. Same goes for creating an MCM, when I get to that part.
prideslayer Posted June 21, 2014 Posted June 21, 2014 Well, it's what the wiki says, not always the most reliable source. In any case I still would avoid calling it every frame.
Guest tomm434 Posted June 21, 2014 Posted June 21, 2014 Well, it's what the wiki says, not always the most reliable source. In any case I still would avoid calling it every frame. After your post I read wiki and it says that variables reset on game reload (exit\start) - still false, they don't. I spent 6.5 minutes of my life on this crap. Big thanks goes to Scruggs because he assumed that glitch comes from Oblivion. from discussion page. When the game is reloaded is what I meant. I have not checked to see if the issue has carried over from Oblivion to Fallout 3 but I expect it has. Scruggs
Guest Posted June 21, 2014 Posted June 21, 2014 naaa, no way tom. if it was so, everytime you make a timer it would reset. Think for example to these quests that trigger after some days, does it mean we should play x days continuously because if not everytime we reload the timer resets?
Halstrom Posted June 22, 2014 Author Posted June 22, 2014 And if you are completely rewriting it, perhaps you can consider the mod working for NPC's or Companions wearing the armor too.
Guest tomm434 Posted June 22, 2014 Posted June 22, 2014 naaa, no way tom. if it was so, everytime you make a timer it would reset. Think for example to these quests that trigger after some days, does it mean we should play x days continuously because if not everytime we reload the timer resets? He said about casting "startquest" on already running quest. Do you do that often with timer quests, A.J?
Guest Posted June 22, 2014 Posted June 22, 2014 No, with my way to script behaviours only when conditions are true (if GetQuestRunning - Else StartQuest) it's pretty hard that cases like these should happen. Still, I can't foresee if some glitch happens in some specific circumstance...
nyaalich Posted June 22, 2014 Posted June 22, 2014 Marp. Is it too early? What am I missing? Line 7: Missing Parameter Reference Rechecked spelling. At a loss. scn SexoutBangFXNCheckForValidRefSCRIPT ref rTempPartner int iIsValid Begin Function {rTempPartner} if ((rTempPartner.IsActor) && (rTempPartner.isReference)) ;##################This is Line 7 if ((0 == rTempPartner.getAV Variable04) && (0 == rTempPartner.GetDead) && (0 == rTempPartner.GetDisabled) && (0 == rTempPartner.IsChild) && (0 == rTempPartner.GetUnconscious) && (0 == rTempPartner.GetKnockedState) && (0 == NX_IsInList SexoutBannedActorsWithPlayer rTempPartner)&& (0 == NX_IsInList SexoutListBannedActor rTempPartner)) Let iIsValid := 1 endif endif SetFunctionValue iIsValid End
Guest tomm434 Posted June 22, 2014 Posted June 22, 2014 nyaalich, script complies if you remove "IsReference" condition. You sure you can't use "GetType ==200" or something?
Guest tomm434 Posted June 22, 2014 Posted June 22, 2014 oh wait you need to use this isReference rTempPartner Don't know if that wil work but it complies
nyaalich Posted June 22, 2014 Posted June 22, 2014 Ah... right. Stared at the doc for the function, and then looked at the calling convention, which has ref.fxn in the examples. Thanks, tomm.
Odessa Posted June 22, 2014 Posted June 22, 2014 Quite a few NVSE functions are like that, its caught me out a few times. Sometimes it still compiles but doesn't work, I found: SomeItem.GetValue == 0 whilst (GetValue SomeItem) == The real value I think this applies to IsQuestItem too.
ArgusSCCT Posted June 22, 2014 Posted June 22, 2014 And if you are completely rewriting it, perhaps you can consider the mod working for NPC's or Companions wearing the armor too. I think that the old mod said it implemented something like that but I don't remember ever seeing an NPC or a companion ever using those abilities. I'll have to see how implementing something like that would work, looks easy to do with the PC but not so much with NPCs if you were to ask me.
DoctaSax Posted June 22, 2014 Posted June 22, 2014 if ((rTempPartner.IsActor) && (rTempPartner.isReference)) ;##################This is Line 7 oh wait you need to use this isReference rTempPartner Don't know if that wil work but it complies Seems fairly logical to me that if you need to check if something is a reference, you can't use reference calling syntax on it yet. Now this: if ((rTempPartner.IsActor) && (isReference rTempPartner)) may compile, but if rTempPartner is not a reference, it can crash the script when it calls IsActor on it. Only way to make sure is nesting: if IsReference rTempPartner if rTempPartner.isActor
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now