Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.77 KB | None | 0 0
  1. HedgewarsScriptLoad("/Scripts/Locale.lua")
  2. HedgewarsScriptLoad("/Scripts/Tracker.lua")
  3. HedgewarsScriptLoad("/Scripts/Utils.lua")
  4.  
  5. -- store number of hedgehogs
  6. local numhhs = 0
  7.  
  8.  
  9. function onGameInit() --make it so it is like a normal shoppa game
  10. GameFlags = gfSolidLand +gfBorder +gfResetWeps +gfRandomOrder +gfInvulnerable +gfInfAttack
  11. TurnTime = 999999
  12. CaseFreq = 0
  13. MinesNum = 8
  14. Explosives = 0
  15. Delay = 500
  16. SuddenDeathTurns = 99999 -- "disable" sudden death
  17. Map = '0ashoppaspeedzonetest'
  18. Theme = "Eyes"
  19.  
  20.  
  21. end
  22.  
  23. function onGameStart()
  24. vgtCircle1 = AddVisualGear(Z1x, Z1y, vgtCircle, 0, true) -- TheAnachron thanks and to UltiMaxKom ! -- so i need to name that variable so the next line (setvisualgearvalues know where to applied its effect !)
  25. SetVisualGearValues(vgtCircle1, Z1x, Z1y, 0, 255, 1, 5, 0, 600, 25, 0xff0000ff)
  26.  
  27. vgtCircle2 = AddVisualGear(Z2x, Z2y, vgtCircle, 0, true)
  28. SetVisualGearValues(vgtCircle2, Z2x, Z2y, 0, 255, 1, 5, 0, 600, 25, 0xff0000ff)
  29. vgtCircle3 = AddVisualGear(Z3x, Z3y, vgtCircle, 0, true)
  30. SetVisualGearValues(vgtCircle3, Z3x, Z3y, 0, 255, 1, 5, 0, 600, 25, 0xff0000ff)
  31. vgtCircle4 = AddVisualGear(Z4x, Z4y, vgtCircle, 0, true)
  32. SetVisualGearValues(vgtCircle4, Z14, Z4y, 0, 255, 1, 5, 0, 600, 25, 0xff0000ff)
  33.  
  34. --1530,814
  35. --on peut faire une array genre : zone1x = 1530 et zone1y = 814 , plus facile pour remplacer d'autres truc non ? oui !
  36. Z1x = 4096
  37. Z1y = 2807
  38.  
  39. Z2x = 6282
  40. Z2y = 3052
  41.  
  42. Z3x = 3648
  43. Z3y = 2743
  44.  
  45. Z4x = 2717
  46. Z4y = 1927
  47.  
  48.  
  49. -- put: 4906, 2807 put: 6282, 3052 put: 3648, 2743 put: 2717, 1927
  50. end
  51.  
  52. function onAmmoStoreInit()
  53. SetAmmo(amRope, 9, 1, 0)
  54. SetAmmo(amSkip, 9, 1, 0)
  55. SetAmmo(amTeleport, 9, 1, 0)
  56. end
  57.  
  58.  
  59. function onGameTick20()
  60. --create teleporter for big maps too !
  61. --8k/4k maps are too big (=4normal maps) so lets try a map more like 6k3k ? or even 4k8k or even 2k8k (=en hauteur, avec des étages)
  62. --test sur shoppastyle2 aussi, la map est assez grande ! pourrait bénéficier des accelzones
  63.  
  64. if CurrentHedgehog ~= nil then
  65. dx, dy = GetGearVelocity(CurrentHedgehog) -- j'imagine que getGearVelocity donne deux nombre, qu'on appellera ici dx et dy, on peut en fait les nommer comme on veut. (genre px et py mais il faut changer l'appelation dans setGearVelocity)
  66. if (gearIsInCircle(CurrentHedgehog, Z1x, Z1y, 350, useRadius)) then --gearIsInCircle(gear, x, y, r, useRadius)
  67. SetGearVelocity(CurrentHedgehog, dx*1.5, dy*1.5)
  68. AddVisualGear(hpx, hpy, vgtEvilTrace, 0, true)
  69. end
  70. if (gearIsInCircle(CurrentHedgehog, Z2x, Z2y, 350, useRadius)) then
  71. SetGearVelocity(CurrentHedgehog, dx*1.5, dy*1.5)
  72. AddVisualGear(hpx, hpy, vgtEvilTrace, 0, true)
  73. end
  74. if (gearIsInCircle(CurrentHedgehog, Z3x, Z3y, 350, useRadius)) then
  75. SetGearVelocity(CurrentHedgehog, dx*1.5, dy*1.5)
  76. AddVisualGear(hpx, hpy, vgtEvilTrace, 0, true)
  77. end
  78. if (gearIsInCircle(CurrentHedgehog, Z4x, Z4y, 350, useRadius)) then
  79. SetGearVelocity(CurrentHedgehog, dx*1.5, dy*1.5)
  80. AddVisualGear(hpx, hpy, vgtEvilTrace, 0, true)
  81. end
  82.  
  83. --below 5 lines are for ropes map...
  84. -- if (gearIsInBox(CurrentHedgehog, 4010, 1548, 82, 237)) and dy<=0 then --gearIsInCircle(gear, x, y, r, useRadius) -- dy<=0 works
  85. -- SetGearVelocity(CurrentHedgehog, dx, dy*2)--find a way so it is only to the top, currently it take the inithial direction and multiply it, i should do sth like >0 or <0
  86. --like : if dx <0 then return, if dx >0 then dx*2 ?
  87. -- elseif (gearIsInBox(CurrentHedgehog, 4010, 1548, 82, 237)) and dy>=0 then --if you go down since dy>0 then you go left (just to try ...)
  88. -- SetGearVelocity(CurrentHedgehog, -50000, dy) -- looks like 50000 is not real fast, might explain my result on speed hpx and hpy below
  89. -- end -- i think when dy is negative (dy<0 dy=-xxx) you go up.
  90.  
  91. hpx, hpy = GetGearPosition(CurrentHedgehog)
  92. --speed = (dx*1.0000001+dy*1.0000001)/2000 --commentary this so next line we try to put in on square root so it doesnt have any negative results and should work
  93. speedsquare = (dx*1.0000001+dy*1.0000001)*(dx*1.0000001+dy*1.0000001)
  94. speedsqrt = speedsquare/(dx*1.0000001+dy*1.0000001)
  95. speed = speedsqrt/2000
  96. --speedmax = -- and then we calcul the speed necessary for each vgt like : 1/5 of maxspeed : maxspeed/5)*1 or *2 etc
  97. -- if speed = 0 and speed <5 then
  98. -- end
  99. --num = math.abs(num)
  100. -- note : this below, doesnt work as expected, but, vgt following hog work, so should work too when they are sped up by a zone, should be good enough, one vgt would be sufficient,
  101. -- note : the acceleration vgt is not working (from vgt1 to vg10 my calcul of speed is not working....)
  102. if speed >50 and speed < 20 then
  103. AddVisualGear(hpx, hpy, vgtDroplet, 0, true)
  104. elseif speed >20 and speed < 70 then
  105. AddVisualGear(hpx, hpy, vgtBubble, 0, true)
  106. elseif speed >70 and speed < 110 then
  107. AddVisualGear(hpx, hpy, vgtSmokeTrace, 0, true)
  108. elseif speed >110 and speed < 130 then
  109. AddVisualGear(hpx, hpy, vgtSmokeWhite, 0, true)
  110. elseif speed >130 and speed < 160 then
  111. AddVisualGear(hpx, hpy, vgtDust, 0, true)
  112. elseif speed >160 and speed < 190 then
  113. AddVisualGear(hpx, hpy, vgtSmoke, 0, true)
  114. elseif speed >190 and speed < 215 then
  115. AddVisualGear(hpx, hpy, vgtEvilTrace, 0, true)
  116. elseif speed >215 then
  117. AddVisualGear(hpx, hpy, vgtFire, 0, true)
  118. --vgtSmoke = AddVisualGear(hpx, hpy, vgtSmoke, 0, true) -- when i let this, i doesnt work, next line work.
  119. --AddVisualGear(hpx, hpy, vgtSmoke, 0, true) it works but lets try something like : if speed = 1 : bubble, if speed = 10 white smoke, speed = 20 smoke and speed 50 = fire ? even try a hog ghost following him ?
  120. -- Droplet, Dust, Bubble, Smoke, vgtSmokeWhite, vgtSteam, vgtFire
  121. -- vgtDroplet, vgtBubble, vgtSmokeTrace,vgtSmokeWhite, vgtDust, vgtSmoke, vgtEvilTrace, vgtFire
  122. end
  123. end
  124.  
  125.  
  126.  
  127. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement