Page 1 of 1

VARANAS event

Posted: Sat Feb 02, 2013 3:49 pm
by Mer-Ki-Vah
HI everybody!


Please help me.
The connected file is usuable 1-2 round, but after that the game is Crashing.
I dont now why, so thats while i ask you to help me.
Can it be changing : objectList:size() ??
If somebady solved this problem, please link the correct file !!!!!

Lets do it :D :geek:

Re: VARANAS event

Posted: Sat Feb 02, 2013 11:59 pm
by rock5
I'm not familiar with the event but is it possible that while it is going through the object list in "findmob" that they might move or disappear, eg. if someone else uses them? If so you should update each object before checking it. eg.

Code: Select all

			local obj = objectList:getObject(i);
			obj:update()
			if (  obj ~= nil ) then	
That way if the object no longer exists obj will == nil and it will skip it.

Re: VARANAS event

Posted: Sun Feb 03, 2013 7:30 am
by Mer-Ki-Vah
Well. I'm thinking a lot about the solution.
Please test it and please tell me if somebady has the correct rutin.
My current modifycation this part:

Code: Select all

function findMOB(_range)
	printf("\n Mob find starting.\n");
	if RoMScript("ExtraActionBarFrame:IsVisible()") then printf("\n Actionbar visible.\n"); end;
	player:updateXYZ();
	while RoMScript("ExtraActionBarFrame:IsVisible()") do
		local obj = nil;
		local objectList = CObjectList();
		objectList:update();		
		for i = 0,objectList:size() do			
			local obj = objectList:getObject(i);
			if (  obj ~= nil ) then 
				if RoMScript("GetPing()")>70 then yrest(200);printf("\n Ping error.\n"); end;
				if	( ((obj.Name=="Kokomo") or (obj.Name=="Wood Cavy") or (obj.Name=="Baabaa Sheep")) and
					( _range >= math.floor (distance(obj.X,obj.Z,player.X,player.Z)) ) )  then
						
						player:target(obj);						
						RoMScript("UseExtraAction(1)");yrest(200);
						repeat
							player:update();
						until player.Casting==false
				end
			end
		end
	end
	yrest(2000);
	successful=true;
end

Re: VARANAS event

Posted: Sun Feb 03, 2013 8:31 am
by Jandrana
I tried your script, but it seems a function is missing:

Code: Select all

2:21pm - [string "..."]:3: attempt to call global 'lookatTarget' (a nil value)

Re: VARANAS event

Posted: Sun Feb 03, 2013 12:32 pm
by Mer-Ki-Vah
Ohh sry. Link this in Onload part:

Code: Select all

function lookatTarget(X,Z,Y)	
	local angle  = math.atan2(Z - player.Z, X - player.X);
	local yangle = math.atan2(Y - player.Y, ((X - player.X)^2 + (Z - player.Z)^2)^.5 );						
	player:faceDirection(angle, yangle);
	camera:setRotation(angle);
end

Re: VARANAS event

Posted: Mon Feb 04, 2013 9:18 pm
by lisa
I posted a little userfunction for this event, if you want to have a look.

http://www.solarstrike.net/phpBB3/viewt ... 491#p47491