Shuvit game master repo. http://shuvit.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

controller2.py 163KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361
  1. #shuvit.org
  2. #main control script
  3. #scale = .3
  4. #action layers
  5. #0-14 rolling
  6. #grablay = 400
  7. #fliplay = 500
  8. #grindlay = 700
  9. os = 'Windows'
  10. from sys import platform
  11. if platform != "win32":
  12. os = 'Linux'
  13. def onWindows():
  14. return os == 'Windows'
  15. from mathutils import Vector
  16. import bge
  17. import GameLogic
  18. import ctypes
  19. import math
  20. #import bpy
  21. #build global dict (move this to separate script that runs once)
  22. scene = bge.logic.getCurrentScene()
  23. objList = scene.objects
  24. try:
  25. GameLogic.DictObjects
  26. init=1
  27. except:
  28. init=0
  29. if init:
  30. cont.GameLogic.getCurrentController()
  31. own = cont.getOwner()
  32. name = own.getName()
  33. if not GameLogic.DictObjects.has_key(name):
  34. GameLogic.DictObjects[name]=cont
  35. own.init=0
  36. reduction = 400000
  37. axisTh = 0.03
  38. #initialize quadrant variables
  39. q1on = 0
  40. q2on = 0
  41. q3on = 0
  42. q4on = 0
  43. q5on = 0
  44. q6on = 0
  45. q7on = 0
  46. q8on = 0
  47. lq1on = 0
  48. lq2on = 0
  49. lq3on = 0
  50. lq4on = 0
  51. lq5on = 0
  52. lq6on = 0
  53. lq7on = 0
  54. lq8on = 0
  55. #number of frames / length of the location timers
  56. countdown = 20
  57. cont = GameLogic.getCurrentController()
  58. obj = bge.logic.getCurrentScene().objects
  59. char = bge.constraints.getCharacter
  60. own = cont.owner
  61. dict = bge.logic.globalDict #Get the global dictionary
  62. #dict['trick_string'] = ''
  63. #last frame stuff
  64. lGRAB_ON = own["lGRAB_ON"]
  65. lastgrab = own["lastGrab"]
  66. lastpump = own["lastPump"]
  67. lf_ground = own["lF_ground"]
  68. lastopos = own["last_Opos"]
  69. lastnopos = own["last_nOpos"]
  70. LAST_STANCE = own["last_stance"]
  71. LAST_GROUND = own["last_ground"]
  72. lastStop = own["lastStop"]
  73. LAST_LEFT = own["LAST_LEFT"]
  74. last_trick_string = dict.get('last_trick_sting')
  75. lasta = own["lasta"]
  76. lastx = own["lastx"]
  77. lastaf = own["lastaf"]
  78. lastxf = own["lastxf"]
  79. lgf = own['last_grind_frame']
  80. frame = own['framenum']
  81. frames_since_grinding = frame - lgf
  82. own['last_footplant'] = own['footplant_on']
  83. lastaBut_ground = own['lastaBut_ground']
  84. lastxBut_ground = own['lastxBut_ground']
  85. aBut_ground = own['aBut_ground']
  86. xBut_ground = own['xBut_ground']
  87. own['last_manual_v2'] = own['manual_v2']
  88. #current frame stuff
  89. GRAB_ON = own["GRAB_ON"]
  90. pumpon = own["Pump"]
  91. vib_countdown = own["vib_Countdown"]
  92. grindold = own['grindOld']
  93. #grindHit = own["LAST_GRIND"]
  94. LAST_GRIND = own["LAST_GRIND"]
  95. #grindTouch = cont.sensors['grindCol']
  96. grindTouch = cont.sensors['grindCol_bottom']
  97. touched = grindTouch.triggered
  98. leftgrabon = own["Leftgrabon"]
  99. rightgrabon = own["Rightgrabon"]
  100. linvel = own.getLinearVelocity
  101. zvel = own.worldLinearVelocity.z
  102. own["Zvel"] = zvel
  103. r_ground = cont.sensors["r_Ground"]
  104. trigger = r_ground.triggered
  105. STANCE = own["stance"]
  106. motion = cont.actuators['MotionPump']
  107. linVelocity = own.getLinearVelocity(True)
  108. countdown = own['countdown']
  109. jump_timer = own['jump_timer']
  110. pos = own.localPosition
  111. rot = own.getAxisVect( [0.0, 0.0, 1.0])
  112. gray = cont.sensors["gRay"]
  113. #airconst = cont.actuators["airConst"]
  114. pop = cont.actuators["pop"]
  115. grindHit = own["grindHit"]
  116. grindCement = cont.actuators["grind_cement"]
  117. grindRail = cont.actuators["grind_rail"]
  118. grindSound = own["grindSound"]
  119. skater = scene.objects["Char4"]
  120. deck = scene.objects["deck"]
  121. trucks = scene.objects["trucks"]
  122. wheel1 = scene.objects["rollen.000"]
  123. wheel2 = scene.objects["rollen.001"]
  124. wheel3 = scene.objects["rollen.002"]
  125. wheel4 = scene.objects["rollen.003"]
  126. turnsens = .04
  127. turnsens2 = .06 #air_turn_boost
  128. grindDar = own["grindDar_hit"]
  129. grindEmpty = scene.objects["grindEmpty"]
  130. grindDar2 = grindEmpty.sensors["grindDar2"]
  131. #invertCol = cont.sensors["invertCol"]
  132. cam = scene.objects["Camera.003"]
  133. freecam = scene.objects["freecam"]
  134. followcam = scene.objects["followcam"]
  135. coping_on = own["coping"]
  136. invert_on = own['invert_on']
  137. grab_type = own['grab_type']
  138. c_ground = cont.sensors['c_ground']
  139. #
  140. control_bottom = scene.objects['control_bottom']
  141. invertTouch = control_bottom.sensors['grindCol_bottom']
  142. wallride = own["wallride"]
  143. wallride_col = cont.sensors['wallride']
  144. wallrideL = cont.sensors['wallrideL']
  145. wallrideR = cont.sensors['wallrideR']
  146. wallrideconstL = cont.actuators['wallrideconstL']
  147. wallrideconstR = cont.actuators['wallrideconstR']
  148. if r_ground.triggered: own['wallride_off'] = 0
  149. own['pop_sound'] = 0
  150. own['land_sound'] = 0
  151. #own['fall'] = 0
  152. #joystick location timers
  153. q1oncd = own["Q1oncd"]
  154. q2oncd = own["Q2oncd"]
  155. q3oncd = own["Q3oncd"]
  156. q4oncd = own["Q4oncd"]
  157. q5oncd = own["Q5oncd"]
  158. q6oncd = own["Q6oncd"]
  159. q7oncd = own["Q7oncd"]
  160. q8oncd = own["Q8oncd"]
  161. q1oncdl = own["Q1oncdl"]
  162. q2oncdl = own["Q2oncdl"]
  163. q3oncdl = own["Q3oncdl"]
  164. q4oncdl = own["Q4oncdl"]
  165. q5oncdl = own["Q5oncdl"]
  166. q6oncdl = own["Q6oncdl"]
  167. q7oncdl = own["Q7oncdl"]
  168. q8oncdl = own["Q8oncdl"]
  169. #setable
  170. grablay = 600 #this plus 1
  171. fliplay = 470
  172. MAX_VEL = 6.7
  173. SPEEDUP = .055
  174. SPEEDPUMP = .09 #.075
  175. SPEEDPUMPFAST = .13 #.09
  176. PUMP_SPEED_SENS = .4
  177. PUMP_SENS = .98
  178. ACCEL = 10
  179. CRUISE = 9
  180. COUNTDOWN = 20 #pump and speed stuff
  181. JUMPHEIGHT = 800 #775#750
  182. JUMPSTRENGTH = 0
  183. own['flip_manual_stance'] = 0
  184. CAVEMAN_SPEED = .75
  185. LAND_LAYER = 100
  186. LAND_END = 20
  187. #Sensor logic bricks connected to the python Controller
  188. aXis = cont.sensors["sControla"]
  189. bUtt = cont.sensors["sControlb"]
  190. onW = onWindows()
  191. # windows stuff
  192. lar_lts = 0
  193. uad_lts = 1
  194. lar_rts = 2 if onW else 2
  195. uad_rts = 3 if onW else 3
  196. lt = 4 if onW else 4
  197. rt = 5 if onW else 5
  198. # These are the numerical values associated with the buttons on the Xbox Controller
  199. # Called with - SensorName.getButtonStatus(buttonnumber) -
  200. # A joystick sensor logic brick (with the 'Button' Event Type; 'All Events' selected; and 'Tap' enabled) must be connected to the Python Controller logic brick to call these buttons
  201. a_but = 0 if onW else 0
  202. b_but = 1 if onW else 1
  203. x_but = 2 if onW else 2
  204. y_but = 3 if onW else 3
  205. l_bump = 9 if onW else 9
  206. r_bump = 10 if onW else 10
  207. bk_but = 4 if onW else 4
  208. st_but = 6 if onW else 6
  209. xb_but = 5 if onW else 5
  210. lts_pr = 7 if onW else 7
  211. rts_pr = 8 if onW else 8
  212. l_dp = 13 if onW else 13
  213. r_dp = 14 if onW else 14
  214. u_dp = 11 if onW else 11
  215. d_dp = 12 if onW else 12
  216. lLR = aXis.axisValues[lar_lts] / reduction
  217. lUD = aXis.axisValues[uad_lts] / reduction
  218. rLR = aXis.axisValues[lar_rts] / reduction
  219. rUD = aXis.axisValues[uad_rts] / reduction
  220. lTrig = aXis.axisValues[lt] / reduction
  221. rTrig = aXis.axisValues[rt] / reduction
  222. aBut = bUtt.getButtonStatus(a_but)
  223. bBut = bUtt.getButtonStatus(b_but)
  224. xBut = bUtt.getButtonStatus(x_but)
  225. yBut = bUtt.getButtonStatus(y_but)
  226. lBump = bUtt.getButtonStatus(l_bump)
  227. rBump = bUtt.getButtonStatus(r_bump)
  228. bkBut = bUtt.getButtonStatus(bk_but)
  229. stBut = bUtt.getButtonStatus(st_but)
  230. xbBut = bUtt.getButtonStatus(xb_but)
  231. ltsBut = bUtt.getButtonStatus(lts_pr)
  232. rtsBut = bUtt.getButtonStatus(rts_pr)
  233. ldPad = bUtt.getButtonStatus(l_dp)
  234. rdPad = bUtt.getButtonStatus(r_dp)
  235. udPad = bUtt.getButtonStatus(u_dp)
  236. ddPad = bUtt.getButtonStatus(d_dp)
  237. ## -End- ##
  238. list = bUtt.getButtonActiveList()
  239. #print(list)
  240. #no input
  241. def cutOff():
  242. if (abs(lLR) < axisTh
  243. and abs(lUD) < axisTh
  244. and abs(rLR) < axisTh
  245. and abs(rUD) < axisTh
  246. and aBut == False):
  247. return True
  248. #fliptricks after manuals
  249. if (frame - own['last_manual_frame']) < 25:
  250. flip_start_lay = 8
  251. flipspeed = .4
  252. own['flipspeed'] = .4
  253. own['flip_start_lay'] = 8
  254. #print("chopping flip start")
  255. else:
  256. flip_start_lay = 1
  257. own['flip_start_lay'] = 1
  258. flipspeed = .6
  259. own['flipspeed'] = .6
  260. def printplaying():
  261. splaying_layers = "S: "
  262. playing_layers = "D: "
  263. tplaying_layers = "T: "
  264. for x in range(9900):
  265. if skater.isPlayingAction(x):
  266. #if trucks.isPlayingAction(x):
  267. #if skater.isPlayingAction(x):
  268. splaying_layers += str(x)
  269. splaying_layers += " "
  270. if deck.isPlayingAction(x):
  271. #if trucks.isPlayingAction(x):
  272. #if skater.isPlayingAction(x):
  273. playing_layers += str(x)
  274. playing_layers += " "
  275. if trucks.isPlayingAction(x):
  276. #if trucks.isPlayingAction(x):
  277. #if skater.isPlayingAction(x):
  278. tplaying_layers += str(x)
  279. tplaying_layers += " "
  280. print(splaying_layers, playing_layers, tplaying_layers)
  281. if aBut == True and lasta == False and r_ground.triggered:
  282. aBut_ground = True
  283. own['aBut_ground'] = True
  284. #else:
  285. if aBut == False:
  286. aBut_ground = False
  287. own['aBut_ground'] = False
  288. if xBut == True and lastx == False and r_ground.triggered:
  289. xBut_ground = True
  290. own['xBut_ground'] = True
  291. #else:
  292. if xBut == False:
  293. xBut_ground = False
  294. own['xBut_ground'] = False
  295. def killact(layer):
  296. if skater.isPlayingAction(layer):
  297. skater.stopAction(layer)
  298. if deck.isPlayingAction(layer):
  299. deck.stopAction(layer)
  300. if trucks.isPlayingAction(layer):
  301. trucks.stopAction(layer)
  302. def killall():
  303. for x in range(9000):
  304. skater.stopAction(x)
  305. deck.stopAction(x)
  306. trucks.stopAction(x)
  307. def grind_stance():
  308. #own["last_grind_stance"] = own["grind_stance"]
  309. # if grindHit == 1 and LAST_GRIND == 1 and (own['grindCountdown'] < 15 or own['grindCountdown'] >19):
  310. # own["last_grind_stance"] = own["grind_stance"]
  311. #own["grind_stance"] = STANCE
  312. pass
  313. grind_stance()
  314. def reset_rtimers():
  315. own["Q1oncd"] = 0
  316. own["Q2oncd"] = 0
  317. own["Q3oncd"] = 0
  318. own["Q4oncd"] = 0
  319. own["Q5oncd"] = 0
  320. own["Q6oncd"] = 0
  321. own["Q7oncd"] = 0
  322. own["Q8oncd"] = 0
  323. q1oncd = 0
  324. q2oncd = 0
  325. q3oncd = 0
  326. q4oncd = 0
  327. q5oncd = 0
  328. q6oncd = 0
  329. q7oncd = 0
  330. q8oncd = 0
  331. def check_fall():
  332. playing_frame = 20
  333. if skater.isPlayingAction(fliplay):
  334. playing_frame = skater.getActionFrame(fliplay)
  335. if r_ground.triggered == True and skater.isPlayingAction(fliplay) and own['jump_timer'] < 40 and playing_frame < 14 and playing_frame > 3:
  336. own['fall'] = 1
  337. print("fall: ", playing_frame, own['jump_timer'])
  338. check_fall()
  339. def check_landing():
  340. lf_ground = own["lF_ground"]
  341. #zvel = own.getLinearVelocity
  342. #print(zvel)
  343. STANCE = own["stance"]
  344. #if lf_ground == False and r_ground.triggered == True and grindDar == 0:
  345. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  346. #if playing_action_frame < (LAND_END):
  347. #own["lastPump"] = False
  348. #own["Pump"] = False
  349. if lf_ground == False and r_ground.triggered == True:
  350. #resetjumpstance()
  351. #print(r_ground.hitObject)
  352. own['jump_from_trans'] = 0
  353. nearestObject = None
  354. minDist = None
  355. detectedObjects = grindDar2.hitObjectList
  356. #if grindHit == False and gray.triggered == False and touched == False:
  357. # if grindDar2.positive:
  358. # for obj in detectedObjects:
  359. # dist = own.getDistanceTo(obj)
  360. # if (minDist is None or dist < minDist):
  361. # nearestObject = obj
  362. # minDist = dist
  363. # if nearestObject != None and 'rail' in scene.objects[nearestObject]:
  364. # cont.activate(own.actuators["landonrail"])
  365. # print("landonrail***************")
  366. #play landing sound
  367. if grindDar == 0:
  368. #print("you are not grinding", grindHit)
  369. lastheight = own["air_height"]
  370. pos = own.worldPosition.z
  371. dist = lastheight - pos
  372. dist = dist * 2
  373. #print(dist, "-------------dist")
  374. if dist > 1:
  375. dist = 1
  376. own.actuators["land"].volume = dist
  377. #cont.deactivate(own.actuators["land"])
  378. sact = own.actuators["land"]
  379. sact.stopSound()
  380. cont.activate(own.actuators["land"])
  381. own['land_sound'] = 1
  382. if grindDar == 1:
  383. pass
  384. #cont.activate(own.actuators["landonrail"])
  385. #vibrate
  386. #set_vibration(0, 0.3, 0.3)
  387. own["vib_Countdown"] = 14
  388. cont.activate(own.actuators["Vibration"])
  389. #print("vibrate")
  390. if own['manual_v2'] == 0 and grindDar == 0:
  391. if STANCE == 0:
  392. own['requestAction'] = 'reg_land'
  393. elif STANCE == 1:
  394. own['requestAction'] = 'fak_land'
  395. killact(2)
  396. killact(3)
  397. killact(4)
  398. killact(5)
  399. lf_ground = r_ground.triggered
  400. own["lF_ground"] = lf_ground
  401. vib_countdown = own["vib_Countdown"]
  402. if vib_countdown == 0:
  403. pass
  404. #set_vibration(0, 0, 0)
  405. elif vib_countdown > 0:
  406. vib_countdown = vib_countdown - 1
  407. own["vib_Countdown"] = vib_countdown
  408. if vib_countdown == 1:
  409. stopAnims()
  410. stance()
  411. #air anim
  412. if r_ground.triggered == False:
  413. if STANCE == 0:
  414. own['requestAction'] = 'reg_air'
  415. if STANCE == 1:
  416. own['requestAction'] = 'fak_air'
  417. else:
  418. if STANCE == 0:
  419. own['requestAction'] = 'reg_roll'
  420. if STANCE == 1:
  421. own['requestAction'] = 'fak_roll'
  422. #check manual_v2
  423. if (rUD > .04 and rUD < .07) or (rUD < -.04 and rUD > -.07):
  424. #if (rUD > .04 and rUD < .07):
  425. #print("zoned")
  426. timer = own['manual_v2_timer']
  427. timer = timer + 1
  428. if timer > 20:
  429. own['manual_v2'] = 1
  430. own['manual_v2_timer'] = timer
  431. if rUD < .04 and rUD > -.04:
  432. own['manual_v2_timer'] = 0
  433. own['manual_v2'] = 0
  434. own['manual_v2_type'] = None
  435. if own['manual_v2'] == 1:
  436. if own['last_manual_v2'] == 0:
  437. #print("don't flip")
  438. if STANCE == 0:
  439. if rUD > .04 and rUD < .07:
  440. #print("reg manual")
  441. own['manual_v2_type'] = 'reg manual'
  442. own['requestAction'] = 'reg_manual'
  443. if rUD < -.04 and rUD > -.07:
  444. #print("reg nose manual")
  445. own['manual_v2_type'] = 'reg nose manual'
  446. own['requestAction'] = 'reg_nose_manual'
  447. if STANCE == 1:
  448. if rUD > .04 and rUD < .07:
  449. #print("fak manual")
  450. own['manual_v2_type'] = 'fak manual'
  451. own['requestAction'] = 'fak_manual'
  452. if rUD < -.04 and rUD > -.07:
  453. #print("fak nose manual")
  454. own['manual_v2_type'] = 'fak nose manual'
  455. own['requestAction'] = 'fak_nose_manual'
  456. else:
  457. #print("flip stance")
  458. if STANCE == 0:
  459. if own['manual_v2_type'] == 'fak manual':
  460. own['manual_v2_type'] = 'reg nose manual'
  461. if own['manual_v2_type'] == 'fak nose manual':
  462. own['manual_v2_type'] = 'reg manual'
  463. if STANCE == 1:
  464. if own['manual_v2_type'] == 'reg manual':
  465. own['manual_v2_type'] = 'fak nose manual'
  466. if own['manual_v2_type'] == 'reg nose manual':
  467. own['manual_v2_type'] = 'fak manual'
  468. #print(own['manual_v2'], own['manual_v2_type'])
  469. #check manual
  470. ####
  471. #reg
  472. if rUD > .04 and rUD < .07 and STANCE == 0 and rLR < .035 and rLR > -.035:
  473. timer = own["reg_manual_timer"]
  474. timer = timer + 1
  475. own["reg_manual_timer"] = timer
  476. if timer > 20 and rUD < .04:
  477. own["reg_manual"] = 0
  478. #print("reg_man off")
  479. if rUD <= .04 and (STANCE == 1 or STANCE == 0) and rUD >= -.04:
  480. own["reg_manual_timer"] = 0
  481. own["reg_manual"] = 0
  482. #print("reg_man off2")
  483. #####
  484. if own["reg_manual_timer"] > 10 and own["fak_manual"] == 0 and own['reg_nmanual'] == 0:
  485. #if own["reg_manual_timer"] > 10 and own["fak_manual"] == 0:
  486. #if own['fak_nmanual'] == 0:
  487. own["reg_manual"] = 1
  488. ######
  489. if own["reg_manual_timer"] == 0:
  490. own["reg_manual"] = 0
  491. if own['last_reg_manual'] == 1 and own['reg_manual'] == 0:
  492. killall()
  493. #print(own["reg_manual"])
  494. ####
  495. #fak
  496. if rUD > .04 and rUD < .07 and STANCE == 1 and rLR < .035 and rLR > -.035:
  497. timer = own["fak_manual_timer"]
  498. timer = timer + 1
  499. own["fak_manual_timer"] = timer
  500. if timer > 20:
  501. own["fak_manual"] = 0
  502. if rUD <= .04 and (STANCE == 1 or STANCE == 0) and rUD >= -.04:
  503. own["fak_manual_timer"] = 0
  504. own["fak_manual"] = 0
  505. if own["fak_manual_timer"] > 10 and own["reg_manual"] == 0:
  506. own["fak_manual"] = 1
  507. if own["fak_manual_timer"] == 0:
  508. own["fak_manual"] = 0
  509. if own['last_fak_manual'] == 1 and own['fak_manual'] == 0:
  510. killall()
  511. #print(own["reg_manual"], own["fak_manual"])
  512. #####
  513. #reg nmanual
  514. if rUD < -.04 and rUD > -.07 and STANCE == 0 and rLR < .035 and rLR > -.035:
  515. timer = own["reg_nmanual_timer"]
  516. timer = timer + 1
  517. own["reg_nmanual_timer"] = timer
  518. if timer > 20:
  519. own["reg_nmanual"] = 0
  520. if rUD >= -.04 and (STANCE == 1 or STANCE == 0) and rUD <= .04:
  521. own["reg_nmanual_timer"] = 0
  522. own["reg_nmanual"] = 0
  523. if own["reg_nmanual_timer"] > 10 and own["fak_nmanual"] == 0 and own['reg_manual'] == 0 and own['fak_manual'] == 0:
  524. if own['last_fak_manual'] == False and own['last_reg_manual'] == False and own['last_fak_manual'] == False:
  525. own["reg_nmanual"] = 1
  526. #print("baaad", own['reg_manual'], own['last_reg_manual'])
  527. if own["reg_nmanual_timer"] == 0:
  528. own["reg_nmanual"] = 0
  529. if own['last_reg_nmanual'] == 1 and own['reg_nmanual'] == 0:
  530. killall()
  531. #####
  532. #fak nmanual
  533. #print (rUD)
  534. if rUD < -.04 and rUD > -.07 and STANCE == 1 and rLR < .035 and rLR > -.035:
  535. timer = own["fak_nmanual_timer"]
  536. timer = timer + 1
  537. own["fak_nmanual_timer"] = timer
  538. if timer > 20:
  539. own["fak_nmanual"] = 0
  540. if rUD >= -.04 and (STANCE == 1 or STANCE == 0) and rUD <= .04:
  541. own["fak_nmanual_timer"] = 0
  542. own["fak_nmanual"] = 0
  543. #print('@@@@@@@@@fak_man_off_1')
  544. if own["fak_nmanual_timer"] > 10 and own["reg_nmanual"] == 0 and own['fak_manual'] == 0 and own ['reg_manual'] == 0:
  545. own["fak_nmanual"] = 1
  546. if own["fak_nmanual_timer"] == 0 and own['reg_manual'] == 0:
  547. #if own['flip_manual_stance'] == 0:
  548. own["fak_nmanual"] = 0
  549. if own['last_fak_nmanual'] == 1 and own['fak_nmanual'] == 0:
  550. killall()
  551. #print("rm ", own["reg_manual"], "rnm ", own["reg_nmanual"], "fm ", own["fak_manual"], "fnm ", own["fak_nmanual"])
  552. def reg_stance_left_off():
  553. LAST_LEFT = own["LAST_LEFT"]
  554. own["LAST_LEFT"] = 0
  555. def reg_stance_right_off():
  556. LAST_RIGHT = own["LAST_RIGHT"]
  557. own["LAST_RIGHT"] = 0
  558. def reg_stance_on():
  559. #revert_timer
  560. playing = deck.isPlayingAction(40)
  561. if own["revert_timer"] < 1 and own['manual_v2'] == 0 and playing == 0:
  562. own['requestAction'] = 'reg_roll'
  563. def reg_stance_off():
  564. killact(2)
  565. def reg_manual_on():
  566. own['requestAction'] = 'reg_manual'
  567. if own["reg_manual_timer"] == 41:
  568. killact(3000)
  569. killact(3001)
  570. killact(3002)
  571. def reg_manual_off():
  572. killact(222)
  573. killact(223)
  574. killact(224)
  575. killact(3000)
  576. killact(3001)
  577. killact(3002)
  578. killact(10)
  579. killact(32)
  580. killact(11)
  581. killact(34)
  582. def fak_manual_on():
  583. #killall()
  584. own['requestAction'] = 'fak_manual'
  585. if own["fak_manual_timer"] == 41:
  586. killact(3000)
  587. killact(3001)
  588. killact(3002)
  589. def fak_manual_off():
  590. killact(222)
  591. killact(223)
  592. killact(224)
  593. killact(3000)
  594. killact(3001)
  595. killact(3002)
  596. killact(10)
  597. killact(32)
  598. killact(11)
  599. killact(34)
  600. #######
  601. #######
  602. #######
  603. #######
  604. def reg_nmanual_on():
  605. own['requestAction'] = 'reg_nmanual'
  606. if own["reg_nmanual_timer"] == 41:
  607. killact(3000)
  608. killact(3001)
  609. killact(3002)
  610. def reg_nmanual_off():
  611. killact(222)
  612. killact(223)
  613. killact(224)
  614. killact(3000)
  615. killact(3001)
  616. killact(3002)
  617. killact(10)
  618. killact(32)
  619. killact(11)
  620. killact(34)
  621. def fak_nmanual_on():
  622. own['requestAction'] = 'fak_nmanual'
  623. if own["fak_nmanual_timer"] == 41:
  624. killact(3000)
  625. killact(3001)
  626. killact(3002)
  627. def fak_nmanual_off():
  628. killact(222)
  629. killact(223)
  630. killact(224)
  631. killact(3000)
  632. killact(3001)
  633. killact(3002)
  634. killact(10)
  635. killact(32)
  636. killact(11)
  637. killact(34)
  638. ###########
  639. def reg_stanceinc_on():
  640. skater.playAction("nreg", 1,60, layer=3, blendin=2, layer_weight=0, play_mode=1, speed=.5)
  641. deck.playAction("a_reg", 1,40, layer=3, blendin=0, blend_mode=0, play_mode=1, speed=.5)
  642. trucks.playAction("a_reg", 1,40, layer=3, blendin=2, layer_weight=0, play_mode=1, speed=.5)
  643. def reg_stanceinc_off():
  644. killact(3)
  645. def reg_stance_left_on():
  646. if own['manual_v2'] == 0 and own["revert_timer"] < 1:
  647. own['requestAction'] = 'reg_turnLeft'
  648. LAST_LEFT = own["LAST_LEFT"]
  649. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  650. if LAST_LEFT == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
  651. LAST_LEFT = 1
  652. own["LAST_LEFT"] = 1
  653. def reg_stance_right_on():
  654. if own['manual_v2'] == 0 and own["revert_timer"] < 1:
  655. own['requestAction'] = 'reg_turnRight'
  656. LAST_RIGHT = own["LAST_RIGHT"]
  657. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  658. if LAST_RIGHT == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
  659. LAST_RIGHT = 1
  660. own["LAST_RIGHT"] = 1
  661. def fak_stance_on():
  662. playing = deck.isPlayingAction(40)
  663. if own['manual_v2'] == 0 and own["revert_timer"] < 1 and playing == 0:
  664. own['requestAction'] = 'fak_roll'
  665. def fak_stance_off():
  666. killact(3)
  667. def fak_stance_left_on():
  668. if own['manual_v2'] == 0 and own["revert_timer"] < 1:
  669. own['requestAction'] = 'fak_turnLeft'
  670. LAST_LEFT_FAK = own["LAST_LEFT_FAK"]
  671. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  672. if LAST_LEFT_FAK == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
  673. LAST_LEFT_FAK = 1
  674. own["LAST_LEFT_FAK"] = 1
  675. def fak_stance_left_off():
  676. killact(12)
  677. killact(36)
  678. LAST_LEFT_FAK = own["LAST_LEFT_FAK"]
  679. own["LAST_LEFT_FAK"] = 0
  680. def fak_stance_right_on():
  681. if own['manual_v2'] == 0 and own["revert_timer"] < 1:
  682. own['requestAction'] = 'fak_turnRight'
  683. LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
  684. own["LAST_RIGHT_FAK"] = 1
  685. def fak_stance_right_off():
  686. killact(13)
  687. killact(37)
  688. LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
  689. own["LAST_RIGHT_FAK"] = 0
  690. def reg_air_on():
  691. playing = deck.isPlayingAction(fliplay)
  692. if playing == False:
  693. own['requestAction'] = 'reg_air'
  694. def reg_air_off():
  695. killact(4)
  696. def fak_air_on():
  697. flipping = skater.isPlayingAction(fliplay)
  698. if flipping == False:
  699. own['requestAction'] = 'fak_air'
  700. def fak_air_off():
  701. killact(5)
  702. #$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  703. def stance():
  704. # turnsens = .04
  705. # turnblend = 10
  706. rotation = .96
  707. turnsens = 0.06
  708. if rot.z < .9: inc = 1
  709. else: inc = 0
  710. flipping = skater.isPlayingAction(500)
  711. #print(flipping)
  712. #ground
  713. if r_ground.triggered == True and grindHit == False and flipping == False and own["wallride"] == None and own['revert_timer'] < 2:
  714. if STANCE == 0:
  715. reg_manual = own['reg_manual']
  716. fak_manual = own["fak_manual"]
  717. reg_nmanual = own['reg_nmanual']
  718. fak_nmanual = own["fak_nmanual"]
  719. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  720. fak_stance_off()
  721. reg_air_off()
  722. fak_air_off()
  723. if reg_manual == 0 and fak_manual == 0:
  724. last_manual = own['last_reg_manual']
  725. if last_manual == 1:
  726. reg_manual_off()
  727. fak_manual_off()
  728. reg_stance_on()
  729. if own['manual_v2_type'] == 'reg manual':
  730. reg_manual_on()
  731. elif own['manual_v2_type'] == 'reg nose manual':
  732. reg_nmanual_on()
  733. elif own['manual_v2_type'] == 'fak manual':
  734. fak_manual_on()
  735. elif own['manual_v2_type'] == 'fak nose manual':
  736. fak_nmanual_on()
  737. if STANCE == 1:
  738. reg_manual = own['reg_manual']
  739. fak_manual = own["fak_manual"]
  740. reg_nmanual = own['reg_nmanual']
  741. fak_nmanual = own["fak_nmanual"]
  742. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  743. reg_stance_off()
  744. reg_air_off()
  745. fak_air_off
  746. if fak_manual == 0:
  747. last_manual = own['last_fak_manual']
  748. if last_manual == 1:
  749. fak_manual_off()
  750. reg_manual_off()
  751. fak_stance_on()
  752. if own['manual_v2_type'] == 'fak manual':
  753. fak_manual_on()
  754. elif own['manual_v2_type'] == 'fak nose manual':
  755. fak_nmanual_on()
  756. elif own['manual_v2_type'] == 'reg manual':
  757. reg_manual_on()
  758. elif own['manual_v2_type'] == 'reg nose manual':
  759. reg_nmanual_on()
  760. if own["Pump"] == False:
  761. if lLR < -turnsens and STANCE == 0:
  762. reg_stance_left_on()
  763. if lLR > -turnsens or LAST_GRIND != grindHit:
  764. reg_stance_left_off()
  765. if lLR > turnsens and STANCE == 0:
  766. reg_stance_right_on()
  767. if lLR < turnsens or LAST_GRIND != grindHit:
  768. reg_stance_right_off()
  769. if lLR < -turnsens and STANCE == 1:
  770. fak_stance_left_on()
  771. if lLR > -turnsens or LAST_GRIND != grindHit:
  772. fak_stance_left_off()
  773. if lLR > turnsens and STANCE == 1:
  774. fak_stance_right_on()
  775. if lLR < turnsens or LAST_GRIND != grindHit:
  776. fak_stance_right_off()
  777. #air
  778. playing = deck.isPlayingAction(fliplay)
  779. if r_ground.triggered == False and playing == False and flipping == False:
  780. if STANCE == 0:
  781. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  782. fak_air_off()
  783. reg_stance_off()
  784. fak_stance_off()
  785. reg_stance_left_off()
  786. reg_stance_right_off()
  787. fak_stance_left_off()
  788. fak_stance_right_off()
  789. reg_air_on()
  790. if STANCE == 1:
  791. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  792. reg_air_off()
  793. reg_stance_off()
  794. fak_stance_off()
  795. reg_stance_left_off()
  796. reg_stance_right_off()
  797. fak_stance_left_off()
  798. fak_stance_right_off()
  799. fak_air_on()
  800. if grindHit == True:
  801. reg_stance_off()
  802. fak_stance_off()
  803. ###################
  804. #trick definitions#
  805. ###################
  806. def jump():
  807. #print("jump funct")
  808. jump_timer = own['jump_timer']
  809. reg_manual_off()
  810. fak_manual_off()
  811. reg_nmanual_off()
  812. fak_nmanual_off()
  813. cont.deactivate(wallrideconstL)
  814. cont.deactivate(wallrideconstR)
  815. if JUMPSTRENGTH != 0:
  816. height = JUMPSTRENGTH * JUMPHEIGHT
  817. else:
  818. height = JUMPHEIGHT
  819. #if jump_timer == 0:
  820. if jump_timer < 50:
  821. jump_timer = 60
  822. own['jump_timer'] = jump_timer
  823. if zvel < 7 and jump_timer == 60:
  824. cont.activate(own.actuators["pop"])
  825. own['pop_sound'] = 1
  826. print("jump")
  827. #
  828. posx = own.worldPosition[0]
  829. posy = own.worldPosition[1]
  830. posz = own.worldPosition[2]
  831. jumppos = Vector((posx, posy, posz))
  832. own['jumpPos'] = jumppos
  833. force = [ 0.0, 0.0, height]
  834. # use local axis
  835. local = False
  836. # apply force
  837. try:
  838. if 'trans' in r_ground.hitObject:
  839. print('jump from trans')
  840. own['jump_from_trans'] = 1
  841. own['trans_jump_obj'] = r_ground.hitObject
  842. except:
  843. print('trans jump broke')
  844. if grindHit == False:
  845. own.applyForce(force, local)
  846. force2 = [0.0, 0, 150]
  847. own.applyForce(force2, True)
  848. #print("apply jump force1")
  849. if grindHit == True:
  850. linvelloc = own.getLinearVelocity(True)
  851. own.applyForce(force, True)
  852. force2 = [0.0, 0, 150]
  853. own.applyForce(force2, True)
  854. linvelloc2 = own.getLinearVelocity(True)
  855. force = (linvelloc.x, linvelloc.y, linvelloc2.z)
  856. own.setLinearVelocity(force, True)
  857. #print("apply jump force2 grindHit")
  858. own['jump_stance'] = STANCE
  859. if STANCE == True:
  860. own["jump_stance"] = 1
  861. if STANCE == False:
  862. own["jump_stance"] = 0
  863. #own["jump_stance"] = own["stance"]
  864. if grindHit == True:
  865. own['grind_jump'] = 1
  866. if lLR > turnsens or lLR < -turnsens or lUD > turnsens or lUD < -turnsens:
  867. own['grindjumpturn'] = True
  868. #print("turn on grindjumpturn")
  869. num = 1
  870. if num ==1:
  871. rString = "R"
  872. lString = "L"
  873. cont.deactivate(wallrideconstL)
  874. cont.deactivate(wallrideconstR)
  875. #print("deactivating constraints")
  876. if own["wallride"] == "R":
  877. force = [0,170,0]
  878. own.applyForce(force, True)
  879. print("****walljumpforce R")
  880. cont.activate(own.actuators["pop2"])
  881. jump_timer = 60
  882. own['jump_timer'] = jump_timer
  883. if own["wallride"] == "L":
  884. force = [0,-170,0] #325
  885. own.applyForce(force, True)
  886. print("****walljumpforce L")
  887. cont.activate(own.actuators["pop2"])
  888. jump_timer = 60
  889. own['jump_timer'] = jump_timer
  890. own["Q1oncd"] = 0
  891. own["Q2oncd"] = 0
  892. own["Q3oncd"] = 0
  893. own["Q4oncd"] = 0
  894. own["Q5oncd"] = 0
  895. own["Q6oncd"] = 0
  896. own["Q7oncd"] = 0
  897. own["Q8oncd"] = 0
  898. if own['jump_timer'] == 60:
  899. own['jump_timer'] = 59
  900. def jump_Timer():
  901. jump_timer = own['jump_timer']
  902. if jump_timer > 0:
  903. jump_timer = jump_timer - 1
  904. own['jump_timer'] = jump_timer
  905. if own['grindjumpturn'] == True:
  906. jump_timer = 30
  907. own['jump_timer'] = jump_timer
  908. def pump():
  909. velocity = own['velocity']
  910. #regular
  911. local = True
  912. downforce = -.1
  913. if linVelocity.x < MAX_VEL and linVelocity.x >= -0 and STANCE == 1 and grindHit == False:
  914. countdown = COUNTDOWN
  915. yvel = linVelocity.x + SPEEDPUMP
  916. yvel2 = linVelocity.x + SPEEDPUMPFAST
  917. own['countdown'] = countdown
  918. force = [(yvel), 0, linVelocity.z + downforce]
  919. force2 = [(yvel2), 0, linVelocity.z + downforce]
  920. if rot.z < PUMP_SENS and rot.z > PUMP_SPEED_SENS:
  921. own.setLinearVelocity(force, local)
  922. if rot.z < PUMP_SENS and rot.z <= PUMP_SPEED_SENS:
  923. own.setLinearVelocity(force2, local)
  924. own['requestAction'] = 'fak_pump'
  925. #switch
  926. if linVelocity.x > -MAX_VEL and linVelocity.x <= 0 and STANCE == 0 and grindHit == False:
  927. countdown = COUNTDOWN
  928. yvel = linVelocity.x - SPEEDPUMP
  929. yvel2 = linVelocity.x - SPEEDPUMPFAST
  930. own['countdown'] = countdown
  931. force = [(yvel), 0, linVelocity.z + downforce]
  932. force2 = [(yvel2), 0, linVelocity.z + downforce]
  933. if rot.z < PUMP_SENS and rot.z > PUMP_SPEED_SENS:
  934. own.setLinearVelocity(force, local)
  935. if rot.z < PUMP_SENS and rot.z <= PUMP_SPEED_SENS:
  936. own.setLinearVelocity(force2, local)
  937. own['requestAction'] = 'reg_pump'
  938. own["Pump"] = True
  939. own["lastPump"] = True
  940. def roll():
  941. if r_ground.triggered == 1:
  942. pass
  943. def stop():
  944. if linVelocity.x < .05 and linVelocity.x > -.05:
  945. can_stop = 0
  946. own["lastStop"] = True
  947. else:
  948. can_stop = 1
  949. if r_ground.triggered == 1 and STANCE == False and can_stop == 1:
  950. own['requestAction'] = 'reg_stop'
  951. yvel = linVelocity.x * .985
  952. force = [(yvel), 0, linVelocity.z]
  953. own.setLinearVelocity(force, True)
  954. elif r_ground.triggered == 1 and STANCE == True and can_stop == 1:
  955. own['requestAction'] = 'fak_stop'
  956. yvel = linVelocity.x * .985
  957. force = [(yvel), 0, linVelocity.z]
  958. own.setLinearVelocity(force, True)
  959. if linVelocity.x < .05 and linVelocity.x > -.05 and own["lastStop"] == True:
  960. own["lastStop"] == False
  961. def oposin():
  962. if skater.isPlayingAction(30) or skater.isPlayingAction(31):
  963. landing = 1
  964. else:
  965. landing = 0
  966. if (r_ground.triggered == 1) and STANCE == False and landing == 0 and own['manual'] == 0:
  967. if grindold == 0:
  968. own['requestAction'] = 'reg_opos'
  969. elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
  970. if grindold == 0:
  971. own['requestAction'] = 'fak_opos'
  972. else:
  973. killact(65)
  974. killact(66)
  975. killact(67)
  976. killact(68)
  977. own["last_Opos"] = True
  978. def noposin():
  979. if skater.isPlayingAction(30) or skater.isPlayingAction(31):
  980. landing = 1
  981. else:
  982. landing = 0
  983. if (r_ground.triggered == 1) and STANCE == False and landing == 0 and own['manual'] == 0:
  984. if grindold == 0:
  985. own['requestAction'] = 'reg_nopos'
  986. elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
  987. if grindold == 0:
  988. own['requestAction'] = 'fak_nopos'
  989. else:
  990. killact(71)
  991. killact(72)
  992. killact(73)
  993. killact(74)
  994. own["last_nOpos"] = True
  995. def aollie():
  996. print("ollie")
  997. dict['trick_string'] = 'Ollie'
  998. r_ground = cont.sensors["r_Ground"]
  999. trigger = r_ground.triggered
  1000. STANCE = own["stance"]
  1001. wallride = own["wallride"]
  1002. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1003. own["wallride_off"] = 1
  1004. own['requestAction'] = 'reg_ollie'
  1005. jump()
  1006. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1007. own["wallride_off"] = 1
  1008. own['requestAction'] = 'fak_ollie'
  1009. jump()
  1010. def nollie():
  1011. print("nollie")
  1012. dict['trick_string'] = 'Nollie'
  1013. r_ground = cont.sensors["r_Ground"]
  1014. trigger = r_ground.triggered
  1015. STANCE = own["stance"]
  1016. if (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1017. own['requestAction'] = 'fak_nollie'
  1018. own["wallride_off"] = 1
  1019. jump()
  1020. elif (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1021. own["wallride_off"] = 1
  1022. own['requestAction'] = 'reg_nollie'
  1023. jump()
  1024. def kickflip():
  1025. print("kickflip")
  1026. dict['trick_string'] = 'Kickflip'
  1027. STANCE = own["stance"]
  1028. print(flip_start_lay)
  1029. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1030. own["wallride_off"] = 1
  1031. own['requestAction'] = 'reg_kickflip'
  1032. jump()
  1033. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1034. own["wallride_off"] = 1
  1035. own['requestAction'] = 'fak_kickflip'
  1036. jump()
  1037. if own["wallride"] !=1: jump()
  1038. if r_ground.triggered == 0 and STANCE == False:
  1039. own["wallride_off"] = 1
  1040. own['requestAction'] = 'reg_kickflip'
  1041. if own["wallride"] != None:
  1042. jump()
  1043. elif r_ground.triggered == 0 and STANCE == True:
  1044. own["wallride_off"] = 1
  1045. own['requestAction'] = 'fak_kickflip'
  1046. if own["wallride"] != None:
  1047. jump()
  1048. def varial_kickflip():
  1049. print("varial kickflip")
  1050. dict['trick_string'] = 'Varial Kickflip'
  1051. STANCE = own["stance"]
  1052. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1053. own["wallride_off"] = 1
  1054. own['requestAction'] = 'reg_varial_kickflip'
  1055. jump()
  1056. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1057. own["wallride_off"] = 1
  1058. own['requestAction'] = 'fak_varial_kickflip'
  1059. jump()
  1060. if r_ground.triggered == 0 and STANCE == False:
  1061. own["wallride_off"] = 1
  1062. if own["wallride"] != None:
  1063. jump()
  1064. elif r_ground.triggered == 0 and STANCE == True:
  1065. own["wallride_off"] = 1
  1066. if own["wallride"] != None:
  1067. jump()
  1068. def nollie_varial_kickflip():
  1069. print("nollie varial kickflip")
  1070. dict['trick_string'] = 'Nollie Varial Kickflip'
  1071. STANCE = own["stance"]
  1072. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1073. own["wallride_off"] = 1
  1074. own['requestAction'] = 'reg_nollie_varial_kickflip'
  1075. jump()
  1076. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1077. own["wallride_off"] = 1
  1078. own['requestAction'] = 'fak_nollie_varial_kickflip'
  1079. jump()
  1080. if r_ground.triggered == 0 and STANCE == False:
  1081. own["wallride_off"] = 1
  1082. if own["wallride"] != None:
  1083. jump()
  1084. elif r_ground.triggered == 0 and STANCE == True:
  1085. own["wallride_off"] = 1
  1086. if own["wallride"] != None:
  1087. jump()
  1088. def nollie_varial_heelflip():
  1089. print("nollie varial heelflip")
  1090. dict['trick_string'] = 'Nollie Varial Heelflip'
  1091. STANCE = own["stance"]
  1092. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1093. own["wallride_off"] = 1
  1094. own['requestAction'] = 'reg_nollie_varial_heelflip'
  1095. jump()
  1096. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1097. own["wallride_off"] = 1
  1098. own['requestAction'] = 'fak_nollie_varial_heelflip'
  1099. jump()
  1100. if r_ground.triggered == 0 and STANCE == False:
  1101. own["wallride_off"] = 1
  1102. if own["wallride"] != None:
  1103. jump()
  1104. elif r_ground.triggered == 0 and STANCE == True:
  1105. own["wallride_off"] = 1
  1106. if own["wallride"] != None:
  1107. jump()
  1108. def varial_heelflip():
  1109. print("varial heelflip")
  1110. dict['trick_string'] = 'Varial Heelflip'
  1111. STANCE = own["stance"]
  1112. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1113. own["wallride_off"] = 1
  1114. own['requestAction'] = 'reg_varial_heelflip'
  1115. jump()
  1116. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1117. own["wallride_off"] = 1
  1118. own['requestAction'] = 'fak_varial_heelflip'
  1119. jump()
  1120. if r_ground.triggered == 0 and STANCE == False:
  1121. own["wallride_off"] = 1
  1122. if own["wallride"] != None:
  1123. jump()
  1124. elif r_ground.triggered == 0 and STANCE == True:
  1125. own["wallride_off"] = 1
  1126. if own["wallride"] != None:
  1127. jump()
  1128. def nollie_kickflip():
  1129. print("kickflip")
  1130. STANCE = own["stance"]
  1131. dict['trick_string'] = 'Nollie Kickflip'
  1132. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1133. own["wallride_off"] = 1
  1134. own['requestAction'] = 'reg_nollie_kickflip'
  1135. jump()
  1136. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1137. own["wallride_off"] = 1
  1138. own['requestAction'] = 'fak_nollie_kickflip'
  1139. jump()
  1140. if r_ground.triggered == 0 and STANCE == False:
  1141. own["wallride_off"] = 1
  1142. if own["wallride"] != None:
  1143. print("wall out trick")
  1144. #jump()
  1145. elif r_ground.triggered == 0 and STANCE == True:
  1146. own["wallride_off"] = 1
  1147. if own["wallride"] != None:
  1148. print("wall out trick")
  1149. #jump()
  1150. def heelflip():
  1151. print("heelflip")
  1152. dict['trick_string'] = 'Heelflip'
  1153. STANCE = own["stance"]
  1154. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1155. own["wallride_off"] = 1
  1156. own['requestAction'] = 'reg_heelflip'
  1157. jump()
  1158. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1159. own["wallride_off"] = 1
  1160. own['requestAction'] = 'fak_heelflip'
  1161. jump()
  1162. if r_ground.triggered == 0 and STANCE == False:
  1163. own["wallride_off"] = 1
  1164. if own["wallride"] != None:
  1165. print("wall out trick")
  1166. #jump()
  1167. elif r_ground.triggered == 0 and STANCE == True:
  1168. own["wallride_off"] = 1
  1169. if own["wallride"] != None:
  1170. print("wall out trick")
  1171. #jump()
  1172. def nollie_heelflip():
  1173. print("heelflip")
  1174. dict['trick_string'] = 'Nollie Heelflip'
  1175. STANCE = own["stance"]
  1176. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1177. own["wallride_off"] = 1
  1178. own['requestAction'] = 'reg_nollie_heelflip'
  1179. jump()
  1180. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1181. own["wallride_off"] = 1
  1182. own['requestAction'] = 'fak_nollie_heelflip'
  1183. jump()
  1184. if r_ground.triggered == 0 and STANCE == False:
  1185. own["wallride_off"] = 1
  1186. if own["wallride"] != None:
  1187. jump()
  1188. elif r_ground.triggered == 0 and STANCE == True:
  1189. own["wallride_off"] = 1
  1190. if own["wallride"] != None:
  1191. jump()
  1192. def shovit():
  1193. print("shovit")
  1194. dict['trick_string'] = 'Shovit'
  1195. STANCE = own["stance"]
  1196. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1197. own["wallride_off"] = 1
  1198. own['requestAction'] = 'reg_shovit'
  1199. jump()
  1200. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1201. own["wallride_off"] = 1
  1202. own['requestAction'] = 'fak_shovit'
  1203. jump()
  1204. if r_ground.triggered == 0 and STANCE == False:
  1205. if own["wallride"] != None:
  1206. jump()
  1207. elif r_ground.triggered == 0 and STANCE == True:
  1208. own["wallride_off"] = 1
  1209. if own["wallride"] != None:
  1210. jump()
  1211. def shovit360():
  1212. print("360shovit")
  1213. dict['trick_string'] = '360 Shovit'
  1214. STANCE = own["stance"]
  1215. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1216. own["wallride_off"] = 1
  1217. own['requestAction'] = 'reg_shovit360'
  1218. jump()
  1219. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1220. own["wallride_off"] = 1
  1221. own['requestAction'] = 'fak_shovit360'
  1222. jump()
  1223. if r_ground.triggered == 0 and STANCE == False:
  1224. own["wallride_off"] = 1
  1225. if own["wallride"] != None:
  1226. jump()
  1227. elif r_ground.triggered == 0 and STANCE == True:
  1228. own["wallride_off"] = 1
  1229. if own["wallride"] != None:
  1230. jump()
  1231. def fsshovit360():
  1232. print("360shovit")
  1233. dict['trick_string'] = '360 Shovit'
  1234. STANCE = own["stance"]
  1235. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1236. own["wallride_off"] = 1
  1237. own['requestAction'] = 'reg_fsshovit360'
  1238. jump()
  1239. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1240. own["wallride_off"] = 1
  1241. own['requestAction'] = 'fak_fsshovit360'
  1242. jump()
  1243. if r_ground.triggered == 0 and STANCE == False:
  1244. own["wallride_off"] = 1
  1245. if own["wallride"] != None:
  1246. jump()
  1247. elif r_ground.triggered == 0 and STANCE == True:
  1248. own["wallride_off"] = 1
  1249. if own["wallride"] != None:
  1250. jump()
  1251. def nollie_shovit():
  1252. print("shovit")
  1253. dict['trick_string'] = 'Nollie Shovit'
  1254. STANCE = own["stance"]
  1255. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1256. own["wallride_off"] = 1
  1257. own['requestAction'] = 'reg_nollie_shovit'
  1258. jump()
  1259. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1260. own["wallride_off"] = 1
  1261. own['requestAction'] = 'fak_nollie_shovit'
  1262. jump()
  1263. if r_ground.triggered == 0 and STANCE == False:
  1264. own["wallride_off"] = 1
  1265. if own["wallride"] != None:
  1266. jump()
  1267. elif r_ground.triggered == 0 and STANCE == True:
  1268. own["wallride_off"] = 1
  1269. if own["wallride"] != None:
  1270. jump()
  1271. def fsshovit():
  1272. dict['trick_string'] = 'Frontside Shovit'
  1273. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1274. own["wallride_off"] = 1
  1275. own['requestAction'] = 'reg_fsshovit'
  1276. jump()
  1277. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1278. own["wallride_off"] = 1
  1279. own['requestAction'] = 'fak_fsshovit'
  1280. jump()
  1281. if r_ground.triggered == 0 and STANCE == False:
  1282. own["wallride_off"] = 1
  1283. if own["wallride"] != None:
  1284. jump()
  1285. elif r_ground.triggered == 0 and STANCE == True:
  1286. own["wallride_off"] = 1
  1287. if own["wallride"] != None:
  1288. jump()
  1289. def nollie_fsshovit():
  1290. dict['trick_string'] = 'Nollie Frontside Shovit'
  1291. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1292. own["wallride_off"] = 1
  1293. own['requestAction'] = 'reg_nollie_fsshovit'
  1294. jump()
  1295. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1296. own["wallride_off"] = 1
  1297. own['requestAction'] = 'fak_nollie_fsshovit'
  1298. jump()
  1299. if r_ground.triggered == 0 and STANCE == False:
  1300. own["wallride_off"] = 1
  1301. if own["wallride"] != None:
  1302. jump()
  1303. elif r_ground.triggered == 0 and STANCE == True:
  1304. own["wallride_off"] = 1
  1305. if own["wallride"] != None:
  1306. jump()
  1307. #nollie_shovit360()
  1308. def nollie_shovit360():
  1309. dict['trick_string'] = 'Nollie Frontside Shovit 360'
  1310. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1311. own["wallride_off"] = 1
  1312. own['requestAction'] = 'reg_nollie_shovit360'
  1313. jump()
  1314. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1315. own["wallride_off"] = 1
  1316. own['requestAction'] = 'fak_nollie_shovit360'
  1317. jump()
  1318. if r_ground.triggered == 0 and STANCE == False:
  1319. own["wallride_off"] = 1
  1320. if own["wallride"] != None:
  1321. jump()
  1322. elif r_ground.triggered == 0 and STANCE == True:
  1323. own["wallride_off"] = 1
  1324. if own["wallride"] != None:
  1325. jump()
  1326. #nollie_fsshovit360()
  1327. def nollie_fsshovit360():
  1328. dict['trick_string'] = 'Nollie Frontside Shovit'
  1329. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1330. own["wallride_off"] = 1
  1331. own['requestAction'] = 'reg_nollie_fsshovit'
  1332. jump()
  1333. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1334. own["wallride_off"] = 1
  1335. own['requestAction'] = 'fak_nollie_fsshovit'
  1336. jump()
  1337. if r_ground.triggered == 0 and STANCE == False:
  1338. own["wallride_off"] = 1
  1339. if own["wallride"] != None:
  1340. jump()
  1341. elif r_ground.triggered == 0 and STANCE == True:
  1342. own["wallride_off"] = 1
  1343. if own["wallride"] != None:
  1344. jump()
  1345. def frontside_grab_on():
  1346. GRAB_PLAYED = own["GRAB_PLAYED"]
  1347. GRAB_ON = own["GRAB_ON"]
  1348. dict['trick_string'] = 'Mute Grab'
  1349. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1350. own['requestAction'] = 'frontside_grab'
  1351. #skater.playAction("reg_fg", 10,30, layer=400, priority=5, play_mode=1, speed=.5)
  1352. grablay2 = grablay + 1
  1353. GRAB_PLAYED = True
  1354. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1355. elif r_ground.triggered == 1:
  1356. killact(400)
  1357. killact(401)
  1358. def backside_grab_on():
  1359. GRAB_PLAYED = own["GRAB_PLAYED"]
  1360. GRAB_ON = own["GRAB_ON"]
  1361. if GRAB_ON == True and r_ground.triggered == 0 and aBut == True:
  1362. skater.playAction("reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1363. deck.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1364. trucks.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1365. elif GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1366. own['requestAction'] = 'backside_grab'
  1367. GRAB_PLAYED = True
  1368. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1369. elif r_ground.triggered == 1:
  1370. killact(402)
  1371. def fakfrontside_grab_on():
  1372. GRAB_PLAYED = own["GRAB_PLAYED"]
  1373. GRAB_ON = own["GRAB_ON"]
  1374. if GRAB_ON == True and r_ground.triggered == 0 and aBut == True:
  1375. skater.playAction("fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1376. deck.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1377. trucks.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  1378. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1379. own['requestAction'] = 'fak_frontside_grab'
  1380. GRAB_PLAYED = True
  1381. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1382. elif r_ground.triggered == 1:
  1383. killact(403)
  1384. def fakbackside_grab_on():
  1385. GRAB_PLAYED = own["GRAB_PLAYED"]
  1386. GRAB_ON = own["GRAB_ON"]
  1387. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1388. own['requestAction'] = 'fak_backside_grab'
  1389. GRAB_PLAYED = True
  1390. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1391. elif r_ground.triggered == 1:
  1392. killact(404)
  1393. #nose/tail grabs
  1394. def frontside_nose_grab_on():
  1395. GRAB_PLAYED = own["GRAB_PLAYED"]
  1396. GRAB_ON = own["GRAB_ON"]
  1397. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1398. own['requestAction'] = 'frontside_nose_grab'
  1399. GRAB_PLAYED = True
  1400. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1401. elif r_ground.triggered == 1:
  1402. killact(400)
  1403. print("frontside nosegrab on")
  1404. def frontside_tail_grab_on():
  1405. GRAB_PLAYED = own["GRAB_PLAYED"]
  1406. GRAB_ON = own["GRAB_ON"]
  1407. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1408. own['requestAction'] = 'frontside_tail_grab'
  1409. GRAB_PLAYED = True
  1410. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1411. elif r_ground.triggered == 1:
  1412. killact(400)
  1413. print("frontside tailgrab on")
  1414. def backside_nose_grab_on():
  1415. GRAB_PLAYED = own["GRAB_PLAYED"]
  1416. GRAB_ON = own["GRAB_ON"]
  1417. #airwalk
  1418. if GRAB_ON == True and r_ground.triggered == 0 and (aBut == True):
  1419. print("airwalk")
  1420. skater.playAction("reg_airwalk", 10,30, layer=405, priority=5, blendin=5, play_mode=1, speed=.5)
  1421. deck.playAction("a_reg_airwalk", 10,30, layer=405, priority=5, blendin=5, play_mode=1, speed=.5)
  1422. trucks.playAction("a_reg_airwalk", 10,30, layer=405, priority=5, blendin=5, play_mode=1, speed=.5)
  1423. #norm
  1424. elif GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1425. own['requestAction'] = 'backside_nose_grab'
  1426. GRAB_PLAYED = True
  1427. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1428. elif r_ground.triggered == 1:
  1429. killact(405)
  1430. print("backside nosegrab on")
  1431. def backside_tail_grab_on():
  1432. GRAB_PLAYED = own["GRAB_PLAYED"]
  1433. GRAB_ON = own["GRAB_ON"]
  1434. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1435. own['requestAction'] = 'backside_tail_grab'
  1436. GRAB_PLAYED = True
  1437. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1438. elif r_ground.triggered == 1:
  1439. killact(411)
  1440. print("backside tailgrab on")
  1441. #switch
  1442. def fak_frontside_nose_grab_on():
  1443. GRAB_PLAYED = own["GRAB_PLAYED"]
  1444. GRAB_ON = own["GRAB_ON"]
  1445. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1446. own['requestAction'] = 'fak_frontside_nose_grab'
  1447. GRAB_PLAYED = True
  1448. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1449. elif r_ground.triggered == 1:
  1450. killact(406)
  1451. print("fak frontside nosegrab on")
  1452. def fak_frontside_tail_grab_on():
  1453. GRAB_PLAYED = own["GRAB_PLAYED"]
  1454. GRAB_ON = own["GRAB_ON"]
  1455. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1456. own['requestAction'] = 'fak_frontside_tail_grab'
  1457. GRAB_PLAYED = True
  1458. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1459. elif r_ground.triggered == 1:
  1460. killact(412)
  1461. print("fak frontside tailgrab on")
  1462. def fak_backside_nose_grab_on():
  1463. GRAB_PLAYED = own["GRAB_PLAYED"]
  1464. GRAB_ON = own["GRAB_ON"]
  1465. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1466. own['requestAction'] = 'fak_backside_nose_grab'
  1467. GRAB_PLAYED = True
  1468. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1469. elif r_ground.triggered == 1:
  1470. killact(408)
  1471. print("fak backside nosegrab on")
  1472. def fak_backside_tail_grab_on():
  1473. GRAB_PLAYED = own["GRAB_PLAYED"]
  1474. GRAB_ON = own["GRAB_ON"]
  1475. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1476. #cont.activate(fak_backsidegrab)
  1477. own['requestAction'] = 'fak_backside_tail_grab'
  1478. GRAB_PLAYED = True
  1479. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1480. elif r_ground.triggered == 1:
  1481. killact(410)
  1482. print("fak backside tailgrab on")
  1483. #--------------------
  1484. def SWAG():
  1485. if r_ground.triggered == 1:
  1486. SWAG = own["swag"]
  1487. SWAG = own.getLinearVelocity(True)
  1488. SWAG = SWAG[1]
  1489. own["swag"] = SWAG
  1490. #print(SWAG)
  1491. if STANCE == True:
  1492. if SWAG > 1 and SWAG < 2:
  1493. rotation = [ 0.0, 0, (SWAG / 200)]
  1494. own.applyRotation( rotation, True)
  1495. elif SWAG > 2:
  1496. rotation = [ 0.0, 0, (SWAG / 50)]
  1497. own.applyRotation( rotation, True)
  1498. elif SWAG < -1 and SWAG > -2:
  1499. rotation = [ 0.0, 0, (SWAG / 200)]
  1500. own.applyRotation( rotation, True)
  1501. elif SWAG < -2:
  1502. rotation = [ 0.0, 0, (SWAG / 50)]
  1503. own.applyRotation( rotation, True)
  1504. if STANCE == False:
  1505. if SWAG > 1 and SWAG < 2:
  1506. rotation = [ 0.0, 0, (-SWAG / 200)]
  1507. own.applyRotation( rotation, True)
  1508. elif SWAG > 2:
  1509. rotation = [ 0.0, 0, (-SWAG / 50)]
  1510. own.applyRotation( rotation, True)
  1511. elif SWAG < -1 and SWAG > -2:
  1512. rotation = [ 0.0, 0, (-SWAG / 200)]
  1513. own.applyRotation( rotation, True)
  1514. elif SWAG < -2:
  1515. rotation = [ 0.0, 0, (-SWAG / 50)]
  1516. own.applyRotation( rotation, True)
  1517. def air():
  1518. if r_ground.triggered == False and own['airup'] == 0:
  1519. distance = own.getDistanceTo(gray.hitPosition)
  1520. since_grind_buf = 3
  1521. if gray.hitObject != None and grindDar2.triggered == False and (frame - lgf) > since_grind_buf:
  1522. if distance < .5:
  1523. own.alignAxisToVect(gray.hitNormal, 2, .1)
  1524. elif distance >= .5 and distance < 1.75:
  1525. own.alignAxisToVect(gray.hitNormal, 2, .05)
  1526. elif distance >= 1.75:
  1527. own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
  1528. if grindDar2.triggered and (frame - lgf) > since_grind_buf:
  1529. if distance < .5:
  1530. own.alignAxisToVect(gray.hitNormal, 2, .1)
  1531. elif distance >= .5 and distance < 1.75:
  1532. own.alignAxisToVect(gray.hitNormal, 2, .03)
  1533. elif distance >= 1.75:
  1534. own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
  1535. elif r_ground.triggered == True:
  1536. pass
  1537. def stopAnims():
  1538. pass
  1539. def isplaying():
  1540. # for x in range(9000):
  1541. # l1 = deck.isPlayingAction(x)
  1542. # if l1 == True:
  1543. # print(x)
  1544. pass
  1545. def nextframe():
  1546. framenumber = own["framenum"]
  1547. framenumber = framenumber + 1
  1548. if framenumber == 900000:
  1549. framenumber = 0
  1550. own["framenum"] = framenumber
  1551. #print(framenumber)
  1552. def push():
  1553. local = True
  1554. #print("push")
  1555. linVelocity15 = own.linearVelocity
  1556. if linVelocity15.x < MAX_VEL and linVelocity15.x >= -0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0 and own['last_footplant'] == False:
  1557. countdown = COUNTDOWN
  1558. yvel = linVelocity15.x + SPEEDUP
  1559. own['countdown'] = countdown
  1560. force = [(yvel), 0, linVelocity15.z]
  1561. own.setLinearVelocity(force, local)
  1562. own['requestAction'] = 'fak_push_goof'
  1563. #switch
  1564. if linVelocity15.x > -MAX_VEL and linVelocity15.x < 0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1565. countdown = COUNTDOWN
  1566. yvel = linVelocity15.x - SPEEDUP
  1567. own['countdown'] = countdown
  1568. force = [(yvel), 0, linVelocity15.z]
  1569. own.setLinearVelocity(force, local)
  1570. own['requestAction'] = 'reg_push'
  1571. def push_goof():
  1572. linVelocity15 = own.linearVelocity
  1573. local = True
  1574. #print("push goof")
  1575. if linVelocity15.x < MAX_VEL and linVelocity15.x >= -0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1576. countdown = COUNTDOWN
  1577. yvel = linVelocity15.x + SPEEDUP
  1578. own['countdown'] = countdown
  1579. force = [(yvel), 0, linVelocity15.z]
  1580. own.setLinearVelocity(force, local)
  1581. own['requestAction'] = 'fak_push'
  1582. #switch
  1583. if linVelocity15.x > -MAX_VEL and linVelocity15.x < 0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1584. countdown = COUNTDOWN
  1585. yvel = linVelocity15.x - SPEEDUP
  1586. own['countdown'] = countdown
  1587. force = [(yvel), 0, linVelocity15.z]
  1588. own.setLinearVelocity(force, local)
  1589. own['requestAction'] = 'reg_push_goof'
  1590. def brfoot():
  1591. lay = grablay + 40
  1592. if STANCE == 0:
  1593. own['requestAction'] = 'reg_brfoot'
  1594. # skater.playAction("brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1595. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1596. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1597. if STANCE == 1:
  1598. own['requestAction'] = 'fak_brfoot'
  1599. # skater.playAction("fak_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1600. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1601. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1602. jump()
  1603. def frfoot():
  1604. lay = grablay + 40
  1605. killact(5)
  1606. if STANCE == 0:
  1607. own['requestAction'] = 'reg_frfoot'
  1608. # skater.playAction("frfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1609. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1610. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1611. if STANCE == 1:
  1612. own['requestAction'] = 'fak_frfoot'
  1613. # skater.playAction("fakbfrfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1614. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1615. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1616. jump()
  1617. def blfoot():
  1618. lay = grablay + 40
  1619. killact(5)
  1620. if STANCE == 0:
  1621. own['requestAction'] = 'reg_blfoot'
  1622. # skater.playAction("blfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1623. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1624. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1625. if STANCE == 1:
  1626. own['requestAction'] = 'fak_blfoot'
  1627. # skater.playAction("fakfrfoot.001", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1628. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1629. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1630. jump()
  1631. def flfoot():
  1632. lay = grablay + 40
  1633. killact(5)
  1634. if STANCE == 0:
  1635. own['requestAction'] = 'reg_flfoot'
  1636. # skater.playAction("flfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1637. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1638. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1639. if STANCE == 1:
  1640. own['requestAction'] = 'fak_flfoot'
  1641. # own['reuqestAction'] = 'fak_flfoot'
  1642. # skater.playAction("fak_flfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1643. # deck.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1644. # trucks.playAction("a_brfoot", 1, 30, layer=lay, blendin=2, play_mode=0, speed=CAVEMAN_SPEED)
  1645. jump()
  1646. def rollsound():
  1647. #onground
  1648. if r_ground.triggered == 1 and grindDar == 0 and own['invert_on'] == 0:
  1649. num1 = .05
  1650. num2 = .25
  1651. if linVelocity.x <= -num1 and linVelocity.x >= num1:
  1652. own.actuators["sroll"].volume = .0001
  1653. cont.deactivate(own.actuators["sroll"])
  1654. own.actuators["sroll"].stopSound()
  1655. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1656. own.actuators["sroll"].volume = .02
  1657. own.actuators["sroll"].pitch = .65
  1658. num1 = .25
  1659. num2 = .5
  1660. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1661. own.actuators["sroll"].volume = .03
  1662. own.actuators["sroll"].pitch = .7
  1663. num1 = .5
  1664. num2 = .75
  1665. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1666. own.actuators["sroll"].volume = .04
  1667. own.actuators["sroll"].pitch = .75
  1668. num1 = .75
  1669. num2 = 1
  1670. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1671. own.actuators["sroll"].volume = .05
  1672. own.actuators["sroll"].pitch = .8
  1673. num1 = 1
  1674. num2 = 1.5
  1675. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1676. own.actuators["sroll"].volume = .06
  1677. own.actuators["sroll"].pitch = .85
  1678. num1 = 1.5
  1679. num2 = 2
  1680. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1681. own.actuators["sroll"].volume = .07
  1682. own.actuators["sroll"].pitch = .9
  1683. num1 = 2
  1684. num2 = 3
  1685. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1686. own.actuators["sroll"].volume = .08
  1687. own.actuators["sroll"].pitch = .95
  1688. num1 = 3
  1689. num2 = 4
  1690. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1691. own.actuators["sroll"].volume = .09
  1692. own.actuators["sroll"].pitch = 1
  1693. num1 = 4
  1694. num2 = 5
  1695. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1696. own.actuators["sroll"].volume = .11
  1697. own.actuators["sroll"].pitch = 1.05
  1698. num1 = 5
  1699. num2 = 6
  1700. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1701. own.actuators["sroll"].volume = .1
  1702. own.actuators["sroll"].pitch = 1.1
  1703. own.actuators['sroll'].mode = 2
  1704. cont.activate(own.actuators["sroll"])
  1705. if grindDar == 1 or own['invert_on'] == 1:
  1706. own.actuators["sroll"].volume = .0001
  1707. cont.deactivate(own.actuators["sroll"])
  1708. own.actuators["sroll"].stopSound()
  1709. #in air
  1710. if r_ground.triggered == False:
  1711. own.actuators["sroll"].volume = .0001
  1712. cont.deactivate(own.actuators["sroll"])
  1713. own.actuators["sroll"].stopSound()
  1714. act = cont.actuators["sroll"]
  1715. own['sroll_vol'] = act.volume
  1716. own['sroll_pitch'] = act.pitch
  1717. def wheelroll():
  1718. #still
  1719. if linVelocity.x <= -0.05 and linVelocity.x >= 0.05:
  1720. wheel1.stopAction(2)
  1721. wheel2.stopAction(2)
  1722. wheel3.stopAction(2)
  1723. wheel4.stopAction(2)
  1724. #regular
  1725. if linVelocity.x > 0.05 and linVelocity.x < .5:
  1726. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=0, speed=.25)
  1727. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=0, speed=.25)
  1728. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=0, speed=.25)
  1729. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=0, speed=.25)
  1730. if linVelocity.x > 0.5 and linVelocity.x < 1:
  1731. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=1)
  1732. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=1)
  1733. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=1)
  1734. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=1)
  1735. if linVelocity.x > 1 and linVelocity.x < 4:
  1736. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1737. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1738. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1739. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1740. if linVelocity.x > 4:
  1741. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=2)
  1742. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=2)
  1743. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=2)
  1744. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=2)
  1745. #switch
  1746. if linVelocity.x < -0.05 and linVelocity.x > -.5:
  1747. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=0, speed=.25)
  1748. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=0, speed=.25)
  1749. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=0, speed=.25)
  1750. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=0, speed=.25)
  1751. if linVelocity.x < -0.5 and linVelocity.x > -1:
  1752. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=1)
  1753. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=1)
  1754. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=1)
  1755. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=1)
  1756. if linVelocity.x < -1 and linVelocity > -4:
  1757. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1758. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1759. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1760. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1761. if linVelocity.x < -4:
  1762. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=2)
  1763. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=2)
  1764. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=2)
  1765. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=2)
  1766. def transspeed():
  1767. num1 = .1
  1768. num2 = .4
  1769. speed = 20
  1770. def turn():
  1771. rotamt = .02
  1772. linVelocity2 = own.getLinearVelocity(True)
  1773. speed = .002
  1774. manual = 0
  1775. if own['manual_v2'] == 1:
  1776. manual = 1
  1777. if abs(linVelocity.x) < 2:
  1778. speed = .005
  1779. jumpstance = own['jump_stance']
  1780. if lLR > turnsens or lLR < -turnsens:
  1781. own["turn"] = 1
  1782. else:
  1783. own["turn"] = 0
  1784. if lUD > turnsens or lUD < -turnsens:
  1785. own["turnud"] = 1
  1786. else:
  1787. own["turnud"] = 0
  1788. #light
  1789. #if manual and grindhit = true
  1790. if lLR > turnsens and lLR < (turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1791. rotation = [ 0.0, 0.0, (-rotamt)]
  1792. local = False # use world axis
  1793. own.applyRotation( rotation, local)
  1794. if r_ground.triggered == True:
  1795. #print("light turn")
  1796. if STANCE == 0:
  1797. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1798. if STANCE == 1:
  1799. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1800. if lLR < -turnsens and lLR > (turnsens * -1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1801. rotation = [ 0.0, 0.0, rotamt]
  1802. local = False # use world axis
  1803. own.applyRotation( rotation, local)
  1804. if r_ground.triggered == True:
  1805. #print("light turn")
  1806. if STANCE == 0:
  1807. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1808. if STANCE == 1:
  1809. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1810. #medium
  1811. if lLR > (turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1812. #turn left
  1813. if rot.z < .4:
  1814. rotation = [ 0.0, 0.0, (-rotamt * 5)]
  1815. if rot.z < .6 and rot.z > .4:
  1816. rotation = [ 0.0, 0.0, (-rotamt * 2)]
  1817. else:
  1818. rotation = [ 0.0, 0.0, (-rotamt * 1.6)]
  1819. local = True # use world axis
  1820. own.applyRotation( rotation, local)
  1821. if r_ground.triggered == True:
  1822. #print("med turn")
  1823. if STANCE == 0:
  1824. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1825. if STANCE == 1:
  1826. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1827. if lLR < (-turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1828. #turn right
  1829. if rot.z < .4:
  1830. rotation = [ 0.0, 0.0, (rotamt * 5)]
  1831. if rot.z < .6 and rot.z > .4:
  1832. rotation = [ 0.0, 0.0, (rotamt * 2)]
  1833. else:
  1834. rotation = [ 0.0, 0.0, (rotamt * 1.6)]
  1835. local = True # use world axis
  1836. own.applyRotation( rotation, local)
  1837. if r_ground.triggered == True:
  1838. #print("med turn")
  1839. if STANCE == 0:
  1840. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1841. if STANCE == 1:
  1842. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1843. #air
  1844. if r_ground.triggered == False and lLR > turnsens and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
  1845. rotamt = .07
  1846. if STANCE == 0:
  1847. own.applyRotation([0,0,-rotamt], 1)
  1848. if STANCE == 1:
  1849. own.applyRotation([0,0,-rotamt], 1)
  1850. if r_ground.triggered == False and lLR < -turnsens and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
  1851. rotamt = .07
  1852. if STANCE == 0:
  1853. own.applyRotation([0,0,rotamt], 1)
  1854. if STANCE == 1:
  1855. own.applyRotation([0,0,rotamt], 1)
  1856. ###########
  1857. def grindsound():
  1858. dropin = own['dropinTimer']
  1859. lif = own['last_invert_frame']
  1860. if grindSound != None and grindHit == True and own['nogrindsound'] == 0:
  1861. if abs(linVelocity.x) > abs(linVelocity.y):
  1862. vel = linVelocity.x
  1863. elif abs(linVelocity.x) < abs(linVelocity.y):
  1864. vel = linVelocity.y
  1865. else:
  1866. vel = 0
  1867. if grindSound == "rail":
  1868. cont.deactivate(own.actuators['grind_cement'])
  1869. num1 = .000
  1870. num2 = .05
  1871. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1872. own.actuators["grind_rail"].volume = .0001
  1873. own.actuators["grind_rail"].pitch = .6
  1874. num1 = .05
  1875. num2 = .25
  1876. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1877. own.actuators["grind_rail"].volume = .05
  1878. own.actuators["grind_rail"].pitch = .7
  1879. num1 = .25
  1880. num2 = .5
  1881. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1882. own.actuators["grind_rail"].volume = .1
  1883. own.actuators["grind_rail"].pitch = .75
  1884. num1 = .5
  1885. num2 = .75
  1886. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1887. own.actuators["grind_rail"].volume = .14
  1888. own.actuators["grind_rail"].pitch = .8
  1889. num1 = .75
  1890. num2 = 1
  1891. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1892. own.actuators["grind_rail"].volume = .17
  1893. own.actuators["grind_rail"].pitch = .85
  1894. num1 = 1
  1895. num2 = 1.25
  1896. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1897. own.actuators["grind_rail"].volume = .18
  1898. own.actuators["grind_rail"].pitch = .9
  1899. num1 = 1.25
  1900. num2 = 2
  1901. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1902. own.actuators["grind_rail"].volume = .19
  1903. own.actuators["grind_rail"].pitch = .95
  1904. num1 = 2
  1905. num2 = 40
  1906. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1907. own.actuators["grind_rail"].volume = .19
  1908. own.actuators["grind_rail"].pitch = 1
  1909. cont.activate(own.actuators['grind_rail'])
  1910. if grindSound == "concrete":
  1911. #play sound
  1912. cont.deactivate(own.actuators['grind_rail'])
  1913. num1 = .000
  1914. num2 = .05
  1915. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1916. own.actuators["grind_cement"].volume = .01
  1917. own.actuators["grind_cement"].pitch = .6
  1918. num1 = .05
  1919. num2 = .25
  1920. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1921. own.actuators["grind_cement"].volume = .05
  1922. own.actuators["grind_cement"].pitch = .7
  1923. num1 = .25
  1924. num2 = .5
  1925. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1926. own.actuators["grind_cement"].volume = .1
  1927. own.actuators["grind_cement"].pitch = .75
  1928. num1 = .5
  1929. num2 = .75
  1930. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1931. own.actuators["grind_cement"].volume = .14
  1932. own.actuators["grind_cement"].pitch = .8
  1933. num1 = .75
  1934. num2 = 1
  1935. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1936. own.actuators["grind_cement"].volume = .17
  1937. own.actuators["grind_cement"].pitch = .85
  1938. num1 = 1
  1939. num2 = 1.25
  1940. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1941. own.actuators["grind_cement"].volume = .18
  1942. own.actuators["grind_cement"].pitch = .9
  1943. num1 = 1.25
  1944. num2 = 2
  1945. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1946. own.actuators["grind_cement"].volume = .19
  1947. own.actuators["grind_cement"].pitch = .95
  1948. num1 = 2
  1949. num2 = 40
  1950. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1951. own.actuators["grind_cement"].volume = .19
  1952. own.actuators["grind_cement"].pitch = 1
  1953. cont.activate(own.actuators['grind_cement'])
  1954. else:
  1955. cont.deactivate(own.actuators['grind_cement'])
  1956. cont.deactivate(own.actuators['grind_rail'])
  1957. def record_grindsound():
  1958. dropin = own['dropinTimer']
  1959. lif = own['last_invert_frame']
  1960. if grindHit == True and dropin == 0 and own['invert_on'] == 0 and own["LAST_GRIND"] == True and own["nogrindsound"] == 0 and (frame - lif > 13):
  1961. if grindSound == "concrete":
  1962. act = own.actuators["grind_cement"]
  1963. own['grindcement_vol'] = act.volume
  1964. own['grindcement_pitch'] = act.pitch
  1965. elif grindSound == "rail":
  1966. act = own.actuators["grind_rail"]
  1967. own['grindrail_vol'] = act.volume
  1968. own['grindrail_pitch'] = act.pitch
  1969. if own["LAST_GRIND"] == False:
  1970. own['grindcement_vol'] = 0
  1971. own['grindcement_pitch'] = 0
  1972. own['grindrail_vol'] = 0
  1973. own['grindrail_pitch'] = 0
  1974. def grind():
  1975. grindsound()
  1976. STANCE = own["stance"]
  1977. jumpstance = own["jump_stance"]
  1978. lif = frame - own['last_invert_frame']
  1979. if own['LAST_GRIND'] == False and grindHit == True:
  1980. own['grindstartFrame'] = own['framenum']
  1981. #print(own['grindstartFrame'])
  1982. if grindHit == True and own['invert_on'] == 0 and own['footplant_on'] == False and own['manual'] == 0 and lif > 40 and own['dropinTimer'] < 30:
  1983. gblend = 1
  1984. if LAST_GRIND == 0:
  1985. gt = own['grindType']
  1986. tempstance = 3
  1987. if jumpstance != 3:
  1988. tempstance = jumpstance
  1989. else:
  1990. tempstance = STANCE
  1991. grindpos = own['grindpos']
  1992. if grindpos == "reg_5050" and own['grindType'] == "empty":
  1993. own['grindType'] = grindpos
  1994. if own['grindType'] == "empty" and grindpos == 'reg_board':
  1995. if jumpstance == 1:
  1996. own['grindType'] = "fak_bsboard"
  1997. own["stance"] = True
  1998. STANCE = True
  1999. elif jumpstance == 0:
  2000. own['grindType'] = "reg_bsboard"
  2001. own["stance"] = False
  2002. STANCE = False
  2003. elif jumpstance == 3:
  2004. if STANCE == True:
  2005. own['grindType'] = "fak_bsboard"
  2006. else:
  2007. own['grindType'] = "reg_bsboard"
  2008. if STANCE == True:
  2009. if own['grindType'] == "reg_bsboard":
  2010. own['grind_stance'] = 0
  2011. own['requestAction'] = 'reg_bsboard'
  2012. elif own['grindType'] == "fak_bsboard":
  2013. own['grind_stance'] = 1
  2014. own['requestAction'] = 'fak_bsboard'
  2015. elif own['grindType'] == "reg_fsboard":
  2016. own['grind_stance'] = 0
  2017. own['requestAction'] = 'reg_fsboard'
  2018. elif own['grindType'] == "reg_tailg":
  2019. own['requestAction'] = 'reg_tailg'
  2020. elif own['grindType'] == "reg_tailgR":
  2021. own['requestAction'] = 'reg_tailgr'
  2022. elif own['grindType'] == "reg_tailgL":
  2023. own['requestAction'] = 'reg_tailgl'
  2024. elif own['grindType'] == "reg_noseg":
  2025. own['requestAction'] = 'reg_noseg'
  2026. elif own['grindType'] == "reg_nosegR":
  2027. own['requestAction'] = 'reg_nosegr'
  2028. elif own['grindType'] == "reg_nosegL":
  2029. own['requestAction'] = 'reg_nosegl'
  2030. elif own['grindType'] == "fak_noseg":
  2031. own['requestAction'] = 'fak_noseg'
  2032. elif own['grindType'] == "fak_nosegR":
  2033. own['requestAction'] = 'fak_nosegr'
  2034. elif own['grindType'] == "fak_nosegL":
  2035. own['requestAction'] = 'fak_nosegl'
  2036. elif own['grindType'] == "fak_tailg":
  2037. own['requestAction'] = 'fak_tailg'
  2038. elif own['grindType'] == "fak_tailgR":
  2039. own['requestAction'] = 'fak_tailgr'
  2040. elif own['grindType'] == "fak_tailgL":
  2041. own['requestAction'] = 'fak_tailgl'
  2042. elif own['grindType'] == "reg_tailslide":
  2043. own['requestAction'] = 'reg_tailslide'
  2044. own['grind_stance'] = 0
  2045. elif own['grindType'] == "fak_tailslide":
  2046. own['requestAction'] = 'fak_tailslide'
  2047. own['grind_stance'] = 1
  2048. elif own['grindType'] == "reg_noseslide":
  2049. own['requestAction'] = 'reg_noseslide'
  2050. own['grind_stance'] = 0
  2051. elif own['grindType'] == "fak_noseslide":
  2052. own['requestAction'] = 'fak_noseslide'
  2053. own['grind_stance'] = 1
  2054. elif own['grindType'] == "nose_stall":
  2055. own['requestAction'] = 'nose_stall'
  2056. skater.playAction("fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2057. deck.playAction("a_fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2058. trucks.playAction("a_fak_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2059. elif own['grindType'] == "tail_stall":
  2060. own['requestAction'] = 'tail_stall'
  2061. skater.playAction("fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2062. deck.playAction("a_fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2063. trucks.playAction("a_fak_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2064. else:
  2065. if STANCE == 0:
  2066. own['requestAction'] = 'reg_5050'
  2067. if STANCE == 1:
  2068. own['requestAction'] = 'fak_5050'
  2069. #elif STANCE == False and LAST_GRIND == False:
  2070. elif STANCE == False:
  2071. if own['grindType'] == "reg_bsboard":
  2072. own['grind_stance'] = 0
  2073. own['requestAction'] = 'reg_bsboard'
  2074. elif own['grindType'] == "fak_bsboard":
  2075. own['grind_stance'] = 1
  2076. own['requestAction'] = 'fak_bsboard'
  2077. elif own['grindType'] == "reg_tailg":
  2078. own['grind_stance'] = 0
  2079. own['requestAction'] = 'reg_tailg'
  2080. elif own['grindType'] == "reg_tailgR":
  2081. own['requestAction'] = 'reg_tailgr'
  2082. elif own['grindType'] == "reg_tailgL":
  2083. own['requestAction'] = 'reg_tailgl'
  2084. elif own['grindType'] == "reg_noseg":
  2085. own['requestAction'] = 'reg_noseg'
  2086. elif own['grindType'] == "reg_nosegR":
  2087. own['requestAction'] = 'reg_nosegr'
  2088. elif own['grindType'] == "reg_nosegL":
  2089. own['requestAction'] = 'reg_nosegl'
  2090. elif own['grindType'] == "fak_noseg":
  2091. own['requestAction'] = 'fak_noseg'
  2092. elif own['grindType'] == "fak_nosegR":
  2093. own['requestAction'] = 'fak_nosegr'
  2094. elif own['grindType'] == "fak_nosegL":
  2095. own['requestAction'] = 'fak_nosegl'
  2096. elif own['grindType'] == "fak_tailg":
  2097. own['requestAction'] = 'fak_tailg'
  2098. elif own['grindType'] == "fak_tailgR":
  2099. own['requestAction'] = 'fak_tailgr'
  2100. elif own['grindType'] == "fak_tailgL":
  2101. own['requestAction'] = 'fak_tailgl'
  2102. elif own['grindType'] == "reg_tailslide":
  2103. own['requestAction'] = 'reg_tailslide'
  2104. elif own['grindType'] == "fak_tailslide":
  2105. own['grind_stance'] = 1
  2106. own['requestAction'] = 'fak_tailslide'
  2107. elif own['grindType'] == "reg_noseslide":
  2108. own['grind_stance'] = 0
  2109. own['requestAction'] = 'reg_noseslide'
  2110. elif own['grindType'] == "fak_noseslide":
  2111. own['grind_stance'] = 1
  2112. own['requestAction'] = 'fak_noseslide'
  2113. elif own['grindType'] == "nose_stall":
  2114. skater.playAction("nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2115. deck.playAction("a_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2116. trucks.playAction("a_nose_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2117. #print("nose_stall")
  2118. elif own['grindType'] == "tail_stall":
  2119. skater.playAction("reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2120. deck.playAction("a_reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2121. trucks.playAction("a_reg_tail_stall", 1,30, layer=700, blendin=gblend, play_mode=1, speed=.5)
  2122. #print("reg_tail_stall")
  2123. else:
  2124. if STANCE == 0:
  2125. own['requestAction'] = 'reg_5050'
  2126. if STANCE == 1:
  2127. own['requestAction'] = 'fak_5050'
  2128. def rotmult():
  2129. if r_ground.triggered:
  2130. num = ((rot.z * -1) +1)
  2131. num = num * 100
  2132. def airup():
  2133. if r_ground.triggered == False:
  2134. pos = own.worldPosition
  2135. pos = own.worldPosition.z
  2136. last_pos = own['last_posz']
  2137. if last_pos - pos > 0:
  2138. own['airup'] = 0
  2139. if last_pos - pos < 0:
  2140. own['airup'] = 1
  2141. if pos > own['last_posz']:
  2142. own["air_height"] = pos
  2143. own['last_posz'] = pos
  2144. def onramp():
  2145. if r_ground.positive:
  2146. if 'ramp' in r_ground.hitObject:
  2147. own['onramp'] = 1
  2148. else:
  2149. own['onramp'] = 0
  2150. else:
  2151. own['onramp'] = 0
  2152. def grindtype(gtype):
  2153. own['grindType'] = gtype
  2154. def transmult():
  2155. lastrotz = own["rotz"]
  2156. linvel = own.getLinearVelocity(True)
  2157. newx = (linvel.x + (linvel.x * .039))
  2158. if linvel.x < 7 and linvel.x > -7 and rot.z > lastrotz and r_ground.triggered == 1 and rot.z > .3 and rot.z < .93:
  2159. own.setLinearVelocity([newx, linvel.y, linvel.z], True)
  2160. def speedmult():
  2161. vel = own.getLinearVelocity(True)
  2162. xyz = own.worldOrientation.to_euler()
  2163. roty = math.degrees(xyz[1])
  2164. roty = abs(roty)
  2165. roty = roty * .0005
  2166. if abs(vel.x) > 1:
  2167. mult = .0015 + roty
  2168. else:
  2169. mult = .000
  2170. mult2 = .018
  2171. mult3 = .007
  2172. lastrotz = own["rotz"]
  2173. x = vel.x * mult
  2174. x2 = x + vel.x
  2175. x3 = vel.x * mult2
  2176. x4 = x3 + vel.x
  2177. x5 = vel.x * mult3
  2178. x6 = x5 + vel.x
  2179. if r_ground.triggered and vel.x < 4 and vel.x > -4:
  2180. own.setLinearVelocity([x2, vel.y, vel.z], True)
  2181. def coping():
  2182. if invertTouch.positive:
  2183. own["coping"] = 1
  2184. else:
  2185. own["coping"] = 0
  2186. def onboard():
  2187. if own['walk'] == 1:
  2188. cont.deactivate(cam.actuators['replayCam'])
  2189. cont.activate(cam.actuators['Camera'])
  2190. killall()
  2191. walklay = 40
  2192. fliplay3 = 2060
  2193. ob_speed = .5
  2194. if STANCE == 0:
  2195. skater.stopAction(fliplay)
  2196. deck.stopAction(fliplay)
  2197. trucks.stopAction(fliplay)
  2198. killall()
  2199. if own['dropinCol'] == True:
  2200. print("dropinanim")
  2201. own['requestAction'] = reg_dropin
  2202. else:
  2203. own['requestAction'] = 'reg_onboard'
  2204. force = (linVelocity.x -1, linVelocity.y, linVelocity.z)
  2205. own.setLinearVelocity(force, True)
  2206. own['dropinTimer'] = 60
  2207. if STANCE == 1:
  2208. skater.stopAction(fliplay)
  2209. deck.stopAction(fliplay)
  2210. trucks.stopAction(fliplay)
  2211. killall()
  2212. if own['dropinTimer'] > 30:
  2213. print("dropinanim2")
  2214. own['requestAction'] = fak_dropin
  2215. else:
  2216. own['requestAction'] = 'fak_onboard'
  2217. force = (linVelocity.x +1, linVelocity.y, linVelocity.z)
  2218. own.setLinearVelocity(force, True)
  2219. own['dropinTimer'] = 60
  2220. else:
  2221. num = own['dropinTimer']
  2222. if num > 0:
  2223. num = num - 1
  2224. own['dropinTimer'] = num
  2225. def offboard():
  2226. wheel1.stopAction(2)
  2227. wheel2.stopAction(2)
  2228. wheel3.stopAction(2)
  2229. wheel4.stopAction(2)
  2230. cont.deactivate(own.actuators["sroll"])
  2231. sact = own.actuators["sroll"]
  2232. sact.volume = .0001
  2233. own.actuators["sroll"].stopSound()
  2234. own['offboard_vel'] = own.linearVelocity
  2235. own['walk_timer'] = 0
  2236. def resetjumpstance():
  2237. if LAST_GRIND == True and grindHit == False:
  2238. own["lF_ground_frame"] = own['framenum']
  2239. lfg = own["lF_ground_frame"]
  2240. #print(lfg, "----- this?")
  2241. if own['jump_stance'] != 3:
  2242. own['jump_stance'] = 3
  2243. def grass():
  2244. try:
  2245. if 'grass' in r_ground.hitObject:
  2246. #print("grass")
  2247. linVel = own.getLinearVelocity(True)
  2248. linvelx = linVel.x * .98
  2249. own.setLinearVelocity((linvelx, linVel.y, linVel.z), 1)
  2250. except:
  2251. pass
  2252. def grindoutair():
  2253. skippy = 0
  2254. linVel = own.getLinearVelocity(True)
  2255. if own['LAST_GRIND'] == True and grindHit == True:
  2256. own['lg_stance'] = STANCE
  2257. lg_stance = own['lg_stance']
  2258. own.actuators["grindoutair"].useLocalLinV = True
  2259. if own['grindjumpturn'] == True and own['grindCountdown'] > 12 and skippy == 0:
  2260. grindoutspeed = .1
  2261. grindoutspeed2 = 5.4
  2262. if lLR > turnsens:
  2263. if own['last_grindpos'] == 'reg_5050':
  2264. if STANCE == 0:
  2265. own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
  2266. else:
  2267. own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
  2268. cont.activate(own.actuators["grindoutair"])
  2269. if lLR < -turnsens:
  2270. if own['last_grindpos'] == 'reg_5050':
  2271. if STANCE == 0:
  2272. own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
  2273. else:
  2274. own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
  2275. cont.activate(own.actuators["grindoutair"])
  2276. if lUD > turnsens:
  2277. js = own['lg_stance']
  2278. linvelx = own.getLinearVelocity(True)
  2279. if own['last_grindpos'] == 'reg_board':
  2280. if js == 1:
  2281. own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
  2282. cont.activate(own.actuators["grindoutair"])
  2283. else:
  2284. own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
  2285. cont.activate(own.actuators["grindoutair"])
  2286. if lUD < -turnsens:
  2287. js = own['lg_stance']
  2288. if own['last_grindpos'] == 'reg_board':
  2289. if js == 0:
  2290. own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
  2291. cont.activate(own.actuators["grindoutair"])
  2292. else:
  2293. own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
  2294. cont.activate(own.actuators["grindoutair"])
  2295. if LAST_GRIND == False and r_ground.triggered and own['grindjumpturn'] == True and own['grindCountdown'] < 1:
  2296. own['grindjumpturn'] = False
  2297. if r_ground.triggered:
  2298. own['grind_jump'] = False
  2299. if own['grindjumpturn'] == False or own['grindCountdown'] < 19:
  2300. cont.deactivate(own.actuators["grindoutair"])
  2301. def set_last_grindpos():
  2302. if own['grindpos'] != None:
  2303. own['last_grindpos'] = own['grindpos']
  2304. def air_pos():
  2305. grindpos = own['grindpos']
  2306. GRAB_ON = own["GRAB_ON"]
  2307. wr = own["wallride"]
  2308. if rUD > .040 and r_ground.triggered == False and GRAB_ON == False and wr == None and jump_timer < 50:
  2309. killact(2)
  2310. killact(4)
  2311. if STANCE == 0:
  2312. own['requestAction'] = 'reg_air_tail'
  2313. else:
  2314. own['requestAction'] = 'fak_air_tail'
  2315. elif rUD < -.040 and r_ground.triggered == False and GRAB_ON == False and wr == None and jump_timer < 50:
  2316. killact(2)
  2317. killact(4)
  2318. if STANCE == 0:
  2319. own['requestAction'] = 'reg_air_nose'
  2320. else:
  2321. own['requestAction'] = 'fak_air_nose'
  2322. def air_turn_boost():
  2323. pass
  2324. def revert():
  2325. own["Q3oncdl"] = 0
  2326. own["Q4oncdl"] = 0
  2327. own["Q5oncdl"] = 0
  2328. own["Q6oncdl"] = 0
  2329. own["Q7oncdl"] = 0
  2330. local = True
  2331. rot = [ 0.0, 0.0, 3.14]
  2332. own.applyRotation(rot,local)
  2333. if own['manual_v2_type'] == 'reg manual':
  2334. own['requestAction'] = 'reg_manual_revert_ccw'
  2335. print("reg")
  2336. elif own['manual_v2_type'] == 'reg nose manual':
  2337. own['requestAction'] = 'fak_manual_revert_ccw'
  2338. #skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2339. #deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2340. #trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2341. print("reg nose manual revert")
  2342. elif own['manual_v2_type'] == 'fak manual':
  2343. own['requestAction'] = 'fak_manual_revert_ccw'
  2344. #skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2345. #deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2346. #trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2347. print("fak manual revert")
  2348. elif own['manual_v2_type'] == 'fak nose manual':
  2349. own['requestAction'] = 'reg_manual_revert_ccw'
  2350. #skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2351. #deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2352. #trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2353. print("fak")
  2354. else:
  2355. own['requestAction'] = 'revert1'
  2356. own['revert_timer'] = 20
  2357. cont.activate(own.actuators["revertSound"])
  2358. def revert2():
  2359. own["Q3oncdl"] = 0
  2360. own["Q4oncdl"] = 0
  2361. own["Q5oncdl"] = 0
  2362. own["Q6oncdl"] = 0
  2363. own["Q7oncdl"] = 0
  2364. local = True
  2365. rot = [ 0.0, 0.0, -3.14]
  2366. own.applyRotation(rot,local)
  2367. if own['manual_v2_type'] == 'reg manual':
  2368. own['requestAction'] = 'reg_manual_revert_cw'
  2369. #skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2370. #deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2371. #trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2372. print("reg")
  2373. elif own['manual_v2_type'] == 'reg nose manual':
  2374. own['requestAction'] = 'fak_manual_revert_cw'
  2375. #skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2376. #deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2377. #trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2378. print("reg nose manual revert")
  2379. elif own['manual_v2_type'] == 'fak manual':
  2380. own['requestAction'] = 'fak_manual_revert_cw'
  2381. #skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2382. #deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2383. #trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2384. print("fak manual revert")
  2385. elif own['manual_v2_type'] == 'fak nose manual':
  2386. own['requestAction'] = 'reg_manual_revert_cw'
  2387. #skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2388. #deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2389. #trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2390. print("fak")
  2391. else:
  2392. own['requestAction'] = 'revert2'
  2393. own['revert_timer'] = 20
  2394. cont.activate(own.actuators["revertSound"])
  2395. def revert3():
  2396. own["Q7oncdl"] = 0
  2397. own["Q8oncdl"] = 0
  2398. own["Q1oncdl"] = 0
  2399. own["Q2oncdl"] = 0
  2400. own["Q3oncdl"] = 0
  2401. local = True
  2402. rot = [ 0.0, 0.0, 3.14]
  2403. own.applyRotation(rot,local)
  2404. print("real revert 3")
  2405. if own['manual_v2_type'] == 'reg manual':
  2406. own['requestAction'] = 'reg_manual_revert_ccw'
  2407. #skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2408. #deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2409. #trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2410. print("reg")
  2411. elif own['manual_v2_type'] == 'reg nose manual':
  2412. own['requestAction'] = 'fak_manual_revert_ccw'
  2413. #skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2414. #deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2415. #trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2416. print("reg nose manual revert")
  2417. elif own['manual_v2_type'] == 'fak manual':
  2418. own['requestAction'] = 'fak_manual_revert_ccw'
  2419. #skater.playAction("fak_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2420. #deck.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2421. #trucks.playAction("a_fak_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2422. print("fak manual revert")
  2423. elif own['manual_v2_type'] == 'fak nose manual':
  2424. own['requestAction'] = 'reg_manual_revert_ccw'
  2425. #skater.playAction("reg_manual_revert_ccw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2426. #deck.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2427. #trucks.playAction("a_reg_manual_revert_ccw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2428. print("fak")
  2429. else:
  2430. own['requestAction'] = 'revert3'
  2431. own['revert_timer'] = 20
  2432. cont.activate(own.actuators["revertSound"])
  2433. def revert4():
  2434. own["Q7oncdl"] = 0
  2435. own["Q8oncdl"] = 0
  2436. own["Q1oncdl"] = 0
  2437. own["Q2oncdl"] = 0
  2438. own["Q3oncdl"] = 0
  2439. local = True
  2440. rot = [ 0.0, 0.0, 3.14]
  2441. own.applyRotation(rot,local)
  2442. if own['manual_v2_type'] == 'reg manual':
  2443. own['requestAction'] = 'reg_manual_revert_cw'
  2444. #skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2445. #deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2446. #trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2447. print("reg")
  2448. #elif own['reg_nmanual'] == 1:
  2449. elif own['manual_v2_type'] == 'reg nose manual':
  2450. own['requestAction'] = 'fak_manual_revert_cw'
  2451. #skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2452. #deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2453. #trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2454. print("reg nose manual revert")
  2455. #elif own['fak_manual'] == 1 or own['fak_nmanual'] == 1:
  2456. elif own['manual_v2_type'] == 'fak manual':
  2457. own['requestAction'] = 'fak_manual_revert_cw'
  2458. #skater.playAction("fak_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2459. #deck.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2460. #trucks.playAction("a_fak_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2461. print("fak manual revert")
  2462. elif own['manual_v2_type'] == 'fak nose manual':
  2463. own['requestAction'] = 'reg_manual_revert_cw'
  2464. #skater.playAction("reg_manual_revert_cw", 70,10, layer=400, priority=8, play_mode=0, speed=4)
  2465. #deck.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=1, play_mode=0, speed=4)
  2466. #trucks.playAction("a_reg_manual_revert_cw", 70,10, layer=400, priority=0, play_mode=0, speed=4)
  2467. print("fak")
  2468. else:
  2469. own['requestAction'] = 'revert4'
  2470. print("normal revert")
  2471. own['revert_timer'] = 20
  2472. cont.activate(own.actuators["revertSound"])
  2473. def powerslide():
  2474. own['powerslide_counter'] = own['powerslide_counter'] + 1
  2475. since_walk = own['framenum'] - own['last_walk_frame']
  2476. since_grind = own['framenum'] - own['last_grind_frame']
  2477. if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 40:
  2478. own['powerslide_on'] = 1
  2479. if STANCE == 0:
  2480. own['powerslide'] = "reg2"
  2481. if STANCE == 1:
  2482. own['powerslide'] = "fak1"
  2483. linVelocity4 = own.getLinearVelocity(True)
  2484. if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
  2485. newx = linVelocity4.x * .9
  2486. else:
  2487. newx = linVelocity4.x * .98
  2488. force = [newx, linVelocity4.y, linVelocity4.z]
  2489. own.setLinearVelocity(force, True)
  2490. def powerslide2():
  2491. own['powerslide_counter'] = own['powerslide_counter'] + 1
  2492. since_walk = own['framenum'] - own['last_walk_frame']
  2493. since_grind = own['framenum'] - own['last_grind_frame']
  2494. if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 100:
  2495. own['powerslide_on'] = 1
  2496. if STANCE == 0:
  2497. own['powerslide'] = "reg1"
  2498. if STANCE == 1:
  2499. own['powerslide'] = "fak2"
  2500. linVelocity4 = own.getLinearVelocity(True)
  2501. if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
  2502. newx = linVelocity4.x * .9
  2503. else:
  2504. newx = linVelocity4.x * .98
  2505. force = [newx, linVelocity4.y, linVelocity4.z]
  2506. own.setLinearVelocity(force, True)
  2507. def powerslide_state():
  2508. ####powerslide on#####
  2509. if own['powerslide_on'] == 1:
  2510. if own['powerslide'] == "reg2":
  2511. own['requestAction'] = 'reg_fs_powerslide'
  2512. if own['powerslide'] == "fak1":
  2513. own['requestAction'] = 'fak_fs_powerslide'
  2514. if own['powerslide'] == "reg1":
  2515. own['requestAction'] = 'reg_powerslide'
  2516. if own['powerslide'] == "fak2":
  2517. own['requestAction'] = 'fak_powerslide'
  2518. def powerslide_sound():
  2519. sact = own.actuators["powerslide_sound"]
  2520. if own['powerslide_on'] == 1:
  2521. sact = own.actuators["powerslide_sound"]
  2522. sact.volume = .2
  2523. new_pitch = (abs(linVelocity.x) / 3)
  2524. if new_pitch < 1.1 and new_pitch > .5:
  2525. sact.pitch = new_pitch
  2526. elif new_pitch <= .5:
  2527. sact.pitch = .5
  2528. else:
  2529. sact.pitch = 1.1
  2530. cont.activate(own.actuators["powerslide_sound"])
  2531. else:
  2532. sact.volume = .0
  2533. cont.deactivate(own.actuators["powerslide_sound"])
  2534. def check_powerslide():
  2535. try:
  2536. own['last_powerslide_on'] = own['powerslide_on']
  2537. except:
  2538. pass
  2539. psxvel = abs(linVelocity.x)
  2540. if (lUD > .08 or lUD < -.08) and own['manual_v2'] == False and r_ground.triggered == True and psxvel > .1:
  2541. if lUD > .08:
  2542. powerslide()
  2543. else:
  2544. powerslide2()
  2545. else:
  2546. own['powerslide_on'] = 0
  2547. own['powerslide_counter'] = 0
  2548. if own['last_powerslide_on'] == 0:
  2549. own['powerslide'] = None
  2550. def killmanuals():
  2551. if own['last_manual_v2'] == 1 and own['manual_v2'] == 0:
  2552. fak_manual_off()
  2553. reg_manual_off()
  2554. fak_nmanual_off()
  2555. reg_nmanual_off()
  2556. def killopos():
  2557. pass
  2558. stopAnims()
  2559. #nextframe()
  2560. air()
  2561. stance()
  2562. turn()
  2563. #grind()
  2564. rotmult()
  2565. airup()
  2566. onramp()
  2567. speedmult()
  2568. coping()
  2569. onboard()
  2570. resetjumpstance()
  2571. grass()
  2572. grindoutair()
  2573. set_last_grindpos()
  2574. air_pos()
  2575. air_turn_boost()
  2576. record_grindsound()
  2577. check_powerslide()
  2578. powerslide_state()
  2579. powerslide_sound()
  2580. killmanuals()
  2581. killopos()
  2582. grind()
  2583. ##################
  2584. ###realcontrols###
  2585. ##################
  2586. # q1
  2587. # q8 q2
  2588. # q7 q3
  2589. # q6 q4
  2590. # q5
  2591. ##################
  2592. #lq6
  2593. if lUD > .04 and lLR < -0.04 :
  2594. lq6on = 1
  2595. q6oncdl = countdown
  2596. own["Q6oncdl"] = q6oncdl
  2597. #print("lq6on")
  2598. elif q6oncdl > 0:
  2599. lq6on = 0
  2600. q6oncdl = q6oncdl - 1
  2601. own["Q6oncdl"] = q6oncdl
  2602. #lq8
  2603. if lUD < -.04 and lLR < -0.04 :
  2604. lq8on = 1
  2605. q8oncdl = countdown
  2606. own["Q8oncdl"] = q8oncdl
  2607. #print("lq8on")
  2608. elif q8oncdl > 0:
  2609. lq8on = 0
  2610. q8oncdl = q8oncdl - 1
  2611. own["Q8oncdl"] = q8oncdl
  2612. #lq2
  2613. if lUD < -.04 and lLR > 0.04 :
  2614. lq2on = 1
  2615. q2oncdl = countdown
  2616. own["Q2oncdl"] = q2oncdl
  2617. #print("lq2on")
  2618. elif q2oncdl > 0:
  2619. lq2on = 0
  2620. q2oncdl = q2oncdl - 1
  2621. own["Q2oncdl"] = q2oncdl
  2622. #q4
  2623. if lUD > 0.04 and lLR > 0.04 :
  2624. lq4on = 1
  2625. q4oncdl = countdown
  2626. own["Q4oncdl"] = q4oncdl
  2627. #print("lq4on")
  2628. elif q4oncdl > 0:
  2629. lq4on = 0
  2630. q4oncdl = q4oncdl - 1
  2631. own["Q4oncdl"] = q4oncdl
  2632. #q5
  2633. if lUD > .070 and lq4on == 0 and lq6on == 0:
  2634. lq5on = 1
  2635. q5oncdl = countdown
  2636. own["Q5oncdl"] = q5oncdl
  2637. #print("lq5on")
  2638. elif q5oncdl > 0:
  2639. lq5on = 0
  2640. q5oncdl = q5oncdl - 1
  2641. own["Q5oncdl"] = q5oncdl
  2642. #q1
  2643. if lUD < -0.070 and lq8on !=1 and lq2on != 1:
  2644. lq1on = 1
  2645. q1oncdl = countdown
  2646. own["Q1oncdl"] = q1oncdl
  2647. #print("lq1on")
  2648. elif q1oncdl > 0:
  2649. lq1on = 0
  2650. q1oncdl = q1oncdl - 1
  2651. own["Q1oncdl"] = q1oncdl
  2652. #q7
  2653. if lLR < -0.070 and lq8on != 1 and lq6on != 1:
  2654. lq7on = 1
  2655. q7oncdl = countdown
  2656. own["Q7oncdl"] = q7oncdl
  2657. #print("lq7on")
  2658. elif q7oncdl > 0:
  2659. lq7on = 0
  2660. q7oncdl = q7oncdl - 1
  2661. own["Q7oncdl"] = q7oncdl
  2662. #q3
  2663. if lLR > 0.070 and lq2on !=1 and lq4on != 1:
  2664. lq3on = 1
  2665. q3oncdl = countdown
  2666. own["Q3oncdl"] = q3oncdl
  2667. #print("lq3on")
  2668. elif q3oncdl > 0:
  2669. lq3on = 0
  2670. q3oncdl = q3oncdl - 1
  2671. own["Q3oncdl"] = q3oncdl
  2672. #34567
  2673. own['set_revert_timer'] = 0
  2674. if q3oncdl < q4oncdl < q5oncdl < q6oncdl < q7oncdl:
  2675. if r_ground.triggered == True:
  2676. print("REVERT!!!")
  2677. revert()
  2678. own['set_revert_timer'] = 1
  2679. if q3oncdl > q4oncdl > q5oncdl > q6oncdl > q7oncdl:
  2680. if r_ground.triggered == True:
  2681. print("REVERT2!!!")
  2682. revert2()
  2683. own['set_revert_timer'] = 1
  2684. if q7oncdl < q8oncdl < q1oncdl < q2oncdl < q3oncdl:
  2685. if r_ground.triggered == True:
  2686. print("REVERT3!!!")
  2687. revert3()
  2688. own['set_revert_timer'] = 1
  2689. if q7oncdl > q8oncdl > q1oncdl > q2oncdl > q3oncdl:
  2690. if r_ground.triggered == True:
  2691. print("REVERT4!!!")
  2692. revert4()
  2693. own['set_revert_timer'] = 1
  2694. ################
  2695. #q6
  2696. if rUD > .04 and rLR < -0.04 :
  2697. q6on = 1
  2698. q6oncd = countdown
  2699. own["Q6oncd"] = q6oncd
  2700. #print("q6on")
  2701. elif q6oncd > 0:
  2702. q6on = 0
  2703. q6oncd = q6oncd - 1
  2704. own["Q6oncd"] = q6oncd
  2705. #q8
  2706. if rUD < -.04 and rLR < -0.04 :
  2707. q8on = 1
  2708. q8oncd = countdown
  2709. own["Q8oncd"] = q8oncd
  2710. #print("q8on")
  2711. elif q8oncd > 0:
  2712. q8on = 0
  2713. q8oncd = q8oncd - 1
  2714. own["Q8oncd"] = q8oncd
  2715. #q2
  2716. if rUD < -.04 and rLR > 0.04 :
  2717. q2on = 1
  2718. q2oncd = countdown
  2719. own["Q2oncd"] = q2oncd
  2720. #print("q2on")
  2721. elif q2oncd > 0:
  2722. q2on = 0
  2723. q2oncd = q2oncd - 1
  2724. own["Q2oncd"] = q2oncd
  2725. #q4
  2726. if rUD > 0.04 and rLR > 0.04 :
  2727. q4on = 1
  2728. q4oncd = countdown
  2729. own["Q4oncd"] = q4oncd
  2730. #print("q4on")
  2731. elif q4oncd > 0:
  2732. q4on = 0
  2733. q4oncd = q4oncd - 1
  2734. own["Q4oncd"] = q4oncd
  2735. #q5
  2736. if rUD > .070:
  2737. if q4on == 0 and q6on == 0:
  2738. #print("q5on")
  2739. q5on = 1
  2740. q5oncd = countdown
  2741. own["Q5oncd"] = q5oncd
  2742. oposin()
  2743. if (rTrig > 0.02 and GRAB_ON == False and r_ground.triggered == 1) or (lTrig > 0.02 and GRAB_ON == False and r_ground.triggered == 1):
  2744. pump()
  2745. else:
  2746. own["lastPump"] = False
  2747. own["Pump"] = False
  2748. own['jump_stance'] = STANCE
  2749. if rUD > .02:
  2750. grindpos = own['grindpos']
  2751. jumpstance = own["jump_stance"]
  2752. if LAST_GRIND == False:
  2753. if grindpos == "reg_stall":
  2754. grindtype("nose_stall") #change
  2755. elif grindpos == "fak_stall":
  2756. grindtype("nose_stall")
  2757. elif grindpos == "reg_5050":
  2758. if jumpstance != 3:
  2759. if jumpstance == 0:
  2760. if rLR > .02:
  2761. grindtype("reg_tailgR")
  2762. elif rLR < -.02:
  2763. grindtype("reg_tailgL")
  2764. else:
  2765. grindtype("reg_tailg")
  2766. if jumpstance == 1:
  2767. if rLR > .02:
  2768. grindtype("fak_tailgR")
  2769. elif rLR < -.02:
  2770. grindtype("fak_tailgL")
  2771. else:
  2772. grindtype("fak_tailg")
  2773. else:
  2774. if STANCE == 0:
  2775. if rLR > .03:
  2776. grindtype("reg_tailgR")
  2777. elif rLR < -.02:
  2778. grindtype("reg_tailgL")
  2779. else:
  2780. grindtype("reg_tailg")
  2781. if STANCE == 1:
  2782. grindtype("fak_tailg")
  2783. elif grindpos == "reg_board":
  2784. if jumpstance != 3:
  2785. if jumpstance == 0:
  2786. grindtype("reg_tailslide")
  2787. if jumpstance == 1:
  2788. grindtype("fak_tailslide")
  2789. STANCE = jumpstance
  2790. own['stance'] = STANCE
  2791. else:
  2792. if STANCE == 0:
  2793. grindtype("reg_tailslide")
  2794. if STANCE == 1:
  2795. grindtype("fak_tailslide")
  2796. else:
  2797. if jumpstance == 0:
  2798. grindtype("reg_tailg")
  2799. if jumpstance == 1:
  2800. grindtype("fak_tailg")
  2801. if q5oncd > 0:
  2802. q5on = 0
  2803. q5oncd = q5oncd - 1
  2804. own["Q5oncd"] = q5oncd
  2805. own["last_Opos"] = False
  2806. #q1
  2807. if rUD < -0.070:
  2808. if q2on == 0 and q8on == 0:
  2809. print("q1on")
  2810. q1on = 1
  2811. q1oncd = countdown
  2812. own["Q1oncd"] = q1oncd
  2813. noposin()
  2814. if rUD < -0.020:
  2815. grindpos = own['grindpos']
  2816. jumpstance = own["jump_stance"]
  2817. if LAST_GRIND == False:
  2818. if grindpos == "reg_5050":
  2819. #print("nose something")
  2820. if jumpstance != 3:
  2821. if jumpstance == 0:
  2822. if rLR > .02:
  2823. grindtype("reg_nosegR")
  2824. elif rLR < -.02:
  2825. grindtype("reg_nosegL")
  2826. else:
  2827. #print("gtype reg_nosegR")
  2828. grindtype("reg_noseg")
  2829. if jumpstance == 1:
  2830. if rLR > .02:
  2831. grindtype("fak_nosegR")
  2832. elif rLR < -.02:
  2833. grindtype("fak_nosegL")
  2834. else:
  2835. grindtype("fak_noseg")
  2836. else:
  2837. if STANCE == 0:
  2838. if rLR > .02:
  2839. grindtype("reg_nosegR")
  2840. elif rLR < -.02:
  2841. grindtype("reg_nosegL")
  2842. else:
  2843. grindtype("reg_noseg")
  2844. if STANCE == 1:
  2845. if rLR > .02:
  2846. grindtype("fak_nosegR")
  2847. elif rLR < -.02:
  2848. grindtype("fak_nosegL")
  2849. else:
  2850. grindtype("fak_noseg")
  2851. elif grindpos == "reg_board":
  2852. #print("nose something")
  2853. if jumpstance != 3:
  2854. if jumpstance == 0:
  2855. grindtype("reg_noseslide")
  2856. if jumpstance == 1:
  2857. grindtype("fak_noseslide")
  2858. STANCE = jumpstance
  2859. own['stance'] = STANCE
  2860. else:
  2861. if STANCE == 0:
  2862. grindtype("reg_noseslide")
  2863. if STANCE == 1:
  2864. grindtype("fak_noseslide")
  2865. if rUD > -0.020 and rUD <= .020 and LAST_GRIND == False:
  2866. if own['grindpos'] == 'reg_5050':
  2867. grindtype("reg_5050")
  2868. if own['grindpos'] == 'fak_5050':
  2869. grindtype("fak_5050")
  2870. if q1oncd > 0:
  2871. q1on = 0
  2872. q1oncd = q1oncd - 1
  2873. own["Q1oncd"] = q1oncd
  2874. own["last_nOpos"] = False
  2875. #print(q1oncd)
  2876. #q7
  2877. if rLR < -0.070:
  2878. if q8on == 0 and q6on == 0:
  2879. q7on = 1
  2880. q7oncd = countdown
  2881. own["Q7oncd"] = q7oncd
  2882. #print("q7on")
  2883. elif q7oncd > 0:
  2884. q7on = 0
  2885. q7oncd = q7oncd - 1
  2886. own["Q7oncd"] = q7oncd
  2887. #q3
  2888. if rLR > 0.070:
  2889. if q4on == 0 and q2on == 0:
  2890. q3on = 1
  2891. q3oncd = countdown
  2892. own["Q3oncd"] = q3oncd
  2893. #print("q3on")
  2894. elif q3oncd > 0:
  2895. q3on = 0
  2896. q3oncd = q3oncd - 1
  2897. own["Q3oncd"] = q3oncd
  2898. #trick calls
  2899. # 360 flip
  2900. # 3 > 4 > 5 > 8
  2901. # laser flip
  2902. # 7 > 6 > 5 > 2
  2903. #nollie 360 shovit
  2904. if q7oncd > 0 and q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q3oncd > 0 and q7oncd <= q8oncd <= q1oncd <= q2oncd <= q3oncd:
  2905. print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2906. print ("Nollie 360 shovit")
  2907. dict['trick_string'] = 'Nollie 360 Shovit'
  2908. nollie_shovit360()
  2909. q7oncd = 0
  2910. q8oncd = 0
  2911. q1oncd = 0
  2912. q2oncd = 0
  2913. q3oncd = 0
  2914. own["Q7oncd"] = q7oncd
  2915. own["Q8oncd"] = q8oncd
  2916. own["Q1oncd"] = q1oncd
  2917. own["Q2oncd"] = q2oncd
  2918. own["Q3oncd"] = q3oncd
  2919. #nollie fs 360 shovit
  2920. if q7oncd > 0 and q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q3oncd > 0 and q3oncd <= q2oncd <= q1oncd <= q8oncd <= q7oncd:
  2921. #print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2922. print ("Nollie Front Side 360 shovit")
  2923. dict['trick_string'] = 'Nollie FS 360 Shovit'
  2924. nollie_fsshovit360()
  2925. q7oncd = 0
  2926. q8oncd = 0
  2927. q1oncd = 0
  2928. q2oncd = 0
  2929. q3oncd = 0
  2930. own["Q7oncd"] = q7oncd
  2931. own["Q8oncd"] = q8oncd
  2932. own["Q1oncd"] = q1oncd
  2933. own["Q2oncd"] = q2oncd
  2934. own["Q3oncd"] = q3oncd
  2935. # varial heelflip
  2936. # 7 < 6 < 2
  2937. if q7oncd > 0 and q6oncd > 0 and q2oncd > 0 and q7oncd < q6oncd < q2oncd:
  2938. dict['trick_string'] = 'Varial Heelflip'
  2939. varial_heelflip()
  2940. reset_rtimers()
  2941. # varial kickflip
  2942. # 3 < 4 < 8
  2943. if q3oncd > 0 and q4oncd > 0 and q8oncd > 0 and q3oncd < q4oncd < q8oncd:
  2944. dict['trick_string'] = 'Varial Kickflip'
  2945. varial_kickflip()
  2946. reset_rtimers()
  2947. # nollie varial kickflip
  2948. # 3 < 2 < 6
  2949. if q3oncd > 0 and q2oncd > 0 and q6oncd > 0 and q3oncd <= q2oncd <= q6oncd:
  2950. dict['trick_string'] = 'Nollie Varial Kickflip'
  2951. print('Nollie Varial Kickflip')
  2952. nollie_varial_kickflip()
  2953. reset_rtimers()
  2954. # nollie varial heelflip
  2955. # 7 < 8 < 4
  2956. if q7oncd > 0 and q8oncd > 0 and q4oncd > 0 and q7oncd <= q8oncd <= q4oncd:
  2957. dict['trick_string'] = 'Nollie Varial Heelflip'
  2958. print('Nollie Varial Heelflip')
  2959. nollie_varial_heelflip()
  2960. reset_rtimers()
  2961. #360 shovit
  2962. if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q7oncd > 0 and q7oncd >= q6oncd >= q5oncd >= q4oncd >= q3oncd:
  2963. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2964. #print ("______-------360 shovit")
  2965. dict['trick_string'] = '360 Shovit'
  2966. shovit360()
  2967. q3oncd = 0
  2968. q4oncd = 0
  2969. q5oncd = 0
  2970. q6oncd = 0
  2971. q7oncd = 0
  2972. own["Q3oncd"] = q3oncd
  2973. own["Q4oncd"] = q4oncd
  2974. own["Q5oncd"] = q5oncd
  2975. own["Q6oncd"] = q6oncd
  2976. own["Q7oncd"] = q7oncd
  2977. #360 fs shovit
  2978. if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd >= 0 and q7oncd > 0 and q7oncd <= q6oncd <= q5oncd <= q4oncd <= q3oncd:
  2979. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2980. #print ("______-------360 shovit")
  2981. dict['trick_string'] = '360 Frontside Shovit'
  2982. fsshovit360()
  2983. q3oncd = 0
  2984. q4oncd = 0
  2985. q5oncd = 0
  2986. q6oncd = 0
  2987. q7oncd = 0
  2988. own["Q3oncd"] = q3oncd
  2989. own["Q4oncd"] = q4oncd
  2990. own["Q5oncd"] = q5oncd
  2991. own["Q6oncd"] = q6oncd
  2992. own["Q7oncd"] = q7oncd
  2993. #ollie
  2994. if q5oncd > 0 and q1oncd > 0 and q5oncd < q1oncd:
  2995. JUMPSTRENGTH = q1oncd - q5oncd
  2996. #4,7
  2997. if JUMPSTRENGTH <= 4:
  2998. JUMPSTRENGTH = 1.1
  2999. if JUMPSTRENGTH > 4 and JUMPSTRENGTH < 7:
  3000. JUMPSTRENGTH = 1
  3001. if JUMPSTRENGTH >= 7:
  3002. JUMPSTRENGTH = .9
  3003. aollie()
  3004. q1oncd = 0
  3005. q5oncd = 0
  3006. own["Q1oncd"] = q1oncd
  3007. own["Q5oncd"] = q5oncd
  3008. #nollie
  3009. if q5oncd > 0 and q1oncd > 0 and q5oncd > q1oncd:
  3010. JUMPSTRENGTH = q5oncd - q1oncd
  3011. #4,7
  3012. if JUMPSTRENGTH <= 4:
  3013. JUMPSTRENGTH = 1.1
  3014. if JUMPSTRENGTH > 4 and JUMPSTRENGTH < 7:
  3015. JUMPSTRENGTH = 1
  3016. if JUMPSTRENGTH >= 7:
  3017. JUMPSTRENGTH = .9
  3018. nollie()
  3019. q1oncd = 0
  3020. q5oncd = 0
  3021. own["Q1oncd"] = q1oncd
  3022. own["Q5oncd"] = q5oncd
  3023. print("nollie")
  3024. #kickflip
  3025. if q5oncd > 0 and q8oncd > 0 and q5oncd < q8oncd and q3oncd < 1:
  3026. kickflip()
  3027. q8oncd = 0
  3028. q5oncd = 0
  3029. own["Q8oncd"] = q8oncd
  3030. own["Q5oncd"] = q5oncd
  3031. #nollie kickflip
  3032. if q1oncd > 0 and q6oncd > 0 and q1oncd < q6oncd:
  3033. nollie_kickflip()
  3034. q6oncd = 0
  3035. q1oncd = 0
  3036. own["Q6oncd"] = q6oncd
  3037. own["Q1oncd"] = q1oncd
  3038. #heelflip
  3039. if q5oncd > 0 and q2oncd > 0 and q5oncd < q2oncd:
  3040. heelflip()
  3041. q2oncd = 0
  3042. q5oncd = 0
  3043. own["Q2oncd"] = q2oncd
  3044. own["Q5oncd"] = q5oncd
  3045. #nollie_heelflip
  3046. if q1oncd > 0 and q4oncd > 0 and q1oncd < q4oncd:
  3047. nollie_heelflip()
  3048. q1oncd = 0
  3049. q4oncd = 0
  3050. own["Q1oncd"] = q1oncd
  3051. own["Q4oncd"] = q4oncd
  3052. #shovit
  3053. if q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q4oncd <= q5oncd <= q6oncd and q3oncd < 1:
  3054. shovit()
  3055. q4oncd = 0
  3056. q5oncd = 0
  3057. q6oncd = 0
  3058. own["Q4oncd"] = q4oncd
  3059. own["Q5oncd"] = q5oncd
  3060. own["Q6oncd"] = q6oncd
  3061. #nollie_shovit
  3062. if q2oncd > 0 and q1oncd > 0 and q8oncd > 0 and q2oncd <= q1oncd <= q8oncd and q3oncd == 0:
  3063. nollie_shovit()
  3064. print('nollie shuvit')
  3065. #nollie_fsshovit()
  3066. q2oncd = 0
  3067. q1oncd = 0
  3068. q8oncd = 0
  3069. own["Q2oncd"] = q2oncd
  3070. own["Q1oncd"] = q1oncd
  3071. own["Q8oncd"] = q8oncd
  3072. #fsshovit
  3073. if q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q6oncd <= q5oncd <= q4oncd and q7oncd < 1:
  3074. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  3075. # print ("^%*^%*^%*^%fsshovit")
  3076. fsshovit()
  3077. q4oncd = 0
  3078. q5oncd = 0
  3079. q6oncd = 0
  3080. own["Q4oncd"] = q4oncd
  3081. own["Q5oncd"] = q5oncd
  3082. own["Q6oncd"] = q6oncd
  3083. #nollie_fsshovit
  3084. if q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q8oncd <= q1oncd <= q2oncd and q7oncd == 0:
  3085. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  3086. print ("nollie fsshovit")
  3087. nollie_fsshovit()
  3088. #nollie_shovit()
  3089. q8oncd = 0
  3090. q1oncd = 0
  3091. q2oncd = 0
  3092. own["Q8oncd"] = q4oncd
  3093. own["Q1oncd"] = q5oncd
  3094. own["Q2oncd"] = q6oncd
  3095. #360 shovit
  3096. # 360 shovit
  3097. # 3 > 4 > 5 >6 > 7
  3098. # fs 360 shovit
  3099. # 7 > 6 > 5 > 4 > 3
  3100. def hippy_jump():
  3101. STANCE = own["stance"]
  3102. if own['hippy'] == 1 and own['last_hippy'] == 0:
  3103. if STANCE == 0:
  3104. #own['requestAction'] = 'reg_hippy'
  3105. skater.playAction("reg_hippy", 1,10, layer=1101, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3106. if STANCE == 1:
  3107. skater.playAction("fak_hippy", 1,10, layer=1101, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3108. if own['hippy'] == 1 and own['last_hippy'] == 1:
  3109. if STANCE == 0:
  3110. skater.playAction("reg_hippy", 10,10, layer=1100, priority=0, layer_weight=0, play_mode=1, speed=.5)
  3111. if STANCE == 1:
  3112. skater.playAction("fak_hippy", 10,10, layer=1100, priority=0, layer_weight=0, play_mode=1, speed=.5)
  3113. if own['hippy'] == 0 and own['last_hippy'] == 1:
  3114. killact(1100)
  3115. if rLR > turnsens:
  3116. local = True
  3117. rot = [ 0.0, 0.0, 3.14]
  3118. own.applyRotation(rot,local)
  3119. print("hippy turn")
  3120. if STANCE == 0:
  3121. own['requestAction'] = 'reg_hippy_ncw'
  3122. skater.playAction("reg_hippy_ncw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3123. print('%hip1')
  3124. if STANCE == 1:
  3125. own['requestAction'] = 'fak_hippy_ncw'
  3126. skater.playAction("fak_hippy_ncw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3127. print('%hip2')
  3128. elif rLR < -turnsens:
  3129. local = True
  3130. rot = [ 0.0, 0.0, -3.14]
  3131. own.applyRotation(rot,local)
  3132. print("hippy turn neg")
  3133. if STANCE == 0:
  3134. own['requestAction'] = 'fak_hippy_nccw'
  3135. skater.playAction("fak_hippy_nccw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3136. print('%hip3')
  3137. if STANCE == 1:
  3138. own['requestAction'] = 'reg_hippy_nccw'
  3139. skater.playAction("reg_hippy_nccw", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3140. print('%hip4')
  3141. ##straight
  3142. else:
  3143. if STANCE == 0:
  3144. skater.playAction("reg_hippy", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3145. own['requestAction'] = 'reg_hippy'
  3146. if STANCE == 1:
  3147. own['requestAction'] = 'fak_hippy'
  3148. skater.playAction("fak_hippy", 10,40, layer=1102, priority=1, layer_weight=0, play_mode=0, speed=.5)
  3149. #pushing and hippy jumps
  3150. since_a = frame - lastaf
  3151. since_x = frame - lastxf
  3152. cush = 10
  3153. hippy = 0
  3154. own['hippy'] = 0
  3155. #print(since_a, "a", since_x, "x")
  3156. #if xBut == 1 and aBut == 1 and since_a <= cush and since_x <= cush and (lTrig < 0.02 and rTrig < 0.02):
  3157. if xBut == 1 and aBut == 1 and (lTrig < 0.02 and rTrig < 0.02) and r_ground.triggered == True:
  3158. #F"hippy")
  3159. hippy = 1
  3160. own['hippy'] = 1
  3161. #hippy_jump()
  3162. #print(hippy)
  3163. hippy_jump()
  3164. if since_a > cush and aBut == 1 and lasta == 1 and (lTrig < 0.02 and rTrig < 0.02) and own['last_hippy'] == 0:
  3165. #print("apush suckka", since_a)
  3166. if xBut == 0 and hippy == 0 and lastaBut_ground == True:
  3167. push()
  3168. if since_x > cush and xBut == 1 and lastx == 1 and (lTrig < 0.02 and rTrig < 0.02) and own['last_hippy'] == 0:
  3169. #print("push suckka", since_x)
  3170. if aBut == 0 and hippy == 0 and lastxBut_ground == True:
  3171. push_goof()
  3172. #cavemans
  3173. if LAST_GRIND == False and grindHit == False and r_ground.triggered:
  3174. if (aBut ==0 and own['lastaBut_ground'] == 1) and lTrig > 0.02:
  3175. brfoot()
  3176. if (aBut ==0 and own['lastaBut_ground'] == 1) and rTrig > 0.02:
  3177. frfoot()
  3178. if (xBut ==0 and own['lastxBut_ground'] == 1) and lTrig > 0.02:
  3179. blfoot()
  3180. if (xBut ==0 and own['lastxBut_ground'] == 1) and rTrig > 0.02:
  3181. flfoot()
  3182. #push b button
  3183. if bBut == 1:
  3184. #print("push suckka")
  3185. if linVelocity.x > .05 or linVelocity.x < -.05:
  3186. stop()
  3187. elif linVelocity.x < .05 or linVelocity.x > -.05:
  3188. if own["lastStop"] == True:
  3189. own["lastStop"] = False
  3190. elif bBut ==0:
  3191. own["lastStop"] = False
  3192. ##### falls
  3193. if own['fall'] == 1:
  3194. offboard()
  3195. own['getoffboard'] = True
  3196. ####
  3197. #y button
  3198. if own['lasty'] == 1 and yBut ==0:
  3199. offboard()
  3200. if own["GRAB_ON"] == True:
  3201. playing = skater.isPlayingAction(fliplay)
  3202. if playing == 1:
  3203. frame = skater.getActionFrame(fliplay)
  3204. #print("Flipping frame: ", frame)
  3205. if frame > 16:
  3206. skater.stopAction(fliplay)
  3207. #frontside grab
  3208. flipping = skater.isPlayingAction(fliplay)
  3209. if rTrig > 0.02 and r_ground.triggered == 0 and flipping == False:
  3210. GRAB_ON = True
  3211. own["GRAB_ON"] = GRAB_ON
  3212. #print(rTrig, GRAB_ON)
  3213. if STANCE == False and rUD >= -.07 and rUD <= .07:
  3214. frontside_grab_on()
  3215. elif STANCE == True and rUD >= -.07 and rUD <= .07:
  3216. fakbackside_grab_on()
  3217. #front_nose
  3218. if STANCE == True and rUD < -0.070:
  3219. fak_backside_nose_grab_on()
  3220. #front_tail
  3221. elif STANCE == True and rUD > 0.07:
  3222. fak_backside_tail_grab_on()
  3223. #
  3224. if STANCE == False and rUD < -0.070:
  3225. frontside_nose_grab_on()
  3226. #front_tail
  3227. elif STANCE == False and rUD > 0.07:
  3228. frontside_tail_grab_on()
  3229. #backside grab
  3230. #if lTrig > 0.02 and GRAB_ON == False and r_ground.triggered == 0:
  3231. if lTrig > 0.02 and r_ground.triggered == 0 and flipping == False:
  3232. GRAB_ON = True
  3233. own["GRAB_ON"] = GRAB_ON
  3234. #print(rTrig)
  3235. if STANCE == False and rUD >= -.07 and rUD <= .07:
  3236. backside_grab_on()
  3237. elif STANCE == True and rUD >= -.07 and rUD <= .07:
  3238. fakfrontside_grab_on()
  3239. #front_nose
  3240. if STANCE == True and rUD < -0.070:
  3241. fak_frontside_nose_grab_on()
  3242. #front_tail
  3243. elif STANCE == True and rUD > 0.07:
  3244. fak_frontside_tail_grab_on()
  3245. #front_nose
  3246. if STANCE == False and rUD < -0.070:
  3247. backside_nose_grab_on()
  3248. #front_tail
  3249. elif STANCE == False and rUD > 0.07:
  3250. backside_tail_grab_on()
  3251. #kill grabs
  3252. if lTrig <= 0.02 and GRAB_ON == True and lTrig >= -.02 and rTrig <= .02 and rTrig >= -.2:
  3253. GRAB_ON = False
  3254. own["GRAB_ON"] = GRAB_ON
  3255. GRAB_PLAYED = False
  3256. own["GRAB_PLAYED"] = GRAB_PLAYED
  3257. #frontside pump #backside pump
  3258. def footplant():
  3259. framenum = own['framenum']
  3260. last_ground_frame = own['lF_ground_frame']
  3261. lF_air_frame = own['lF_air_frame']
  3262. frames_since_ground = framenum - lF_air_frame
  3263. frames_since_grind = framenum - own['last_grind_frame']
  3264. #print(frames_since_ground, "fsg")
  3265. if LAST_GRIND == False and grindHit == True and aBut == True and frames_since_ground < 40 and touched:
  3266. own.setLinearVelocity([0,0,0],0)
  3267. #killall()
  3268. #if STANCE == 0:
  3269. #skater.playAction("reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3270. #deck.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3271. #trucks.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3272. #skater.playAction("reg_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3273. #deck.playAction("a_reg_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3274. #trucks.playAction("a_reg_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3275. #if STANCE == 1:
  3276. #skater.playAction("fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3277. #deck.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3278. #trucks.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3279. #skater.playAction("fak_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3280. #deck.playAction("a_fak_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3281. #trucks.playAction("a_fak_fp_rback", 1,10, layer=2928, priority=8, play_mode=0, speed=1)
  3282. own['footplant_on'] = 1
  3283. if grindHit == False:
  3284. own['footplant_on'] = 0
  3285. if own['footplant_on'] == True and rUD < turnsens and rUD > -turnsens:
  3286. own.setLinearVelocity([0,0,0],0)
  3287. if own['footplant_on'] == 1 and own['last_footplant'] == True:
  3288. if skater.isPlayingAction(2925) == False:
  3289. if STANCE == 0:
  3290. own['requestAction'] = 'reg_fp_rback'
  3291. #skater.playAction("reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3292. #deck.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3293. #trucks.playAction("a_reg_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3294. if STANCE == 1:
  3295. own['requestAction'] = 'fak_fp_rback'
  3296. #skater.playAction("fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3297. #deck.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3298. #trucks.playAction("a_fak_fp_rback", 10,10, layer=2925, priority=8, play_mode=1, speed=.5)
  3299. # if own['last_footplant'] == True and own['footplant_on'] == 0:
  3300. # #killall()
  3301. # if STANCE == 0:
  3302. # skater.playAction("reg_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3303. # deck.playAction("a_reg_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3304. # trucks.playAction("a_reg_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3305. # if STANCE == 1:
  3306. # skater.playAction("fak_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3307. # deck.playAction("a_fak_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3308. # trucks.playAction("a_fak_fp_rback", 10,20, layer=2928, priority=8, play_mode=0, speed=1)
  3309. def invert():
  3310. if LAST_GRIND == False and grindHit == True and own['grindpos'] == 'reg_board':
  3311. if lBump == 1:
  3312. #print("invert")
  3313. #if coping_on ==1 and lBump == 1:
  3314. print("IIIIIINVVERT")
  3315. own['invert_on'] = 1
  3316. own.setLinearVelocity([0,0,0],0)
  3317. if own["coping"] == 1 and invert_on == 1:
  3318. # killact(25)
  3319. # killact(24)
  3320. if own['invert_on'] == 1 and own['last_invert'] == False:
  3321. #killall()
  3322. cont.activate(own.actuators['invertOn_sound'])
  3323. # if STANCE == False:
  3324. # own['invert_type'] = "reg_back_invert_in"
  3325. # skater.playAction("reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1)
  3326. # deck.playAction("a_reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1)
  3327. # trucks.playAction("a_reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1)
  3328. # if STANCE == True:
  3329. # own['invert_type'] = "fak_fr_invert"
  3330. # skater.playAction("fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1)
  3331. # deck.playAction("a_fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1)
  3332. # trucks.playAction("a_fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1)
  3333. if invert_on == 0 and own['last_invert'] == True:
  3334. #print("kill invert")
  3335. own['last_invert_frame'] = frame
  3336. cont.activate(own.actuators['invertOff_Sound'])
  3337. # killact(300)
  3338. # killact(301)
  3339. # killact(302)
  3340. # killact(303)
  3341. # killact(304)
  3342. # killact(305)
  3343. # killact(700)
  3344. # killact(700)
  3345. # killact(700)
  3346. # killact(290)
  3347. # killact(291)
  3348. # killact(292)
  3349. # if own['invert_type'] == "reg_back_invert_in":
  3350. # skater.playAction("reg_back_invert_in", 20,0, layer=306, play_mode=0, speed=1)
  3351. # deck.playAction("a_reg_back_invert_in", 20,0, layer=306, play_mode=0, speed=1)
  3352. # trucks.playAction("a_reg_back_invert_in", 20,0, layer=306, play_mode=0, speed=1)
  3353. # if own['invert_type'] == "fak_fr_invert":
  3354. # skater.playAction("fak_fr_invert", 20,0, layer=306, play_mode=0, speed=1)
  3355. # deck.playAction("a_fak_fr_invert", 20,0, layer=306, play_mode=0, speed=1)
  3356. # trucks.playAction("a_fak_fr_invert", 20,0, layer=306, play_mode=0, speed=1)
  3357. if invert_on == 1:
  3358. if own['invert_type'] == "reg_back_invert_in":
  3359. own['requestAction'] = 'reg_back_invert'
  3360. #skater.playAction("reg_back_invert_in", 30,30, layer=290, play_mode=1, speed=1)
  3361. #deck.playAction("a_reg_back_invert_in", 30,30, layer=290, play_mode=1, speed=1)
  3362. #trucks.playAction("a_reg_back_invert_in", 30,30, layer=290, play_mode=1, speed=1)
  3363. if own['invert_type'] == "fak_fr_invert":
  3364. own['requestAction'] = 'fak_fr_invert'
  3365. #skater.playAction("fak_fr_invert", 30,30, layer=290, play_mode=1, speed=1)
  3366. #deck.playAction("a_fak_fr_invert", 30,30, layer=290, play_mode=1, speed=1)
  3367. #trucks.playAction("a_fak_fr_invert", 30,30, layer=290, play_mode=1, speed=1)
  3368. lif = own['last_invert_frame']
  3369. if frame - lif > 3 and invert_on == 0:
  3370. own['invert_type'] = None
  3371. invert()
  3372. footplant()
  3373. if own['invert_on'] == 0:
  3374. killact(900)
  3375. def reset_pos():
  3376. #reset
  3377. if ddPad == 1:
  3378. spawn_pos = own['spawn_pos']
  3379. spawn_rot = own['spawn_rot']
  3380. try:
  3381. own.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .1))
  3382. own.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
  3383. except:
  3384. own.worldPosition = (0, 0, .1)
  3385. own.worldOrientation = [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
  3386. if own["spawn_stance"] == 1:
  3387. own.setLinearVelocity([.1,0,0], 1)
  3388. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  3389. #cam.applyMovement([0,-1,0], True)
  3390. #lx = cam.localPosition[1]
  3391. #lx = lx - 4
  3392. #cam.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
  3393. #cam.localPosition[1] = lx
  3394. else:
  3395. own.setLinearVelocity([-.1,0,0], 1)
  3396. #cam.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .25))
  3397. #cam.applyMovement([0,1,0], True)
  3398. #lx = cam.localPosition[1]
  3399. #lx = lx - 4
  3400. #cam.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
  3401. #cam.localPosition[1] = lx
  3402. if udPad == 1:
  3403. own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]]
  3404. own['spawn_rot'] = [[own.worldOrientation[0][0],own.worldOrientation[0][1],own.worldOrientation[0][2]], [own.worldOrientation[1][0],own.worldOrientation[1][1],own.worldOrientation[1][2]], own.worldOrientation[2][2]]
  3405. stance = own["stance"]
  3406. own["spawn_stance"] = stance
  3407. #start button
  3408. if stBut == True:
  3409. own.actuators["sroll"].volume = .0001
  3410. cont.deactivate(own.actuators["sroll"])
  3411. own.actuators["sroll"].stopSound()
  3412. def ylimit():
  3413. lgf = own['last_grind_frame']
  3414. frame = own['framenum']
  3415. frames_since_grinding = frame - lgf
  3416. if r_ground.triggered and touched == False and grindHit == 0 and frames_since_grinding > 20:
  3417. linVelocity4 = own.getLinearVelocity(True)
  3418. newy = linVelocity4.y * .8 #.4
  3419. force = [linVelocity4.x, newy, linVelocity4.z]
  3420. own.setLinearVelocity(force, True)
  3421. #print("limitting y")
  3422. # own["linVely"] = linVelocity.y
  3423. def getoffboard():
  3424. lasty = own['lasty']
  3425. getoffboard = own['getoffboard']
  3426. if getoffboard == 1 and own['fall'] == False:
  3427. own['getoffboard'] = 0
  3428. if yBut == False and lasty == True:
  3429. own['getoffboard'] = 1
  3430. def switchcam():
  3431. pass
  3432. # if ltsBut == False and own['lastlts'] == True and rtsBut == False:
  3433. # if own['camera'] == 1:
  3434. # own['camera'] = 0
  3435. # else:
  3436. # own['camera'] = 1
  3437. # if rtsBut == False and own['lastrts'] == True and ltsBut == False:
  3438. # if own['camera'] == 2:
  3439. # own['camera'] = 0
  3440. # else:
  3441. # own['camera'] = 2
  3442. #followcam
  3443. def move_followcam():
  3444. if own['camera'] == 2:
  3445. #if rtsBut == False and own['lastrts'] == True:
  3446. if own['lastbkBut'] == True and bkBut == False:
  3447. #print("activate move followcam")
  3448. if own['move_followcam'] == False:
  3449. own['move_followcam'] = True
  3450. else:
  3451. own['move_followcam'] = False
  3452. if own['move_followcam'] == True:
  3453. #act = followcam.actuators[
  3454. camspeed1 = .015
  3455. camspeed2 = .055
  3456. camrot1 = .005
  3457. camrot2 = .02
  3458. #up
  3459. if lUD < -0.080:
  3460. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  3461. cont.activate(followcam.actuators["up"])
  3462. #print("fastup")
  3463. else:
  3464. cont.deactivate(followcam.actuators["up"])
  3465. # #down
  3466. if lUD > .080:
  3467. followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  3468. cont.activate(followcam.actuators["down"])
  3469. else:
  3470. cont.deactivate(followcam.actuators["down"])
  3471. # #left
  3472. if lLR < -0.080:
  3473. followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  3474. cont.activate(followcam.actuators["left"])
  3475. else:
  3476. cont.deactivate(followcam.actuators["left"])
  3477. # #right
  3478. if lLR > 0.080:
  3479. followcam.actuators["right"].dLoc = [camspeed2, 0, 0]
  3480. cont.activate(followcam.actuators["right"])
  3481. else:
  3482. cont.deactivate(followcam.actuators["right"])
  3483. #up
  3484. if rUD < -0.080:
  3485. followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
  3486. cont.activate(followcam.actuators["rotup"])
  3487. #print("uppppppppppppppppppppppppppp")
  3488. else:
  3489. cont.deactivate(followcam.actuators["rotup"])
  3490. # #down
  3491. if rUD > .080:
  3492. followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]
  3493. cont.activate(followcam.actuators["rotdown"])
  3494. else:
  3495. cont.deactivate(followcam.actuators["rotdown"])
  3496. # #left
  3497. if rLR < -0.080:
  3498. followcam.actuators["rotleft"].dRot = [0, 0, camrot2]
  3499. cont.activate(followcam.actuators["rotleft"])
  3500. else:
  3501. cont.deactivate(followcam.actuators["rotleft"])
  3502. # #right
  3503. if rLR > 0.080:
  3504. followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
  3505. cont.activate(followcam.actuators["rotright"])
  3506. else:
  3507. cont.deactivate(followcam.actuators["rotright"])
  3508. #*********************************************
  3509. if lUD > -0.080 and lUD < -0.030:
  3510. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  3511. cont.activate(followcam.actuators["up"])
  3512. #print(lUD)
  3513. else:
  3514. cont.deactivate(followcam.actuators["up"])
  3515. # #down
  3516. if lUD < .080 and lUD > .03:
  3517. followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  3518. cont.activate(followcam.actuators["down"])
  3519. else:
  3520. cont.deactivate(followcam.actuators["down"])
  3521. # #left
  3522. if lLR > -0.080 and lLR < -0.030:
  3523. followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  3524. cont.activate(followcam.actuators["left"])
  3525. else:
  3526. cont.deactivate(followcam.actuators["left"])
  3527. # #right
  3528. if lLR < .080 and lLR > .03:
  3529. followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
  3530. cont.activate(followcam.actuators["right"])
  3531. else:
  3532. cont.deactivate(followcam.actuators["right"])
  3533. #up
  3534. if rUD > -0.080 and rUD < -0.030:
  3535. followcam.actuators["rotup"].dRot = [camrot1, 0, 0]
  3536. cont.activate(followcam.actuators["rotup"])
  3537. else:
  3538. cont.deactivate(followcam.actuators["rotup"])
  3539. # #down
  3540. if rUD < .080 and rUD > .03:
  3541. followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  3542. cont.activate(followcam.actuators["rotdown"])
  3543. else:
  3544. cont.deactivate(followcam.actuators["rotdown"])
  3545. # #left
  3546. if rLR > -0.080 and rLR < -0.030:
  3547. followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
  3548. cont.activate(followcam.actuators["rotleft"])
  3549. else:
  3550. cont.deactivate(followcam.actuators["rotleft"])
  3551. # #right
  3552. if rLR < .080 and rLR > .03:
  3553. followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
  3554. cont.activate(followcam.actuators["rotright"])
  3555. else:
  3556. cont.deactivate(followcam.actuators["rotright"])
  3557. def move_flycam():
  3558. if own['camera'] == 1:
  3559. #if rtsBut == False and own['lastrts'] == True:
  3560. if own['lastbkBut'] == True and bkBut == False:
  3561. if own['move_freecam'] == False:
  3562. own['move_freecam'] = True
  3563. else:
  3564. own['move_freecam'] = False
  3565. if own['move_freecam'] == True:
  3566. #act = freecam.actuators[
  3567. camspeed1 = .015
  3568. camspeed2 = .055
  3569. camrot1 = .005
  3570. camrot2 = .02
  3571. #up
  3572. if lUD < -0.080:
  3573. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  3574. cont.activate(freecam.actuators["up"])
  3575. #print("fastup")
  3576. else:
  3577. cont.deactivate(freecam.actuators["up"])
  3578. # #down
  3579. if lUD > .080:
  3580. freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  3581. cont.activate(freecam.actuators["down"])
  3582. else:
  3583. cont.deactivate(freecam.actuators["down"])
  3584. # #left
  3585. if lLR < -0.080:
  3586. freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  3587. cont.activate(freecam.actuators["left"])
  3588. else:
  3589. cont.deactivate(freecam.actuators["left"])
  3590. # #right
  3591. if lLR > 0.080:
  3592. freecam.actuators["right"].dLoc = [camspeed2, 0, 0]
  3593. cont.activate(freecam.actuators["right"])
  3594. else:
  3595. cont.deactivate(freecam.actuators["right"])
  3596. #up
  3597. if rUD < -0.080:
  3598. freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
  3599. cont.activate(freecam.actuators["rotup"])
  3600. else:
  3601. cont.deactivate(freecam.actuators["rotup"])
  3602. # #down
  3603. if rUD > .080:
  3604. freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]
  3605. cont.activate(freecam.actuators["rotdown"])
  3606. else:
  3607. cont.deactivate(freecam.actuators["rotdown"])
  3608. # #left
  3609. if rLR < -0.080:
  3610. freecam.actuators["rotleft"].dRot = [0, 0, camrot2]
  3611. cont.activate(freecam.actuators["rotleft"])
  3612. else:
  3613. cont.deactivate(freecam.actuators["rotleft"])
  3614. # #right
  3615. if rLR > 0.080:
  3616. freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
  3617. cont.activate(freecam.actuators["rotright"])
  3618. else:
  3619. cont.deactivate(freecam.actuators["rotright"])
  3620. #*********************************************
  3621. if lUD > -0.080 and lUD < -0.030:
  3622. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  3623. cont.activate(freecam.actuators["up"])
  3624. #print(lUD)
  3625. else:
  3626. cont.deactivate(freecam.actuators["up"])
  3627. # #down
  3628. if lUD < .080 and lUD > .03:
  3629. freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  3630. cont.activate(freecam.actuators["down"])
  3631. else:
  3632. cont.deactivate(freecam.actuators["down"])
  3633. # #left
  3634. if lLR > -0.080 and lLR < -0.030:
  3635. freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  3636. cont.activate(freecam.actuators["left"])
  3637. else:
  3638. cont.deactivate(freecam.actuators["left"])
  3639. # #right
  3640. if lLR < .080 and lLR > .03:
  3641. freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
  3642. cont.activate(freecam.actuators["right"])
  3643. else:
  3644. cont.deactivate(freecam.actuators["right"])
  3645. #up
  3646. if rUD > -0.080 and rUD < -0.030:
  3647. freecam.actuators["rotup"].dRot = [camrot1, 0, 0]
  3648. cont.activate(freecam.actuators["rotup"])
  3649. else:
  3650. cont.deactivate(freecam.actuators["rotup"])
  3651. # #down
  3652. if rUD < .080 and rUD > .03:
  3653. freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  3654. cont.activate(freecam.actuators["rotdown"])
  3655. else:
  3656. cont.deactivate(freecam.actuators["rotdown"])
  3657. # #left
  3658. if rLR > -0.080 and rLR < -0.030:
  3659. freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
  3660. cont.activate(freecam.actuators["rotleft"])
  3661. else:
  3662. cont.deactivate(freecam.actuators["rotleft"])
  3663. # #right
  3664. if rLR < .080 and rLR > .03:
  3665. freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
  3666. cont.activate(freecam.actuators["rotright"])
  3667. else:
  3668. cont.deactivate(freecam.actuators["rotright"])
  3669. if r_ground.triggered == False:
  3670. own["lF_air_frame"] = own["framenum"]
  3671. if r_ground.triggered == True:
  3672. own["lF_ground_frame"] = own["framenum"]
  3673. if own['LAST_GRIND'] == True:
  3674. own['last_grind_frame'] = own['framenum']
  3675. if own['LAST_GRIND'] == False and r_ground.triggered and own['jump_timer'] == 0:
  3676. if own['jump_stance'] != 3:
  3677. own['jump_stance'] = 3
  3678. def control_calib():
  3679. #controller calibration test
  3680. scenes = bge.logic.getSceneList()
  3681. controller_calib = [scene for scene in scenes if scene.name=="controller_calib"][0]
  3682. cq1 = controller_calib.objects['q1']
  3683. cq2 = controller_calib.objects['q2']
  3684. cq3 = controller_calib.objects['q3']
  3685. cq4 = controller_calib.objects['q4']
  3686. cq5 = controller_calib.objects['q5']
  3687. cq6 = controller_calib.objects['q6']
  3688. cq7 = controller_calib.objects['q7']
  3689. cq8 = controller_calib.objects['q8']
  3690. if lq1on == 1:
  3691. cq1["q1"] = 1
  3692. else:
  3693. cq1["q1"] = 0
  3694. if lq2on == 1:
  3695. cq2["q2"] = 1
  3696. else:
  3697. cq2["q2"] = 0
  3698. if lq3on == 1:
  3699. cq3["q3"] = 1
  3700. else:
  3701. cq3["q3"] = 0
  3702. if lq4on == 1:
  3703. cq4["q4"] = 1
  3704. else:
  3705. cq4["q4"] = 0
  3706. if lq5on == 1:
  3707. cq5["q5"] = 1
  3708. else:
  3709. cq5["q5"] = 0
  3710. if lq6on == 1:
  3711. cq6["q6"] = 1
  3712. else:
  3713. cq6["q6"] = 0
  3714. if lq7on == 1:
  3715. cq7["q7"] = 1
  3716. else:
  3717. cq7["q7"] = 0
  3718. if lq8on == 1:
  3719. cq8["q8"] = 1
  3720. else:
  3721. cq8["q8"] = 0
  3722. def grind_turn():
  3723. jumping = None
  3724. gotcd = 25
  3725. force = [0,0,0]
  3726. grindHit = own['grindTouch']
  3727. sincegrinding = own['framenum'] - own['grindstartFrame']
  3728. if rUD > turnsens or rLR > turnsens or rUD < -turnsens or rLR < -turnsens:
  3729. jumping = True
  3730. if grindHit == False:
  3731. cont.deactivate(own.actuators['grindoutRight'])
  3732. cont.deactivate(own.actuators['grindoutLeft'])
  3733. if grindHit == True and jumping == None and sincegrinding > 20:
  3734. #if grindHit == True and jumping == None:
  3735. outloc = 0.022
  3736. bsoutloc = .07
  3737. bsoutvel = .1
  3738. outrot = .02 #0.012
  3739. outrot2 = .24
  3740. outact = own.actuators["grindoutRight"]
  3741. if own['grindpos'] == 'reg_5050':
  3742. if lq3on == 1 or lq2on:
  3743. if own['gt_cd2'] == 0:
  3744. own['gt_cd2'] = 60
  3745. if STANCE == True:
  3746. if own['grind_out_type'] == None:
  3747. own['grind_out_type'] = 'fak right'
  3748. if STANCE == False:
  3749. if own['grind_out_type'] == None:
  3750. own['grind_out_type'] = 'reg right'
  3751. own["grindoutturn"] = gotcd
  3752. if lq7on == 1 or lq8on:
  3753. if own['gt_cd2'] == 0:
  3754. own['gt_cd2'] = 60
  3755. if STANCE == True:
  3756. if own['grind_out_type'] == None:
  3757. own['grind_out_type'] = 'fak left'
  3758. if STANCE == False:
  3759. if own['grind_out_type'] == None:
  3760. own['grind_out_type'] = 'reg left'
  3761. own["grindoutturn"] = gotcd
  3762. if lq4on == 1:
  3763. if own['gt_cd2'] == 0:
  3764. own['gt_cd2'] = 60
  3765. if STANCE == True:
  3766. if own['grind_out_type'] == None:
  3767. own['grind_out_type'] = 'fak fak right'
  3768. if STANCE == False:
  3769. if own['grind_out_type'] == None:
  3770. own['grind_out_type'] = 'reg fak right'
  3771. own["grindoutturn"] = gotcd
  3772. if lq6on == 1:
  3773. if own['gt_cd2'] == 0:
  3774. own['gt_cd2'] = 60
  3775. if STANCE == True:
  3776. if own['grind_out_type'] == None:
  3777. own['grind_out_type'] = 'fak fak left'
  3778. if STANCE == False:
  3779. if own['grind_out_type'] == None:
  3780. own['grind_out_type'] = 'reg fak left'
  3781. own["grindoutturn"] = gotcd
  3782. #use stance for 5050 and grindstance for boards
  3783. if own['grindpos'] == 'reg_board':
  3784. outvel = own.getLinearVelocity(1)
  3785. outact.dLoc = [0, 0, 0]
  3786. outact.dRot = [0, 0, 0]
  3787. if lq5on == 1:
  3788. if own['gt_cd2'] == 0:
  3789. own['gt_cd2'] = 60
  3790. if own['grind_stance'] == True:
  3791. if own['footplant_on'] == True:
  3792. own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
  3793. cont.activate(own.actuators["grindoutRight"])
  3794. if own['grind_out_type'] == None:
  3795. own['grind_out_type'] = 'bs fak back'
  3796. if own['grind_stance'] == False:
  3797. if own['footplant_on'] == True:
  3798. own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
  3799. cont.activate(own.actuators["grindoutRight"])
  3800. if own['grind_out_type'] == None:
  3801. own['grind_out_type'] = 'bs reg back'
  3802. own["grindoutturn"] = gotcd
  3803. own['invert_on'] = 0
  3804. if lq1on == 1:
  3805. if own['gt_cd2'] == 0:
  3806. own['gt_cd2'] = 60
  3807. if own['grind_stance'] == True:
  3808. if own['footplant_on'] == True:
  3809. own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
  3810. cont.activate(own.actuators["grindoutRight"])
  3811. if own['grind_out_type'] == None:
  3812. own['grind_out_type'] = 'bs fak forward'
  3813. if own['grind_stance'] == False:
  3814. if own['footplant_on'] == True:
  3815. own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
  3816. cont.activate(own.actuators["grindoutRight"])
  3817. if own['grind_out_type'] == None:
  3818. own['grind_out_type'] = 'bs reg forward'
  3819. own["grindoutturn"] = gotcd
  3820. own['invert_on'] = 0
  3821. if lq1on or lq2on or lq3on or lq4on or lq5on or lq6on or lq7on or lq8on:
  3822. gt_cd = own['gt_cd']
  3823. if gt_cd == 0:
  3824. gt_cd = 30
  3825. own['gt_cd'] = gt_cd
  3826. #else:
  3827. #else:
  3828. if own['grindoutturn'] == 0:
  3829. cont.deactivate(own.actuators["grindoutRight"])
  3830. own["grindoutturn"] = 0
  3831. gt_cd = own['gt_cd']
  3832. if gt_cd > 0:
  3833. own['gt_cd'] = gt_cd - 1
  3834. else:
  3835. own['gt_cd'] = 0
  3836. #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  3837. reg_move = .05
  3838. reg_rot = 0.01
  3839. reg_rot2 = .26
  3840. reg_move2 = .13
  3841. bsforce = 50
  3842. bs_dloc = .03
  3843. outvel = own.linearVelocity
  3844. if own['gt_cd2'] > 50:
  3845. if own['grind_out_type'] == 'reg right':
  3846. #print("do reg right")
  3847. own.applyMovement([0,reg_move,0], True)
  3848. own.applyRotation([0,0,reg_rot],True)
  3849. if own['grind_out_type'] == 'fak right':
  3850. own.applyMovement([0,-reg_move,0], True)
  3851. own.applyRotation([0,0,-reg_rot],True)
  3852. #print("do fak right")
  3853. if own['grind_out_type'] == 'reg left':
  3854. #print("do reg left")
  3855. own.applyMovement([0,-reg_move,0], True)
  3856. own.applyRotation([0,0,reg_rot],True)
  3857. if own['grind_out_type'] == 'fak left':
  3858. own.applyMovement([0,reg_move,0], True)
  3859. own.applyRotation([0,0,-reg_rot],True)
  3860. #print("do fak left")
  3861. if own['grind_out_type'] == 'reg fak right':
  3862. if own['gt_cd2'] > 55:
  3863. own.applyMovement([0,reg_move2,0], True)
  3864. own.applyRotation([0,0,reg_rot2],True)
  3865. #print("do reg fak right")
  3866. if own['grind_out_type'] == 'fak fak right':
  3867. if own['gt_cd2'] > 55:
  3868. own.applyMovement([0,-reg_move2,0], True)
  3869. own.applyRotation([0,0,reg_rot2],True)
  3870. #print("do fak fak right")
  3871. if own['grind_out_type'] == 'reg fak left':
  3872. if own['gt_cd2'] > 55:
  3873. own.applyMovement([0,-reg_move2,0], True)
  3874. own.applyRotation([0,0,-reg_rot2],True)
  3875. #print("do reg fak left")
  3876. if own['grind_out_type'] == 'fak fak left':
  3877. if own['gt_cd2'] > 55:
  3878. own.applyMovement([0,reg_move2,0], True)
  3879. own.applyRotation([0,0,-reg_rot2],True)
  3880. #print("do fak fak left")
  3881. if own['grind_out_type'] == 'reg right' or own['grind_out_type'] == 'reg left' or own['grind_out_type'] == 'fak right' or own['grind_out_type'] == 'fak left':
  3882. own.setLinearVelocity([outvel.x * 1.01, outvel.y, outvel.z], True)
  3883. if own['grind_out_type'] == 'reg fak right' or own['grind_out_type'] == 'reg fak left' or own['grind_out_type'] == 'fak fak right' or own['grind_out_type'] == 'fak fak left':
  3884. if own['gt_cd2'] == 51:
  3885. #print('outforce')
  3886. if STANCE == 0:
  3887. own.applyForce([-200, 0, 0], True)
  3888. if STANCE == 1:
  3889. own.applyForce([200, 0, 0], True)
  3890. if own['grind_out_type'] == 'bs reg back' or own['grind_out_type'] == 'bs fak forward':
  3891. if own['gt_cd2'] > 50:
  3892. if STANCE == True:
  3893. own.applyForce([bsforce, 0, 0], True)
  3894. if STANCE == False:
  3895. own.applyForce([bsforce, 0, 0], True)
  3896. own.applyMovement([bs_dloc,0,0], True)
  3897. if own['grind_out_type'] == 'bs fak back' or own['grind_out_type'] == 'bs reg forward':
  3898. if own['gt_cd2'] > 50:
  3899. if STANCE == True:
  3900. own.applyForce([-bsforce, 0, 0], True)
  3901. if STANCE == False:
  3902. own.applyForce([-bsforce, 0, 0], True)
  3903. own.applyMovement([-bs_dloc,0,0], True)
  3904. #print("setting linvel", own.linearVelocity, outvel)
  3905. if own['gt_cd2'] > 0:
  3906. own['gt_cd2'] -= 1
  3907. if own['gt_cd2'] == 0:
  3908. own['grind_out_type'] = None
  3909. #print(own['grind_out_type'])
  3910. #print(own["gt_cd"])
  3911. if own["grindoutturn"] > 0:
  3912. own["grindoutturn"] = own["grindoutturn"] - 1
  3913. def air_height():
  3914. height = own["air_height"]
  3915. if lf_ground == True and r_ground.triggered == False:
  3916. height = 0
  3917. #if
  3918. #wallride
  3919. def wallride():
  3920. wallride_off = own['wallride_off']
  3921. distance = own.getDistanceTo(gray.hitPosition)
  3922. upforce = 25
  3923. sideforce = 15
  3924. #distance = own["air_height"]
  3925. try:
  3926. obj = gray.hitObject
  3927. objpos = obj.worldPosition
  3928. ownpos = own.worldPosition
  3929. distance = ownpos.z - objpos.z
  3930. #print(distance)
  3931. except:
  3932. pass
  3933. if wallrideL.triggered and wallride_off == 0 and r_ground.triggered == False:
  3934. #print("wallrideL", distance)
  3935. own['jump_timer'] = 0
  3936. if r_ground.triggered == False:
  3937. own["wallride"] = "L"
  3938. #print(own["wallride"])
  3939. cont.activate(wallrideconstL)
  3940. force = [0,sideforce,upforce]
  3941. own.applyForce(force,1)
  3942. #own.alignAxisToVect(obj.worldPosition, 1, .9)
  3943. #align
  3944. if STANCE == 0:
  3945. skater.playAction("reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3946. else:
  3947. skater.playAction("fak_wall_l", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3948. deck.playAction("a_reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3949. trucks.playAction("a_reg_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3950. else:
  3951. if own["wallride"] != "R":
  3952. own["wallride"] = None
  3953. cont.deactivate(wallrideconstL)
  3954. killact(3000)
  3955. killact(3001)
  3956. killact(3002)
  3957. if wallrideR.triggered and wallride_off == 0:
  3958. own['jump_timer'] = 0
  3959. #print("wallrideR", distance)
  3960. if r_ground.triggered == False:
  3961. own["wallride"] = "R"
  3962. cont.activate(wallrideconstR)
  3963. force = [0,-sideforce,upforce]
  3964. own.applyForce(force,1)
  3965. #own.alignAxisToVect(obj.worldPosition, 1, .9)
  3966. if STANCE == 0:
  3967. skater.playAction("reg_wall_l", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3968. else:
  3969. skater.playAction("fak_wall_r", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3970. deck.playAction("a_reg_wall_l2", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3971. trucks.playAction("a_reg_wall_l2", 10,10, layer=3000, priority=8, play_mode=1, speed=.5)
  3972. else:
  3973. if own["wallride"] != "L":
  3974. own["wallride"] = None
  3975. cont.deactivate(wallrideconstR)
  3976. killact(3003)
  3977. killact(3004)
  3978. killact(3005)
  3979. def wallride_sound():
  3980. sact = own.actuators["wallSound"]
  3981. if own["wallride"] != None:
  3982. sact.volume = .2
  3983. cont.activate(own.actuators["wallSound"])
  3984. else:
  3985. sact.volume = .001
  3986. sact.stopSound()
  3987. if own['revert_timer'] > 0:
  3988. own['revert_timer'] = own['revert_timer'] - 1
  3989. def shutoff_timers():
  3990. #print(wallride)
  3991. if (LAST_GRIND == False and grindHit == True) or (jump_timer > 10 and own['wallride'] == None):
  3992. own["Q1oncd"] = 0
  3993. own["Q2oncd"] = 0
  3994. own["Q3oncd"] = 0
  3995. own["Q4oncd"] = 0
  3996. own["Q5oncd"] = 0
  3997. own["Q6oncd"] = 0
  3998. own["Q7oncd"] = 0
  3999. own["Q8oncd"] = 0
  4000. def grindout_cleanup():
  4001. lgf = own['last_grind_frame']
  4002. def trans_jump():
  4003. if own['jump_from_trans'] == 1:
  4004. ground_ray = cont.sensors['ground_look']
  4005. jump_obj = own['trans_jump_obj']
  4006. jump_obj = scene.objects[str(own['trans_jump_obj'])]
  4007. #print(jump_obj)
  4008. worldVect = [1, 0, 0]
  4009. vect = jump_obj.getAxisVect(worldVect)
  4010. go = jump_obj.worldOrientation
  4011. grinder_axis = [0,1,0]
  4012. player_pos = own.worldPosition
  4013. jump_obj = jump_obj.worldPosition
  4014. try:
  4015. delta = player_pos - jump_obj
  4016. except:
  4017. #print("delta broke: ", player_pos, grinder_pos)
  4018. pass
  4019. delta = delta.cross(vect)
  4020. deltamove = delta[1] * .25
  4021. move = [deltamove, 0, 0]
  4022. #print(deltamove)
  4023. if abs(deltamove) < 1 and delta[1] < 1:
  4024. own.applyMovement(move, True)
  4025. #print(deltamove, delta, "delta.......")
  4026. #pos = ground_ray.hitPosition
  4027. #print(pos)
  4028. #linvelloc6 = own.getLinearVelocity(True)
  4029. #xvel6 = linvelloc6.x * .95
  4030. #force = (xvel6, linvelloc6.y, linvelloc6.z)
  4031. #own.setLinearVelocity(force, True)
  4032. #control_calib() #scene must be enabled in main
  4033. jump_Timer()
  4034. check_landing()
  4035. #SWAG()
  4036. #isplaying()
  4037. nextframe()
  4038. wheelroll()
  4039. rollsound()
  4040. reset_pos()
  4041. ylimit()
  4042. getoffboard()
  4043. #switchcam()
  4044. move_flycam()
  4045. move_followcam()
  4046. grind_turn()
  4047. air_height()
  4048. wallride()
  4049. wallride_sound()
  4050. shutoff_timers()
  4051. grindout_cleanup()
  4052. #trans_jump()
  4053. #printplaying()
  4054. #transmult()
  4055. linvelx = own.getLinearVelocity(True)
  4056. #print(linvelx)
  4057. own["linvelx"] = linvelx.x
  4058. LAST_STANCE = STANCE
  4059. LAST_STANCE = own["stance"]
  4060. own["last_stance"] = STANCE
  4061. own["lastGrab"] = GRAB_ON
  4062. own['ground'] = r_ground.triggered
  4063. own['last_ground'] = r_ground.triggered
  4064. own["LAST_GRIND"] = grindHit
  4065. own["rotz"] = rot.z
  4066. own['walk'] = 0
  4067. own['lasty'] = yBut
  4068. own['lastlts'] = ltsBut
  4069. own['lastrts'] = rtsBut
  4070. own["lF_ground2"] = own["lF_ground"]
  4071. own['last_invert'] = invert_on
  4072. own['lastbkBut'] = bkBut
  4073. own['grab_type'] = grab_type
  4074. own['last_last_manual'] = own['last_manual']
  4075. own['last_manual'] = own['manual']
  4076. own['last_reg_manual'] = own['reg_manual']
  4077. own['last_fak_manual'] = own['fak_manual']
  4078. own['last_fak_nmanual'] = own['fak_nmanual']
  4079. own['last_reg_nmanual'] = own['reg_nmanual']
  4080. if own['manual'] == 1:
  4081. own['last_manual_frame'] = frame
  4082. #print(own['hippy'], own['last_hippy'])
  4083. own['last_hippy'] = own['hippy']
  4084. #last pressed down frame
  4085. if aBut == 1 and own["lasta"] == 0:
  4086. own["lastaf"] = frame
  4087. if xBut == 1 and own["lastx"] == 0:
  4088. own["lastxf"] = frame
  4089. own["lasta"] = aBut
  4090. own["lastx"] = xBut
  4091. own['lastaBut_ground'] = aBut_ground
  4092. own['lastxBut_ground'] = xBut_ground
  4093. own["last_sel"] = own["sel"]
  4094. own["sel"] = bkBut
  4095. if r_ground.triggered and own["jump_timer"] < 20:
  4096. force2 = [0.0, 0, -10]
  4097. own.applyForce(force2, True)
  4098. #print('grindtouch = ', own['grindTouch'])
  4099. if grindDar == False and r_ground.triggered and own['grindTouch'] == False:
  4100. own['grindType'] = ''