Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Volleyball Controller by AcidRain
  2. #
  3. # while player is in air and crouching and ball is moving = spike
  4. # ball is projected in the direction the player is looking
  5. #
  6. # Issues:
  7. #   Bad template is making touched message hard to fire
  8. #
  9. # No Thx To:
  10. #   SM_Sith_Lord for being a total noob, provided shitty advice that cost about an hr of coding time,
  11. #                for yet again, providing very shitty advice and sending me on wild goose chases.
  12. #                trolling during a serious matter.
  13.  
  14. symbols
  15.  
  16. message     touched
  17. message     startup
  18. message     pulse
  19.  
  20. template    ball=gvb    local
  21. int         time_new    local
  22. int         time_old    local
  23. vector      lvec        local   #players look direction
  24. vector      force_vec   local   #force to be applied to volleyball
  25.  
  26. end
  27.  
  28. #==============================================================#
  29.  
  30. code
  31.  
  32. startup:
  33.     SetPulse(0.1);
  34.     Return;
  35.  
  36. pulse:
  37.     time_new = GetGameTime();
  38.     Return;
  39.  
  40. touched:    #volleyball id is 427
  41.     source = GetSourceRef();
  42.     vball = GetSenderRef();
  43.     //was it a player?
  44.     if(GetThingType(source) != 10) Return;
  45.     if(time_new - time_old < 200) Return;       //G, this is to stop a spam FireProjectile() loop that will crash jk
  46.     time_old = time_new;                        //Everything that u see with "time" on it is to fix this.
  47.  
  48.     //spike
  49.     if((VectorX(GetThingVel(vball)) > 0 || VectorY(GetThingVel(vball)) > 0) && GetThingAttachFlags(source) != 0x1 && IsCrouching(source) == 1)
  50.     {
  51.         DestroyThing(vball);
  52.         lvec = VectorNorm(GetThingLVec(source));
  53.         force_vec = VectorSet(VectorX(lvec)*70, VectorY(lvec)*70, -120);
  54.         vball = FireProjectile(source, ball, -1, -1, '0 0.15 0', '0 0 0', 0, 0x1, 0, 0);
  55.         ApplyForce(vball, force_vec);
  56.         Return;
  57.     }
  58.  
  59.  
  60.         DestroyThing(vball);
  61.         lvec = VectorNorm(GetThingLVec(source));
  62.         force_vec = VectorSet(VectorX(lvec)*70, VectorY(lvec)*70, 120);
  63.         vball = FireProjectile(source, ball, -1, -1, '0 0.15 0', '0 0 0', 0, 0x1, 0, 0);
  64.         ApplyForce(vball, force_vec);
  65.     Return;
  66.  
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement