duster Posted June 27, 2013 Share Posted June 27, 2013 I've been working on an armband that will let me meditate and unmeditate whenever i use it.So far the player goes into the meditation position but also gets back to normal.Can someone tell me what i need to change in my script? void main() { ActionPlayAnimation( ANIMATION_LOOPING_MEDITATE, 1.0, -1.0); } I also tryed a scipt from another mod as a template for this one but it didn't work out. Show spoiler (hidden content - requires Javascript to show) void main() { if (SToggle == 0) { ActionPlayAnimation( ANIMATION_LOOPING_MEDITATE, 1.0, -1.0); return; } else { ActionPlayAnimation( ANIMATION_LOOPING_PAUSE1, 1.0, -1.0); return; } } Any help would be apreciated. Link to comment Share on other sites More sharing options...
Qui-Gon Glenn Posted June 28, 2013 Share Posted June 28, 2013 I've been working on an armband that will let me meditate and unmeditate whenever i use it.So far the player goes into the meditation position but also gets back to normal.Can someone tell me what i need to change in my script? void main() { ActionPlayAnimation( ANIMATION_LOOPING_MEDITATE, 1.0, -1.0); } I also tryed a scipt from another mod as a template for this one but it didn't work out. Show spoiler (hidden content - requires Javascript to show) void main() { if (SToggle == 0) { ActionPlayAnimation( ANIMATION_LOOPING_MEDITATE, 1.0, -1.0); return; } else { ActionPlayAnimation( ANIMATION_LOOPING_PAUSE1, 1.0, -1.0); return; } } Any help would be apreciated. looping animation should not stop until you ClearAllEffects. I am away from my office atm, but I would try compiling it with only the -1.0 duration and not including the 1.0, which as a parameter I cannot recall what it is. This should be simple to fix. Look at my Sith Stalker script which appears early in my Script Shack thread. Link to comment Share on other sites More sharing options...
Fallen Guardian Posted June 28, 2013 Share Posted June 28, 2013 I am away from my office atm, but I would try compiling it with only the -1.0 duration and not including the 1.0, which as a parameter I cannot recall what it is. 1.0 just sets the speed the animation is played at. If -1.0 is not working for the duration, just try setting it to something very long like 999999.0. Link to comment Share on other sites More sharing options...
duster Posted June 28, 2013 Author Share Posted June 28, 2013 Thank you both for the reply! If -1.0 is not working for the duration, just try setting it to something very long like 999999.0. That did the trick! Thank's alot dude! Now all i need to know if it's possible by pressing the armband again the player can get back to normal position. This should be simple to fix. Look at my Sith Stalker script which appears early in my Script Shack thread. Something like this?↓ DelayCommand(1.5, RemoveEffect(oSelf, eCurrent)); Link to comment Share on other sites More sharing options...
Fallen Guardian Posted June 28, 2013 Share Posted June 28, 2013 Since an animation is an action and is assigned as such, it'd probably be better to call ClearAllActions, but since I can't remember exactly I'll throw in ClearAllEffects as well. void main() { DelayCommand(1.5, AssignCommand(GetFirstPC(), ClearAllActions())); DelayCommand(1.5, AssignCommand(GetFirstPC(), ClearAllEffects())); } Of course you can adjust 1.5 to whatever delay you want and it might be prudent to change GetFirstPC to something that would call the object that last activated the armband, if you plan to have more than just the PC be able to meditate on whim. Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted June 28, 2013 Share Posted June 28, 2013 Since an animation is an action and is assigned as such, it'd probably be better to call ClearAllActions, but since I can't remember exactly I'll throw in ClearAllEffects as well. void main() { DelayCommand(1.5, AssignCommand(GetFirstPC(), ClearAllActions())); DelayCommand(1.5, AssignCommand(GetFirstPC(), ClearAllEffects())); } Of course you can adjust 1.5 to whatever delay you want and it might be prudent to change GetFirstPC to something that would call the object that last activated the armband, if you plan to have more than just the PC be able to meditate on whim. I believe there's a function in k_inc_force.nss that's called "GetSpellTargetObject();" The devs used it as the master target-selector for any and all lines in the vanilla spells.2da... Link to comment Share on other sites More sharing options...
duster Posted June 28, 2013 Author Share Posted June 28, 2013 Since an animation is an action and is assigned as such, it'd probably be better to call ClearAllActions, but since I can't remember exactly I'll throw in ClearAllEffects as well. void main() { DelayCommand(1.5, AssignCommand(GetFirstPC(), ClearAllActions())); DelayCommand(1.5, AssignCommand(GetFirstPC(), ClearAllEffects())); } Of course you can adjust 1.5 to whatever delay you want and it might be prudent to change GetFirstPC to something that would call the object that last activated the armband, if you plan to have more than just the PC be able to meditate on whim. Surprisingly neither didn't make any difference.I compiled it into a script wich i also added into the rows of spells.2da and add it as another activate item property to the band.Were you refering on putting this script for another one that will "unmaditate" the player? Link to comment Share on other sites More sharing options...
Qui-Gon Glenn Posted June 28, 2013 Share Posted June 28, 2013 Surprisingly neither didn't make any difference.I compiled it into a script wich i also added into the rows of spells.2da and add it as another activate item property to the band.Were you refering on putting this script for another one that will "unmaditate" the player? Yes the latter script is for "unmaditating" lol. I think FG is correct that ClearAllActions is all that is needed. Link to comment Share on other sites More sharing options...
duster Posted June 28, 2013 Author Share Posted June 28, 2013 Yes the latter script is for "unmaditating" lol. I think FG is correct that ClearAllActions is all that is needed. You missunderstood me.I wanted to know if Fallen Guardian ment that i should make another band with the other script(wich works perfectly).I wish to know if there is a way not to make it.Meaning to have one band do both actions just by being pressed a second time. Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted June 28, 2013 Share Posted June 28, 2013 You missunderstood me.I wanted to know if Fallen Guardian ment that i should make another band with the other script(wich works perfectly).I wish to know if there is a way not to make it.Meaning to have one band do both actions just by being pressed a second time. Oh! In that case: You'll need to make a global boolean(Pretty easy, but don;t have the time to explain it now) and check it each time the band is used. For example: void main() { if(GetGlobalBoolean("Armband_is_on") == 1) { <Deactivate meditating> SetGlobalBoolean("Armband_is_on", 0); return; // Makes it so we don't do the part below, otherwise you'd never leave } if(GetGlobalBoolean("Armband_is_on") == 0) { <Activate meditating> SetGlobalBoolean("Armband_is_on", 1); } } Link to comment Share on other sites More sharing options...
duster Posted July 1, 2013 Author Share Posted July 1, 2013 Damn!First i wasn't able to go to the site and then my Windows broke down.Never the less everything is fixed now. Oh! In that case: You'll need to make a global boolean(Pretty easy, but don;t have the time to explain it now) and check it each time the band is used. For example: void main() { if(GetGlobalBoolean("Armband_is_on") == 1) { <Deactivate meditating> SetGlobalBoolean("Armband_is_on", 0); return; // Makes it so we don't do the part below, otherwise you'd never leave } if(GetGlobalBoolean("Armband_is_on") == 0) { <Activate meditating> SetGlobalBoolean("Armband_is_on", 1); } } *sign*Unfortunetly it didn't change anything.Thank's for the help though. Link to comment Share on other sites More sharing options...
Fallen Guardian Posted July 1, 2013 Share Posted July 1, 2013 It might be better to set a delay command to make your guy stand back up on the same script you make him meditate, rather than using local or global booleans. I'm pretty sure the animation played when you use the armband would make you stop meditating anyway. Link to comment Share on other sites More sharing options...
duster Posted July 1, 2013 Author Share Posted July 1, 2013 It might be better to set a delay command to make your guy stand back up on the same script you make him meditate, rather than using local or global booleans. I guess that's best. I'm pretty sure the animation played when you use the armband would make you stop meditating anyway. Nah it just gets to meditation again. XD Thank's alot guys!You helped me alot! Link to comment Share on other sites More sharing options...
Fallen Guardian Posted July 1, 2013 Share Posted July 1, 2013 Nah it just gets to meditation again. XD I actually meant that if you used the booleans so the armband would switch between making you meditate and making you stop, using the armband to make you stop would probably make you stop because of the activate animation played by the armband being used, moreso then the actions called within the script. Thank's alot guys!You helped me alot! Glad we could help. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.