While trying to correct the sword attachment in my game Tarrox, my script suddenly began to crash as I was trying to hit an entity (model) with the attached weapon.

Code:
function handle_weapon_collision()
{
	VECTOR*	weapon_base;
	VECTOR*	weapon_tip;
	
	ENTITY* weapon_holder = you;
	if(weapon_holder.attacking == 1)
	{
		you = NULL;
		vec_for_vertex(weapon_base.x, my, 12); 
		vec_for_vertex(weapon_tip.x, my, 1);
		result = c_trace(weapon_base.x, weapon_tip.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX | USE_POLYGON | SCAN_TEXTURE);
		if(you != NULL)
		{
			if(you.object_typ == 1) 
			{
				if(you.blocking == 0)
				{
					you.health -= my.weapon_damage;
				}
				else
				{
					if (abs(ang(my.pan - you.pan)) >= 45) 
					{
						//block
					}
					else
					{
						you.health -= my.weapon_damage;
					}
				}
			}
		}
	}
}

action attach_sword()
{
	set(my, PASSABLE);
	my.weapon_damage = 50;
	proc_mode = PROC_LATE;
	while(you.health>0)
	{
		vec_for_bone(my.x, you, "weapon");
		ang_for_bone(my.pan, you, "weapon");
		
		handle_weapon_collision();
		wait(1);
	}
}



I closed the window before I ran my game... So I couldn't undo it.
I really have no idea what the problem is confused

Last edited by Random; 04/09/12 23:46.