Modme Forums
Menu:

Spawn in front

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: mathfag
How to spawn something (trigger radius) in front + 50 units of something that is moving and constantly changing direction (example zombie).
Can't use radiant and Link the trigger.


ModmeBot:

Reply By: natesmithzombies
This was a tough one that took me a while to get right. I believe I got the logic from a script from WaW. Here is the code:

function get_point_in_front(distance) //self is the entity you want to get the point in front of. returns the point in front of the entity
{
	fire_angles = self getPlayerAngles();
	fire_angles_forward = anglesToForward(fire_angles);
	fire_init = self.origin + (0,0,50); // added 50 to make it slightly off the ground
	return fire_init + vectorScale(fire_angles_forward, distance);	
}

/*
Example: 
org = player get_point_in_front(50);
*/


ModmeBot:

Reply By: mathfag

natesmithzombies
This was a tough one that took me a while to get right. I believe I got the logic from a script from WaW. Here is the code: function get_point_in_front(distance) //self is the entity you want to get the point in front of. returns the point in front of the entity { fire_angles = self getPlayerAngles(); fire_angles_forward = anglesToForward(fire_angles); fire_init = self.origin + (0,0,50); // added 50 to make it slightly off the ground return fire_init + vectorScale(fire_angles_forward, distance); } /* Example: org = player get_point_in_front(50); */


Thanks bro

For people that don't know, to spawn in front of not a player its:

self being the entity that called it
fire_angles = self.angles;


and

org = self get_point_in_front(100);

I still have no idea how the code works