Jump to content

Random Problem (Problem with random-function)


Kurosama24

Recommended Posts

Hi,

while trying to mod Morrowind and adding mining, I ended up on a problem:
I tryed to use the "Random, 100" function to use different parts.
The Problem is, that the only result of the function will be 0. It worked for a while, until I added a few variables.

The script:

Begin PF_Minewall_straight

short xPosiStatic
short yPosiStatic
short zPosiStatic
short xPosi
short yPosi
short zPosi
short PF_rnd
short done

If ( done == 0 )
Set xPosiStatic to GetPos X
Set yPosiStatic to GetPos Y
Set zPosiStatic to GetPos Z
Set xPosi to GetPos X
Set yPosi to GetPos Y
Set zPosi to GetPos Z
Set done to 1
Endif

If ( OnActivate == 1 )
If ( done == 1 )
Set done to 2
Endif
Endif

If ( done == 2 )
Set PF_rnd to Random, 100
Set yPosi to yPosiStatic - 64
If ( PF_rnd >= 0 )
If ( PF_rnd < 20 )
PlaceItem "in_moldcave2_s_00", xPosi, yPosi, zPosi, 0
Set done to 3
Endif
Elseif ( PF_rnd >= 20 )
If ( PF_rnd < 40 )
PlaceItem "in_moldcave2_s_01", xPosi, yPosi, zPosi, 0
Set done to 3
Endif
Elseif ( PF_rnd >= 40 )
If ( PF_rnd < 60 )
PlaceItem "in_moldcave2_s_02", xPosi, yPosi, zPosi, 0
Set done to 3
Endif
Elseif ( PF_rnd >= 60 )
If ( PF_rnd < 80 )
PlaceItem "in_moldcave2_s_03", xPosi, yPosi, zPosi, 0
Set done to 3
Endif
Elseif ( PF_rnd >= 80 )
If ( PF_rnd < 95 )
PlaceItem "in_moldcave2_s_04", xPosi, yPosi, zPosi, 0
Set done to 4
Endif
Elseif ( PF_rnd >= 95 )
If ( PF_rnd < 100 )
PlaceItem "in_moldcave4_s_00", xPosi, yPosi, zPosi, 0
Set done to 5
Endif
Endif
Endif

If ( done == 3 )
Set yPosi to yPosiStatic + 256
PlaceItem "PF_in_moldcave2_s_end", xPosi, yPosi, zPosi, 0
Set done to 6
Disable
Endif

If ( done == 4 )
Set yPosi to yPosiStatic + 256
Set zPosi to zPosiStatic - 128
PlaceItem "PF_in_moldcave2_s_end", xPosi, yPosi, zPosi, 0
Set done to 6
Disable
Endif

If ( done == 5 )
Set yPosi to yPosiStatic + 1024
PlaceItem "PF_in_moldcave2_s_end", xPosi, yPosi, zPosi, 0
Set done to 6
Disable
Endif
End


I don't know, what to do, can anybody help me?
Thank's
Kuro

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...