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 167KB

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