Guest User

attach possibilities?

a guest
Oct 28th, 2014
136
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. scope BuildTower initializer onInit
  2.  
  3.  
  4. private function GridSimBuild takes nothing returns nothing
  5. // HERE I NEED TO REFER TO ORIGINAL BUILDER UNIT "u_builder"
  6. // BUT HOW???
  7.  
  8. // I COULD USE A STRUCT LIKE:
  9. // private struct Data
  10. // unit u
  11. // endstruct
  12. // & IN FUNC "Ability2Unit":
  13. // local Data d = d.create()
  14. // set d.u = u_builder
  15. // call SetUnitUserData(u_dummyBuilder, d)
  16. // & IN THIS FUNC ("GridSimBuild"):
  17. // local Data d = Data(GetUnitUserData(GetTriggerUnit()))
  18. // local unit u_YAY = d.u
  19. // !!! BUT !!!
  20. // I ALREADY USE THE UNITUSERDATA FOR ANOTHER SYSTEM,
  21. // SO WHAT ELSE CAN I USE?
  22. endfunction
  23.  
  24.  
  25. private function Ability2Unit takes nothing returns nothing
  26. local trigger tri
  27. local unit u_builder = GetTriggerUnit()
  28. local unit u_dummyBuilder
  29. local player p = GetOwningPlayer(u_builder)
  30.  
  31. set u_dummyBuilder = CreateUnit( p, 'hpea', 0, 0, 0 )
  32.  
  33. set tri = CreateTrigger()
  34. call TriggerRegisterUnitEvent( tri, u_dummyBuilder, EVENT_UNIT_ISSUED_POINT_ORDER )
  35. call TriggerAddAction( tri, function GridSimBuild )
  36.  
  37. set tri = null
  38. set p = null
  39. set u_builder = null
  40. set u_dummyBuilder = null
  41. endfunction
  42.  
  43.  
  44. private function onInit takes nothing returns nothing
  45. local trigger t = CreateTrigger()
  46. local integer i_player
  47.  
  48. set i_player = 0
  49. loop
  50. exitwhen i_player > 11
  51. call TriggerRegisterPlayerUnitEvent(t, Player(i_player), EVENT_PLAYER_UNIT_SPELL_CHANNEL, null)
  52. set i_player = i_player+1
  53. endloop
  54.  
  55. call TriggerAddAction(t, function Ability2Unit)
  56.  
  57. set t = null
  58. endfunction
  59.  
  60. endscope
RAW Paste Data