Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Volleyball Controller by AcidRain
- #
- # while player is in air and crouching and ball is moving = spike
- # ball is projected in the direction the player is looking
- #
- # Issues:
- # Bad template is making touched message hard to fire
- #
- # No Thx To:
- # SM_Sith_Lord for being a total noob, provided shitty advice that cost about an hr of coding time,
- # for yet again, providing very shitty advice and sending me on wild goose chases.
- # trolling during a serious matter.
- symbols
- message touched
- message startup
- message pulse
- template ball=gvb local
- int time_new local
- int time_old local
- vector lvec local #players look direction
- vector force_vec local #force to be applied to volleyball
- end
- #==============================================================#
- code
- startup:
- SetPulse(0.1);
- Return;
- pulse:
- time_new = GetGameTime();
- Return;
- touched: #volleyball id is 427
- source = GetSourceRef();
- vball = GetSenderRef();
- //was it a player?
- if(GetThingType(source) != 10) Return;
- if(time_new - time_old < 200) Return; //G, this is to stop a spam FireProjectile() loop that will crash jk
- time_old = time_new; //Everything that u see with "time" on it is to fix this.
- //spike
- if((VectorX(GetThingVel(vball)) > 0 || VectorY(GetThingVel(vball)) > 0) && GetThingAttachFlags(source) != 0x1 && IsCrouching(source) == 1)
- {
- DestroyThing(vball);
- lvec = VectorNorm(GetThingLVec(source));
- force_vec = VectorSet(VectorX(lvec)*70, VectorY(lvec)*70, -120);
- vball = FireProjectile(source, ball, -1, -1, '0 0.15 0', '0 0 0', 0, 0x1, 0, 0);
- ApplyForce(vball, force_vec);
- Return;
- }
- DestroyThing(vball);
- lvec = VectorNorm(GetThingLVec(source));
- force_vec = VectorSet(VectorX(lvec)*70, VectorY(lvec)*70, 120);
- vball = FireProjectile(source, ball, -1, -1, '0 0.15 0', '0 0 0', 0, 0x1, 0, 0);
- ApplyForce(vball, force_vec);
- Return;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement