I've been working on a mod for my own amusement, and to add some skill I wanted to have some of the weapons cause the view to move up each time the weapon was fired. The idea was to balance some of the more powerful automatic weapons I have added. It seemed easy, and the solution is, however I could not find it easily. It took probably 5 hours of experimenting, and searching, to finally figure out how to do it.
And no, self.punchangle does not create this effect; I wanted the actual aim point to climb each time the weapon was fired.
I ended up with this function that directly writes to the server to move the view.
Code: Select all
void(float vkick) WeaponRecoil =
{
msg_entity = self;
WriteByte(MSG_ONE, 10);
WriteAngle(MSG_ONE, self.v_angle_x - vkick);
WriteAngle(MSG_ONE, self.v_angle_y);
WriteAngle(MSG_ONE, self.v_angle_z);
};
Used like this after the weapon fires:
I thought it might be useful for someone trying to figure out how to make this work. It drove me nuts. Also, if someone knows a better way to do it, that would be great to know as well.