CheckCollision ?

mycroft

Script Author: MyPrices
Maybe I'm doing something wrong...

I'm testing to see if there is LOS to a node from the characters current LOC, even if a node (actor) is almost right next to the character and there are no rocks etc in the way this returns almost always TRUE?

Is the LOS code very fussy about inclines etc?

Code:
${EQ2.CheckCollision[${Me.X},${Me.Y},${Me.Z},${Actor[${HID}].X},${Actor[${HID}].Y},${Actor[${HID}].Z}]}
 

Pygar

EQ2Bot Specialist
I think it can be.

LOS is checking if you can see the 'foot' of the actor, or it's base. You might shift the check to check 5 distance over the targets reported height.

Does that make sense?
 

mycroft

Script Author: MyPrices
I think it can be.

LOS is checking if you can see the 'foot' of the actor, or it's base. You might shift the check to check 5 distance over the targets reported height.

Does that make sense?
Yep , Actor.Y+5 , I know what you mean
 

mycroft

Script Author: MyPrices
Question - whats wrong with this

I coded a routine so that if the LOS to a node was blocked , to check in a circle around the character until it finds a point where it can see past the obstruction.

The routine will then move the character to this 'mid-point' then move on to the node.


Only problem is , the code looks correct but the logic doesn't seem to work...but I can't figure out why.

The 3 parameters passed to it are the X (Y+2) and Z location of the node.

Code:
function LOScircle(float CX, float CY, float CZ)
{
	Echo checking alternative route to : ${CX} ${CY} ${CZ}
	
	; angle of the point on the circle
	variable int circleangle=1
	
	; x and z location of the point on the circumfrence
	variable float px
	variable float pz
	
	; radius of the circle
	variable int cradius=2
	
	do
	{
		Echo Circle Radius ${cradius}
		do
		{
			; get the X,Z point on the circle
			px:Set[${Math.Calc[${cradius} * ${Math.Cos[${circleangle}]}]}]
			pz:Set[${Math.Calc[${cradius} * ${Math.Sin[${circleangle}]}]}]

			; Add it to the character location to give the mid-loc
			px:Set[${Math.Calc[${px}+${Me.X}]}]
			pz:Set[${Math.Calc[${pz}+${Me.Z}]}]
			
			; check to see if the mid-loc being checked is not blocked also
			
			if !${EQ2.CheckCollision[${Me.X},${Me.Y},${Me.Z},${px},${CY},${pz}]}
			{
				; check to see if there is LOS from that mid-loc to the node
				if !${EQ2.CheckCollision[${px},${CY},${pz},${CX},${CY},${CZ}]}
				{
					call moveto ${px} ${pz} 5 0 3 1
					waitframe
					call moveto ${CX} ${CZ} 5 0 3 1
					Return THERE
				}
				
			}
		}
		; move 5 degree angle along circumfrence
		while ${circleangle:Inc[5]} <=359
		circleangle:Set[1]
	}
	; increase the size of the circle
	while ${cradius:Inc} <=10
	return STUCK
}
Any thoughts would be welcome....the alternative code I'm using is very bulky and not as 'elegant'.


Edit : NM....I got it working....
 
Last edited:

mycroft

Script Author: MyPrices
Putting the new version up on the SVN...

Next update will include a way to select which nodes to harvest by 'type' using a small UI...
 
Top Bottom