I've been having a weird bug that I cannot seem to fix with my mod. Whenever a certain function happens (code below) the player literally just falls through the map.. it's like a wall breach in Call of Duty (sorry for the bad reference) or something weird like that.. Here's what I have setup code wise. One thing that might be good to note is this mod is a Slender mod for PSP.
What I'm trying to do is make it to where when the player looks at the monster (Slenderman in this case) it calls a function called "slender_spotted" which teleports the monster forward by a certain amount. (and plays a sound and reduces the players health as well)
Here's the code that checks to see if the player is looking at the monster:
Code: Select all
void () iseeslendy =
{
local entity head;
if (self.view_ofs == '0 0 0')
return; // intermission or finale
if (self.deadflag)
return;
head = findradius(self.origin, 256);
while (head)
{
if (head.classname == "slender")
{
if ((visible(head)) && (infront(head)) && (self.health > 0))
{
spotted = 1;
}
}
head = head.chain;
}
}
Code: Select all
void() slender_spotted =
{
if(spotted_time > time || self.health <= 0)
{
return;
}else
{
makevectors(other.v_angle);
traceline (other.owner.origin , (other.owner.origin+(v_forward * 100)) , FALSE , other);
sound (self, CHAN_WEAPON, "misc/screme.wav", 1, ATTN_STATIC);
setorigin(other,other.origin + trace_endpos);
sprint (self, "Slender teleported successfully!!!!!!!!1111ONEONEONE11!\n");
self.health = self.health - 10;
spotted_time = time + 12;
}
}
Anyways, what happens is slender_spotted gets called and both the monster and the player fall under the map, I do see the sprint when this happens, so I know it's the teleporting that causes it, which doesn't make sense to the slightest to me. Anyone know why this could be happening? Thanks for the help as always!