Advertisement
skroton

Blood Direction 2: Sanguine Boogaloo

May 22nd, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.11 KB | None | 0 0
  1. /*
  2. So, add the +SEEKERMISSILE flag to the projectile that is hitting the player. It won't actually seek unless you call the specific function that does the seeking.
  3.  
  4. Then add to both the player actor and the projectile actor */
  5.  
  6. var int user_blood_x;
  7. var int user_blood_y;
  8. var int user_blood_z;
  9. var int user_blood_angle;
  10. var int user_blood_pitch;
  11.  
  12. /* Then in the first frame of the projectile, in a 0 tic frame, call the following script */
  13.  
  14. Script 1 void
  15. {
  16.   int vel_x, vel_y, vel_z, angle, pitch;
  17.  
  18.   vel_x = GetActorVelX(0);
  19.   vel_y = GetActorVelY(0);
  20.   vel_z = GetActorVelZ(0);
  21.   angle = GetActorAngle(0);
  22.   pitch = VectorAngle( VectorLength(vel_x, vel_y), vel_z ); /* calculate pitch, because monsters projectiles don't have pitch */
  23.  
  24.   SetUserVariable (0, "user_blood_x", vel_x);
  25.   SetUserVariable (0, "user_blood_y", vel_y);
  26.   SetUserVariable (0, "user_blood_z", vel_z);
  27.   SetUserVariable (0, "user_blood_angle", angle);
  28.   SetUserVariable (0, "user_blood_pitch", pitch);
  29. }
  30.  
  31. /* Then in the xdeath/death of the projectile call the following script */
  32.  
  33. Script 2 void
  34. {
  35.   int vel_x, vel_y, vel_z, angle, pitch;
  36.  
  37.   vel_x = GetUserVariable (0, "user_blood_x");
  38.   vel_y = GetUserVariable (0, "user_blood_y");
  39.   vel_z = GetUserVariable (0, "user_blood_z");
  40.   angle = GetUserVariable (0, "user_blood_angle");
  41.   pitch = GetUserVariable (0, "user_blood_pitch");
  42.  
  43.   SetActivator(0, AAPTR_TRACER); /* set activator to tracer of projectile, which is target of monster that fired it */
  44.  
  45.   SetUserVariable (0, "user_blood_x", vel_x);
  46.   SetUserVariable (0, "user_blood_y", vel_y);
  47.   SetUserVariable (0, "user_blood_z", vel_z);
  48.   SetUserVariable (0, "user_blood_angle", angle);
  49.   SetUserVariable (0, "user_blood_pitch", pitch);
  50. }
  51.  
  52. /* You now have access to all of the above user_vars in the decorate of the player actor, and it will always use the var of the projectile that most recently hit them.
  53.  
  54. Remember to divide all vars by 65536 in the decorate because they are fixed number values.
  55.  
  56. Remember that the "user_blood_angle" and "user_blood_pitch" vars are in fixed point angle, so 0 to 1.0 (or 0 to 65536). */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement