LucasForums

LucasForums (http://www.lucasforums.com/index.php)
-   Holowan Laboratories (http://www.lucasforums.com/forumdisplay.php?f=324)
-   -   Need some help with a script (http://www.lucasforums.com/showthread.php?t=212451)

duster 06-27-2013 06:02 PM

Need some help with a script
 
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?

Code:

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

Any help would be apreciated.:)

Qui-Gon Glenn 06-27-2013 08:25 PM

Quote:

Originally Posted by duster (Post 2834746)
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?

Code:

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

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.

Fallen Guardian 06-27-2013 10:13 PM

Quote:

Originally Posted by Qui-Gon Glenn (Post 2834754)
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.

duster 06-28-2013 06:08 AM

Thank you both for the reply!
Quote:

Originally Posted by Fallen Guardian (Post 2834758)
If -1.0 is not working for the duration, just try setting it to something very long like 999999.0.

That did the trick!:thumbsup:
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.

Quote:

Originally Posted by Qui-Gon Glenn (Post 2834754)
This should be simple to fix. Look at my Sith Stalker script which appears early in my Script Shack thread.

Something like this?↓
Code:

DelayCommand(1.5, RemoveEffect(oSelf, eCurrent));

Fallen Guardian 06-28-2013 11:06 AM

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.

Code:

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.

Fair Strides 2 06-28-2013 12:07 PM

Quote:

Originally Posted by Fallen Guardian (Post 2834773)
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.

Code:

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...

duster 06-28-2013 12:09 PM

Quote:

Originally Posted by Fallen Guardian (Post 2834773)
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.

Code:

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?

Qui-Gon Glenn 06-28-2013 12:51 PM

Quote:

Originally Posted by duster (Post 2834775)
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.

duster 06-28-2013 02:35 PM

Quote:

Originally Posted by Qui-Gon Glenn (Post 2834776)
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.

Fair Strides 2 06-28-2013 03:16 PM

Quote:

Originally Posted by duster (Post 2834779)
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:
:comp9:

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:
Code:

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);
    }
}


duster 07-01-2013 01:07 PM

Damn!First i wasn't able to go to the site and then my Windows broke down.Never the less everything is fixed now.
Quote:

Originally Posted by Fair Strides 2 (Post 2834780)
Oh! In that case:
:comp9:

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:
Code:

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.:)

Fallen Guardian 07-01-2013 01:54 PM

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.

duster 07-01-2013 02:59 PM

Quote:

Originally Posted by Fallen Guardian (Post 2834785)
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.:)
Quote:

Originally Posted by Fallen Guardian (Post 2834785)
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!

Fallen Guardian 07-01-2013 03:42 PM

Quote:

Originally Posted by duster (Post 2834788)
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.

Quote:

Originally Posted by duster (Post 2834788)
Thank's alot guys!You helped me alot!

Glad we could help.


All times are GMT -4. The time now is 07:39 AM.

Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
LFNetwork, LLC ©2002-2011 - All rights reserved.