Advertisement
Deji

I like SCR :)

Jan 23rd, 2012
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.84 KB | None | 0 0
  1. {$CLEO .cs}
  2.  
  3. const
  4.     // not only does constants for vars in SB make it easier to remember vars we can also change the
  5.     // vars at any time for better var management (very useful if you forgot to leave space for a string)
  6.     stage                       = 0@
  7.     door                        = 1@
  8.     open_door                   = 2@
  9.    
  10.     player                      = $PLAYER_CHAR
  11.     scplayer                    = $PLAYER_ACTOR
  12.    
  13.     // #KMB_LOCKEDDOOR is not allowed. Doesn't mean we have to stick with a number and later be clueless as to which model is which.
  14.     KMB_LOCKEDDOOR              = 2949
  15.    
  16.     // And here we save 4 variables
  17.     doorPosX                    = 191.141
  18.     doorPosY                    = 1870.04
  19.     doorPosZ                    = 18.4766
  20.     doorTarX                    = 181.141       // x coord door will slide to
  21. end
  22.  
  23. stage = 0
  24.  
  25. :mainloop
  26. WAIT 0
  27.  
  28. // there's still always room for low-construct where it doesn't really make a difference :P
  29. IS_PLAYER_PLAYING player
  30. ELSE_GOTO @mainloop
  31.  
  32. IF stage == 0
  33. THEN
  34.     IF  // any means == by car or foot
  35.         LOCATE_CHAR_ANY_MEANS_3D scplayer 191.141 1870.04 18.4766 80.5 80.5 80.5 FALSE  // R*N comments exactly where the coords point to.. makes sense, why not us?
  36.     THEN
  37.         doorPosX = 191.141
  38.         doorPosY = 1870.04
  39.         doorPosZ = 18.4766
  40.         doorTarX = 181.141
  41.         REQUEST_MODEL KMB_LOCKEDDOOR
  42.        
  43.         WHILE NOT HAS_MODEL_LOADED KMB_LOCKEDDOOR      // better than repeat..until, since we have a chance to avoid WAIT altogether
  44.             WAIT 0
  45.         END
  46.    
  47.         CREATE_OBJECT KMB_LOCKEDDOOR doorPosX doorPosY doorPosZ door
  48.         SET_OBJECT_HEADING door 90.0
  49.         open_door = 0
  50.         stage = 1
  51.     END
  52. END
  53.  
  54. IF
  55.     stage == 1
  56. THEN
  57.     IF
  58.         LOCATE_CHAR_ANY_MEANS_3D scplayer doorPosX doorPosY doorPosZ 90.5 90.5 90.5 FALSE
  59.     THEN
  60.         IF
  61.             LOCATE_CHAR_ANY_MEANS_3D scplayer doorPosX doorPosY doorPosZ 10.5 10.5 10.5 TRUE
  62.         THEN
  63.             IF
  64.                 open_door == 0
  65.             THEN
  66.            
  67.                 SLIDE_OBJECT door doorTarX doorPosY doorPosZ 0.1 0.1 0 FALSE
  68.                
  69.                 IF LOCATE_OBJECT_2D door doorTarX doorPosY 1.0 1.0 FALSE
  70.                 THEN open_door = 1
  71.                 END
  72.                
  73.             ELSE
  74.            
  75.                 SLIDE_OBJECT door doorPosX doorPosY doorPosZ 0.1 0.1 0 FALSE
  76.                
  77.                 IF LOCATE_OBJECT_2D door doorPosX doorPosY 1.0 1.0 FALSE
  78.                 THEN open_door = 0
  79.                 END
  80.                                
  81.             END
  82.         END
  83.     ELSE
  84.         DELETE_OBJECT door              // why set a flag to make the streamer remove it when we can remove it? :)
  85.         MARK_MODEL_AS_NO_LONGER_NEEDED KMB_LOCKEDDOOR
  86.     END
  87. END
  88. GOTO @mainloop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement