Page 1 of 1

I Got it.

PostPosted: Tue May 05, 2009 12:34 pm
by Jusey1
This can be lock or deleted. It pretty useless now.

Re: Need some help on scripting here?

PostPosted: Tue May 05, 2009 2:24 pm
by Raflod
Let me test how much I remember about Morro scripting now that I'm fully immersed in Java SE :) :

First, you cannot stop a local script. I'd rather call a global one from the local one and then stop the global one.

Code: Select all
Begin localScript

       short doOnce

       if ( MenuMode == 1 )
               return
       endif

       if ( doOnce == 0 )
               if ( THIS_NPC->GetHealth <= 0 )
                       startscript globalScript
                       set doOnce to 1
               endif
       endif


End


Code: Select all
Begin globalScript

       if ( MenuMode == 1 )
               return
       endif

       placeatme SOMETHING 0 0 ;here you can play with distance (first numeric parameter) and direction (second one)
       stopscript globalScript

End


For the distance/direction parameters look here for the PlaceAtMe function

I forgot that you have to have Tribunal/Bloodmoon in order to be able to use the PlaceAtMe function.

:scarper:
Now I really had better go wash my hands from the spaghetti deprecation, or Java will be offended. If you know what I mean. Hehe.

Re: Need some help on scripting here?

PostPosted: Tue May 05, 2009 3:05 pm
by Jusey1
I think you got it a little miss up. Here something that I mean.

If "General_01" GetHealth 0
         PlaceAtMe "Genereal_01"

and

If "Gate_Captain_01" GetHealth 0
     EndThisScript

This is something I try and didnt work well.

Re: Need some help on scripting here?

PostPosted: Tue May 05, 2009 4:28 pm
by Raflod
It looks like I missed a parameter for the PlaceAtMe functions. Actually it's "Placeatme objectID count distance direction".

If you wanted a single script which you will think about how to handle it (and I assume you know how to handle it e.g. how to call it from console), you could try this:

Code: Select all
Begin testScript

       short doOnce
       short doOnce2

       if ( MenuMode == 1 )
               return
       endif

       if ( doOnce == 0 )
               if ( General_01->GetHealth <= 0 )
                       placeatme General_01 1 0 0
                       set doOnce to 1
               endif
       endif

       if ( Gate_Captain_01->GetHealth <= 0 )
               set doOnce to 0
               stopscript testScript
       endif

End


I just followed your instructions.

Re: Need some help on scripting here?

PostPosted: Tue May 05, 2009 4:44 pm
by Jusey1
Thats seem ok but I hope itll work for more then 1 NPC PLaceAtMe and I know how to do PlaceAtMe I made one of those scripts before.

Also how do you set something on a timer liek itll spawn something every 60 seconds?

Re: Need some help on scripting here?

PostPosted: Wed May 06, 2009 2:57 am
by Raflod
but I hope itll work for more then 1 NPC PLaceAtMe


You mean placing more npcs?

PlaceAtMe works for more that 1 npc, but I don't think it will work in your case. You are checking the health of the "General_01" and then you are placing another "General_01". After this, how can Morrowind know which one to refer to get the health, and the one to call the PlaceAtMe function to, if there are more than one "General_01"? I don't think it can.

To create timer-based events, look at this example script TestTimeScript.

Re: Need some help on scripting here?

PostPosted: Wed May 06, 2009 6:22 am
by zarnatheron
I think you should place it on the NPC with, something like:

Code: Select all
Begin myScript

short doOnce

if (doOnce ==0)
    if(OnDeath == 1)
        set doOnce  to 1
       placeatpc x x
    endif
endif

Then it will alos work on multiple NPC's

Re: Need some help on scripting here?

PostPosted: Fri May 08, 2009 8:02 pm
by Jusey1
Dont worry I figure out what I needed and I meant by more then 1 NPC as
General_01
Privite_01
Bowman_01
and more I meant by a different NPC not the same dude.

Re: Need some help on scripting here?

PostPosted: Thu Jun 11, 2009 12:29 pm
by Jusey1
THanks for the help but Im working on a mod atm but kinda need a script.