I tried your fix Edwards, but the form manager still doesn't spawn until you sing a song of some kind, I think it's because the songs.lua doesn't execute until you sing a valid song of some kind.
Also I'm having some trouble with some nested loops. I've been trying to write a a simple while loop to test the best position to warp Naija to if the player clicks on solid rock using the dot_product function.
function getNearestPoint (cx,cy,i)
--cx and cy are target point, i is number of itterations to check for.
cc = createEntity ("collision_check","",cx,cy)
local bx =0
local by =0
--cc is a dummy entity, all it has is a collision radius.
if entity_isNearObstruction (cc, 1, OBSCHECK_RANGE) == false then
--if there isn't anything in the way just set the best spot to the target point
bx= cx
by= cy
else
-- Naija's x and y
local nx,ny = entity_getPostion(n)
-- dot product, half way between Naija and the target point
local dx,dy = vector_dot (cx,cy,nx,ny)
-- the best spot found.
local bx,by = 0,0
-- blocks eternal itterations.
if i < 1 then i =1 end
while i > 0 do
-- put a collision checking object in where we want to test
entity_setPositionX (cc,dx)
entity_setPositionY (cc,dy)
--this control hint never fires
setControlHint("test 2", 0, 0, 0,1 )
if entity_isNearObstruction (cc, 1, OBSCHECK_RANGE) then
-- if it does collide, test a point closer to Naija
dx,dy = vector_dot (dx,dy,nx,ny)
else
-- if it doesn't collide, save that spot and test a spot futher away.
-- more itterations means you'll get closer to the obstruction.
bx,py = dx,dy
dx,dy = vector_dot (cx,cy,dx,dy)
end
i = i-1
end
end
--clean up the dummy checker.
entity_delete(cc)
--return the best spot to use
return bx, by
end
The while loop works, the if loop works, they just don't work when I nest an if inside a while loop. It's quite frustrating. I've also probably used dot_vector() incorrectly based on my incredibly shaky memory of maths.
Since I'm on the subject of problems. I've started to try and implement a skill on the RMB, and for some reason isRightMouse () registers NOTHING right now. Perhaps I have to set some kind of state on the node or something. I can kludge in using "entity_setActivation" but that means the cursor glows all the time, registering that it's over something that can be activated.