My Script doesn't work

Post » Wed Aug 26, 2009 12:34 pm

Hi Everyone

Can someone please help me? i wrote a script, in whitch i wanted to move 2 platforms if the player collected the 4 Items (ex: Misc_Turn1)
but when i collected them nothing happens...
I'm not so well in making scripts and also my english isn't that well it should be... oO


Here is my script:


Begin Soulhearts


short doOnce
short NoLore
float timer
short start


if ( MenuMode == 1 )
. return
endif

if ( doOnce == 2 )
. return
endif

if ( CellChanged == 1 )
. if ( doOnce == 2 )
. "in_dae_Soulhearts"->disable
. "in_dae_platform_Soulhearts"->disable
. endif
endif

if ( doOnce == 0 )
. if ( GetItemCount Misc_Turn1 < 0 )
.. if ( GetItemCount Misc_Turn2 < 0 )
... if ( GetItemCount Misc_Turn3 < 0 )
.... if ( GetItemCount Misc_Turn4 < 0 )
..... if ( start == 0 )
...... MessageBox "Who has stolen my Soulhearts? You'll die!"
...... set start to 1
...... PlaySound "Door Stone Open"
...... set doOnce to 1
..... endif
.... endif
... endif
.. endif
. endif
endif

if ( start == 0 )
. return
endif

set timer to ( timer + GetSecondsPassed )


if ( timer < 1 )
. "in_dae_Soulhearts"->MoveWorld Z -10
. "in_dae_platform_Soulhearts"->MoveWorld Z 288
endif

if ( timer > 1 )
. "in_dae_Soulhearts"->MoveWorld X -64
endif

if ( timer > 9 )
. set start to 0
. set timer to 0
. Set doOnce to 2
. ;reset timer and start
endif




End Soulhearts



Ponts (.) made instead of tabs


Thx 4 help :)

Fututrix
User avatar
Tamika Jett
 
Posts: 3301
Joined: Wed Jun 06, 2007 3:44 am

Post » Wed Aug 26, 2009 12:43 am

All of your GetItemCounts should be prefixed by Player-> and the player will never have less than zero, so it'd be:

if ( Player->GetItemCount Misc_Turn1 < 1 )    if ( Player->GetItemCount Misc_Turn2 < 1 )    if ( Player->GetItemCount Misc_Turn3 < 1 )    if ( Player->GetItemCount Misc_Turn4 < 1)


BTW, you can use the [ code ][ /code ] tags to post code - they'll keep your tabs and spacing. Remove the spaces between the brackets to use the tag.
User avatar
Fluffer
 
Posts: 3489
Joined: Thu Jul 05, 2007 6:29 am

Post » Tue Aug 25, 2009 11:46 pm

Thanks a lot to you Jac :)

btw it's

 if ( Player->GetItemCount Misc_Turn1 > 0 ) 


;)
User avatar
Lovingly
 
Posts: 3414
Joined: Fri Sep 15, 2006 6:36 am

Post » Wed Aug 26, 2009 9:13 am

I was just going by what you posted, but you're welcome. :P
User avatar
Elizabeth Lysons
 
Posts: 3474
Joined: Fri Feb 02, 2007 7:16 am

Post » Wed Aug 26, 2009 3:31 am

Moved and optimized some code, try this out. :)

begin Soulheartsshort doOnceshort NoLorefloat timerif ( MenuMode )    returnendifif ( doOnce > 1 )    if ( CellChanged )        "in_dae_Soulhearts"->disable        "in_dae_platform_Soulhearts"->disable    endif    returnendifif ( doOnce == 0 )    if ( "player"->GetItemCount "Misc_Turn1" > 0 )        if ( "player"->GetItemCount "Misc_Turn2" > 0 )            if ( "player"->GetItemCount "Misc_Turn3" > 0 )                if ( "player"->GetItemCount "Misc_Turn4" > 0 )                    MessageBox "Who has stolen my Soulhearts? You'll die!"                    PlaySound "Door Stone Open"                    set doOnce to 1                endif            endif        endif    endif    returnendifset timer to ( timer + GetSecondsPassed )if ( timer < 1 )    "in_dae_Soulhearts"->MoveWorld Z -10    "in_dae_platform_Soulhearts"->MoveWorld Z 288else    if ( timer > 9 )        set timer to 0        Set doOnce to 2        ;reset timer and start    else        if ( timer > 1 )            "in_dae_Soulhearts"->MoveWorld X -64        endif    endifendifend

User avatar
Paula Ramos
 
Posts: 3384
Joined: Sun Jul 16, 2006 5:43 am

Post » Tue Aug 25, 2009 10:49 pm

Same thing, just easier to read:
if ( timer < 1 )    "in_dae_Soulhearts"->MoveWorld Z -10    "in_dae_platform_Soulhearts"->MoveWorld Z 288elseif ( timer > 9 )    set timer to 0    Set doOnce to 2    ;reset timer and startelse    "in_dae_Soulhearts"->MoveWorld X -64endif

User avatar
YO MAma
 
Posts: 3321
Joined: Thu Dec 21, 2006 8:24 am


Return to III - Morrowind