Advertisement
Jousway

ALL IN ONE

Dec 2nd, 2011
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.52 KB | None | 0 0
  1. --[[
  2. USW Noteskin.lua Version V2
  3. Made for Version Stepmania 5 Preview 4
  4.  
  5. I am the bone of my noteskin
  6. Arrows are my body, and explosions are my blood
  7. I have created over a thousand noteskins
  8. Unknown to death
  9. Nor known to life
  10. Have withstood pain to create many noteskins
  11. Yet these hands will never hold anything
  12. So as I pray, Unlimited Stepman Works
  13.  
  14. If you want to know the list of lua commands you can use here is the main page for help http://kki.ajworld.net/lua/sm5/Lua.xml
  15. --]]
  16.  
  17. local ret = ... or {};
  18.  
  19. --I always had the problem were I wrote var instead of Var, which really iritated me wondering why a code wouldnt work
  20. --You can edit it out if you want, But I'm just gonna leave it here so incase a person wants to make a noteskin
  21. --And gets the same problem as me were you use var instead of Var, atleast this should make it still work
  22. --But its best to use Var, And make sure to check all your code for little mistakes while you write ;)
  23. local var = Var;
  24.  
  25. --[[
  26. This is the general redirect table, Not the general redirect code, We use this if we are lazy ;)
  27. Or if we cant a directon of a noteskin use the exact same files as another direction
  28. The most re used direction in this case is "Down"
  29. You can add and remove values if you want, It works for every game type,
  30. If you want an easy way to know how all directions are called go in to stepmaniaoptions and change gametype
  31. Then if you go to key configure look at the names for the keys, They are the same names that are used in the noteskin.lua
  32. --]]
  33. ret.RedirTable =
  34. {
  35.     Up = "Down",
  36.     Down = "Down",
  37.     Left = "Down",
  38.     Right = "Down",
  39.     Center = "Down",
  40.     DownLeft = "Down",
  41.     DownRight = "Down",
  42.     UpLeft = "Down",
  43.     UpRight = "Down",
  44. };
  45.  
  46. --[[
  47. This is the general redirect code, We use this if we want to redirect parts of noteskins to other parts
  48. Because unlike the ret.RedirTable which redirects everything to the defined direction.
  49. Here we can add redirects for seperate elements which means we can use separate images if we want
  50. --]]
  51. local OldRedir = ret.Redir;
  52. ret.Redir = function(sButton, sElement)
  53.     sButton, sElement = OldRedir(sButton, sElement);
  54.  
  55.     --[[
  56.     We want to use custom hold/roll per direction, But keep global hold/roll heads and explosions.
  57.     We also want to use later defined images for Upleft and Upright for solo and piu
  58.     For this we added a define if its not Upleft or UpRight.
  59.     The reason we do this is because if we dont the code later on will be ignored because at the end
  60.     We return sButton and sElement which will result in the later code being ignored
  61.     --]]
  62.     if not Var "Button" == "UpLeft" then if not Var "Button" == "UpRight" then
  63.         if not string.find(sElement, "Head") and not string.find(sElement, "Explosion") then
  64.             if string.find(sElement, "Hold") or string.find(sElement, "Roll") then
  65.                 return sButton, sElement;
  66.             end
  67.         end
  68.     end end
  69.    
  70.     --This is were we call the ret.RedirTable and define it as sButton
  71.     --So it get called when we return sButton including the code under here
  72.     sButton = ret.RedirTable[sButton];
  73.    
  74.     --Making Roll Head/Explosion fallback on Hold
  75.     if  sElement == "Roll Head Inactive"
  76.     then
  77.         sElement = "Hold Head Inactive";
  78.     end
  79.    
  80.     if  sElement == "Roll Head Active"
  81.     then
  82.         sElement = "Hold Head Active";
  83.     end
  84.    
  85.     if  sElement == "Roll Explosion"
  86.     then
  87.         sElement = "Hold Explosion";
  88.     end
  89.    
  90.     --Adding stuff for more directions for diffrent gametypes  
  91.     if GAMESTATE:GetCurrentGame():GetName() == "dance" then
  92.         --Making the Upleft and Upright Hold body/BottomCap/TopCap and Explosions use SoloUpLeft and SoloUpRight instead
  93.         --So we can define diffrent images for diffrent gametypes
  94.         if Var "Button" == "UpLeft" and string.find(sElement, "Hold") and not string.find(sElement, "Explosion") then sButton = "SoloUpLeft"; end
  95.         if Var "Button" == "UpRight" and string.find(sElement, "Hold") and not string.find(sElement, "Explosion") then sButton = "SoloUpRight"; end
  96.         if Var "Button" == "UpLeft" and string.find(sElement, "Roll") and not string.find(sElement, "Explosion") then sButton = "SoloUpLeft"; end
  97.         if Var "Button" == "UpRight" and string.find(sElement, "Roll") and not string.find(sElement, "Explosion") then sButton = "SoloUpRight"; end
  98.     end
  99.     if GAMESTATE:GetCurrentGame():GetName() == "pump" then
  100.         --Making Pump it up be rythm color based, Only problem is that in sm player 1 and player 2 noteskins are both defined as player 1
  101.         --Need a way to get the parent but atm it ends up as nil because of no parent
  102.         --So Player 1 and 2 both use Player 1 images for now
  103.         --We also let every direction aside from Center use DownLeftp1
  104.         if GAMESTATE:GetMasterPlayerNumber() == "PlayerNumber_P1" then
  105.             if Var "Button" == "UpLeft" then sButton = "DownLeftp1"; end
  106.             if Var "Button" == "UpRight" then sButton = "DownLeftp1"; end
  107.             if Var "Button" == "DownLeft" then sButton = "DownLeftp1"; end
  108.             if Var "Button" == "DownRight" then sButton = "DownLeftp1"; end
  109.             if Var "Button" == "Center" then sButton = "DownCenterp1"; end
  110.         elseif GAMESTATE:GetMasterPlayerNumber() == "PlayerNumber_P2" then
  111.             if Var "Button" == "UpLeft" then sButton = "Downleftp2"; end
  112.             if Var "Button" == "UpRight" then sButton = "Downleftp2"; end
  113.             if Var "Button" == "DownLeft" then sButton = "DownLeftp2"; end
  114.             if Var "Button" == "DownRight" then sButton = "DownLeftp2"; end
  115.             if Var "Button" == "Center" then sButton = "DownCenterp2"; end
  116.         end
  117.     end
  118.    
  119.     --Define that every direction uses Tap Mine from Down
  120.     if Var "Element" == "Tap Mine" then sButton = "Down"; end
  121.    
  122.     return sButton, sElement;
  123. end
  124.  
  125. --[[
  126. This is the general function code
  127. In here we can define how we want the stuff to act
  128. Which basicly means instead of using a load of lua files for just some effect
  129. We can just use code in here so we need to use less files
  130. Which is nice if you want to save up space ;)
  131. Only problem is that the Hold/Roll parts are written down in the code as sprite files
  132. Which is the original old 3.9 code, Which basicly means that their code doesnt work in here
  133.  
  134. Also unlike the general redirect code which has sElement and sButton defined in the common noteskin
  135. They need to be defined here manualy which can be done with
  136. local sElement = Var "Element";
  137. local sButton = Var "Button";
  138. To make it easier for everyone I already added them
  139. The reason we use local to define the stuff is for when a code doesnt accept the full code
  140. Like for example if we did string.find(Var "Element", "Down") it wouldnt work
  141. --]]
  142. local OldFunc = ret.Load;
  143. function ret.Load()
  144.     local t = OldFunc();
  145.     local sElement = Var "Element";
  146.     local sButton = Var "Button";
  147.  
  148.     --Explosion should not be rotated; it calls other actors.
  149.     if Var "Element" == "Explosion" then
  150.         t.BaseRotationZ = nil;
  151.     end
  152.    
  153.    
  154.     if GAMESTATE:GetCurrentGame():GetName() == "dance" then
  155.     --We define that we dont want the hold heads for UpLeft and UpRight to be rotated because we rotate them in a lua file
  156.         if Var "Button" == "UpLeft" and string.find(sElement, "Head") then t.BaseRotationZ = nil; end
  157.         if Var "Button" == "UpRight" and string.find(sElement, "Head") then t.BaseRotationZ = nil; end
  158.     end
  159.     if GAMESTATE:GetCurrentGame():GetName() == "pump" then
  160.     --Because the images for Pump it up are using the DownLeft for every direction aside from center, We let it be rotated here
  161.     --Because the rotate table is set up for dance and these are for PIU
  162.         if Var "Button" == "UpLeft" then t.BaseRotationZ = 90; end
  163.         if Var "Button" == "UpRight" then t.BaseRotationZ = 180; end
  164.         if Var "Button" == "DownLeft" then t.BaseRotationZ = nil; end
  165.         if Var "Button" == "DownRight" then t.BaseRotationZ = -90; end 
  166.     end
  167.     return t;
  168. end
  169. -- >
  170.  
  171.  
  172. --Define which parts of noteskins which we want to rotate
  173. ret.PartsToRotate =
  174. {
  175.     ["Receptor"] = true,
  176.     ["Tap Explosion Bright"] = true,
  177.     ["Tap Explosion Dim"] = true,
  178.     ["Tap Note"] = true,
  179.     ["Tap Fake"] = true,
  180.     ["Tap Lift"] = true,
  181.     ["Tap Addition"] = true,
  182.     ["Hold Explosion"] = true,
  183.     ["Hold Head Active"] = true,
  184.     ["Hold Head Inactive"] = true,
  185.     ["Roll Explosion"] = true,
  186.     ["Roll Head Active"] = true,
  187.     ["Roll Head Inactive"] = true,
  188. };
  189. --Defined the parts to be rotated at which degree
  190. ret.Rotate =
  191. {
  192.     Up = 180,
  193.     Down = 0,
  194.     Left = 90,
  195.     Right = -90,
  196.     UpLeft = 135,
  197.     UpRight = -135,
  198.     Center = 0,
  199.     DownLeft = 0,
  200.     DownRight = -0,
  201. };
  202.  
  203. --Parts that should be Redirected to _Blank.png
  204. --you can add/remove stuff if you want
  205. ret.Blank =
  206. {
  207.     ["Hold Tail Active"] = true,
  208.     ["Hold Tail Inactive"] = true,
  209.     ["Roll Tail Active"] = true,
  210.     ["Roll Tail Inactive"] = true,
  211. };
  212.  
  213. --dont forget to close the ret cuz else it wont work ;>
  214. return ret;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement