Advertisement
expired6978

Untitled

Apr 7th, 2015
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. Scriptname SpawnerTask Hidden
  2.  
  3. ; SpawnerTask allows to spawn and position an arbitrary number references in game world.
  4. ; It's effectively a batch combination of PlaceAtMe and SetPosition/MoveTo that smoothly executes in a single frame.
  5. ;
  6. ; Example:
  7. ;
  8. ; ObjectReference player = ...
  9. ; Form chair = ...
  10. ; float[] offset = new float[3]
  11. ; float[] rotation = new float[3]
  12. ;
  13. ; ; Allocate new task
  14. ; int taskId = SpawnerTask.Create()
  15. ;
  16. ; ; No rotation
  17. ; rotation[0] = 0
  18. ; rotation[1] = 0
  19. ; rotation[2] = 0
  20. ;
  21. ; ; Spawn 100 chairs in a grid above the player
  22. ; int i = 0
  23. ; while i < 100
  24. ; offset[0] = -250 + (i / 10) * 50
  25. ; offset[1] = -250 + (i % 10) * 50
  26. ; offset[2] = 200
  27. ;
  28. ; SpawnerTask.AddSpawn(taskId, chair, player, offset, rotation)
  29. ; i += 1
  30. ; endWhile
  31. ;
  32. ; ; Run the task and return all placed references in an array
  33. ; ObjectReference[] spawned = SpawnerTask.Run(taskId)
  34.  
  35.  
  36. ; Creates a new SpawnerTask and returns a handle, which is an identifier for the created task.
  37. ; The task handle is valid until the task has been run or canceled, or until the calling stack has exited.
  38. ; (Function type: non-delayed)
  39. ;
  40. int Function Create() global native
  41.  
  42. ; Adds a spawn to the task identified by the given handle.
  43. ; Running the task places a new instance of formToPlace at target reference with given rotation and position offset. Parameters are analogously defined to PlaceAtMe.
  44. ; Multiple spawns can be added to the same task to be executed in a batch (which is the purpose).
  45. ; (Function type: non-delayed)
  46. ;
  47. Function AddSpawn(int handle, Form formToPlace, ObjectReference target, float[] positionOffset, float[] rotation, int count = 1, bool bForcePersist = false, bool bInitiallyDisabled = false) global native
  48.  
  49. ; Runs the task and returns the spawned references in an array. May return arrays with a size larger than 128.
  50. ; The resources allocated to the task are freed in the process, so the same task handle cannot be run twice.
  51. ; (Function type: latent)
  52. ;
  53. ObjectReference[] Function Run(int handle) global native
  54.  
  55. ; Cancels a task before running it and frees its allocated resources.
  56. ; Tasks cannot be canceled once they have been started with Run, and vice versa.
  57. ;
  58. Function Cancel(int handle) global native
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement