AgentOrange Posted March 13, 2021 Author Share Posted March 13, 2021 (edited) GameMode is the right block mode, but for this kind of script it should be used in a quest script so you can manage how it runs. Make a quest and attach your script to it, making sure the quest starts automatically. Then in your script, define and set fQuestDelayTime (its a float) to a reasonably low value like 0.01I've never made a quest before either. Is there a similar mod that uses quests in this way? I would download it to look at the architecture because I'm a better visual learner. :blush: Edited March 13, 2021 by AgentOrange Link to comment Share on other sites More sharing options...
KatsAwful Posted March 13, 2021 Share Posted March 13, 2021 You don't need to do anything with the quest, just needs to exist basically. Most mods have empty quests whose sole purpose is to run a quest script Link to comment Share on other sites More sharing options...
AgentOrange Posted March 13, 2021 Author Share Posted March 13, 2021 (edited) You don't need to do anything with the quest, just needs to exist basically. Most mods have empty quests whose sole purpose is to run a quest scriptI have an armor mod that gives the player character clothing on loading the game. Would something like this be a good base for what I am trying to do? Edited March 13, 2021 by AgentOrange Link to comment Share on other sites More sharing options...
AgentOrange Posted March 13, 2021 Author Share Posted March 13, 2021 (edited) OK I looked at some other quests and tried my hand but hit a roadblock. I created a quest and wrote this script, which saved successfully. scn AAADodgeInvuln float fQuestDelayTime Begin GameMode set fQuestDelayTime to 0.01 if (Player.IsDodging == 1) Player.Setghost 1 elseif (Player.IsDodging == 0) Player.SetGhost 0 endif End However when I go to select a script for the quest I can find it on the drop down menu. What did I miss? :confused: Edited March 13, 2021 by AgentOrange Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted March 13, 2021 Share Posted March 13, 2021 What is the script type set to in the script editor? If it's not set as a quest script, it can't be selected in a quest.It depends on what CS you use where this choice will be (top or bottom of the window, usually on the right). It shouldn't be hard to spot some dropdown that says "quest" or "object" or "spell" though. Link to comment Share on other sites More sharing options...
KatsAwful Posted March 13, 2021 Share Posted March 13, 2021 For the normal CS script window the script type is at the top in the middle. For CSE its in the bottom right corner Link to comment Share on other sites More sharing options...
AgentOrange Posted March 14, 2021 Author Share Posted March 14, 2021 (edited) For the normal CS script window the script type is at the top in the middle. For CSE its in the bottom right cornerThis was the problem thank you! One step closer. Now I can see the script sort of(not really) works in game. It does not make me invulnerable during the dodge animation, but it appears to at least be running. So that's progress. :teehee: The only thing it does is immediately setghost back to 0 after I manually toggle it to 1 with the console. I think the "IsDodging" function only refers to the moment the actor initiates the dodge. It does not refer to the entire dodge animation. So the above script just immediately sets ghost to 1 and then back 0 after just one frame. I think IsDodging may not work for what I am trying to do. Unless someone can explain to me that I am understanding it wrong? So back to the first idea of animation groups. I tried this: scn AAADodgeInvuln float fQuestDelayTime Begin GameMode set fQuestDelayTime to 0.01 if (Player.IsAnimGroupPlaying DodgeForward == 1) Player.SetGhost 1 elseif (Player.IsAnimGroupPlaying DodgeLeft == 1) Player.SetGhost 1 elseif (Player.IsAnimGroupPlaying DodgeRight == 1) Player.SetGhost 1 elseif (Player.IsAnimGroupPlaying DodgeBack == 1) Player.SetGhost 1 endif End And this worked! I was invulnerable while dodging for the first time. But this had the problem which everyone else here predicted. SetGhost remains on afterward. What can I do to make setghost turn off at the end of the dodge animation? Maybe I can have it check for an idle animation? I think that after you dodge you always go back to an idle. But I am not sure what that would look like. EDIT - I think I figured it out! I just needed to add one more check to the end of the script. The current draft looks like this: scn AAADodgeInvuln float fQuestDelayTime Begin GameMode set fQuestDelayTime to 0.01 if (Player.IsAnimGroupPlaying DodgeForward == 1) Player.SetGhost 1 elseif (Player.IsAnimGroupPlaying DodgeLeft == 1) Player.SetGhost 1 elseif (Player.IsAnimGroupPlaying DodgeRight == 1) Player.SetGhost 1 elseif (Player.IsAnimGroupPlaying DodgeBack == 1) Player.SetGhost 1 elseif (Player.IsAnimGroupPlaying Idle == 1) Player.SetGhost 0 endif End I will need to do some more testing(when I am less sleepy) but this appears to have worked. My character is invulnerable during the dodge animation and vulnerable once again afterwards. For now what do the more experienced people think? Is this the most efficient way to do this kind of mod? Quality and performance wise? Should I clean up the syntax at all? Thanks again to everyone. :smile: Edited March 14, 2021 by AgentOrange Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted March 14, 2021 Share Posted March 14, 2021 Hmm, it works and does the job.There should also be not much room for improvements performance-wise, but I'm no expert in this. You can get rid of the "== 1" in all cases, like I said, as these are mostly Boolean functions here. And you could save the last comparison/condition by just making it an "else", so it'll be processed whenever none of the above checks succeeds. So whichever animation group you're switching to after dodging, the ghost effect will be turned off, not only when switching directly to Idle, like it is now. Link to comment Share on other sites More sharing options...
AgentOrange Posted March 15, 2021 Author Share Posted March 15, 2021 Hmm, it works and does the job.There should also be not much room for improvements performance-wise, but I'm no expert in this. You can get rid of the "== 1" in all cases, like I said, as these are mostly Boolean functions here. And you could save the last comparison/condition by just making it an "else", so it'll be processed whenever none of the above checks succeeds. So whichever animation group you're switching to after dodging, the ghost effect will be turned off, not only when switching directly to Idle, like it is now.Thanks again. I tested the changes and it all seems working. Is there a function other than Player.IsAnimGroupPlaying that would apply to all actors? I tried "Actor.IsAnimGroupPlaying" but it was not recognized. Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted March 16, 2021 Share Posted March 16, 2021 Hmm, actually IsAnimGroupPlaying can be called on every kind of actor, capable of playing anim groups of course, not just the player. I think the error you got with your attempt was more originating from where this "Actor" was coming from. If it wasn't a "ref" variable set to some actual actor before the call, or an actor reference in direct writing (like "Player" is), then yes, it can't have worked. Link to comment Share on other sites More sharing options...
Recommended Posts