Page 13 of 14

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Mon Dec 02, 2013 9:05 am
by rido_knight
Master please this Yolius reward change optional because im using exp pie on my second class.First class level 82 so exp not important it.Thanks

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Mon Dec 02, 2013 9:29 am
by rock5
It is optional. Change Use_XP_TP_Rewards to false.

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Mon Dec 02, 2013 9:35 am
by rido_knight
rock5 wrote:It is optional. Change Use_XP_TP_Rewards to false.
sorry ^_^ i searched "pie" :P thanks

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Mon Jul 27, 2015 8:43 am
by cokebot
I want this element script to stop attacking when i reached 60 points,
but i doesn't count. I didn#t changed the counting variable so I also don't know the problem, hope you can help me.

Code: Select all

		<![CDATA[
			benice   = true		-- Be nice to other players
			maxdist  = 150    	-- Max dist to take an element on
			slowdown = 1000		-- Pause after taking an element
			white 	 = true
			
			-- To go 'rape mode' set maxdist to 200 and slowdown to 0, 
			-- perhaps reduce yrest(200) in loop
			
			brel = {}
			brel[121055]={Id=103013,color="Red"}
			brel[121057]={Id=103015,color="Blue"}
			brel[121056]={Id=103014,color="Yellow"}
			
			-- Wait until NPC can be talked to "Let me help you out!"
			_npc = GetIdName(120888)
			cprintf(cli.lightblue, "Waiting for event registration with %s!\n", _npc)
			repeat 
				-- Target NPC
				repeat				
					if not player:target_NPC(_npc) then
						error("Can't find NPC ".._npc)
					end
					yrest(1000)
				until RoMScript("SpeakFrame:IsVisible()")
				yrest(500)

				-- Start event
				ChoiceOptionByName("Lasst mich")
				yrest(500)
				if not player:hasBuff(623044) then
					yrest(60000)
				end
			until player:hasBuff(623044)
			cprintf(cli.lightblue, "Waiting for event to start!\n")
			repeat yrest(1000) until player:hasBuff(623041)
			cprintf(cli.lightblue, "Event started!\n")
			
			-- Setup event
			color = nil
			helped = 0
			hname = GetIdName(623045)
			npc = player:findNearestNameOrId({120888})
			
			-- Do event
			repeat
				bobj = player:findNearestNameOrId({121055, 121056, 121057})
				if bobj then
					if color ~= brel[bobj.Id].color then
						color = brel[bobj.Id].color
						cprintf(cli.lightblue, "Bubble changed to %s\n", color)
					end
					
					-- Wait until element is a little closer, looks bad killing at spawn
					obj=player:findNearestNameOrId({103013, 103014, 103015, 106548})					
					if obj and distance(npc.X, npc.Z, npc.Y, obj.X, obj.Z, obj.Y) < maxdist then
						player:target(obj)
						if obj.Id == brel[bobj.Id].Id then
							RoMScript("UseExtraAction(1)")
						else
							RoMScript("UseExtraAction(2)")
						end
						
						-- Keep track of number of times helped
						if player.Buffs[hname] then
							helped = player.Buffs[hname].Level
						end
						
						-- Stop when60 Points is reached
						if helped > 59 then
							repeat
							yrest(5000)
							player:updateBuffs()
							until not player:hasBuff(623041)	
						end

						-- If other players in circle, slow down
						if CountPlayers(200) > 0 then
							yrest(slowdown) 
						else 
							yrest(200) 
						end
					end
				end
				
				yrest(200)
				player:updateBuffs()
			until not player:hasBuff(623041)

			-- And were done
			cprintf(cli.lightblue, "You got %d points\n", helped)
   			error("Finished")
		]]>

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Mon Jul 27, 2015 9:21 am
by rock5
This is wrong.

Code: Select all

                  -- Keep track of number of times helped
                  if player.Buffs[hname] then
                     helped = player.Buffs[hname].Level
                  end
The player.Buffs table is not listed by name (or id). It's just and indexed table, ie. [1] = buff1, [2] = buff2 etc.

Try this instead.

Code: Select all

-- Keep track of number of times helped
local  hasBuff, count = player:hasBuff(hname)
if hasBuff then
    helped = count
end
You can just change that over.

You can also do something like

Code: Select all

                  -- Stop when60 Points is reached
                  if player:hasBuff(hname,60) then
                     repeat
                     yrest(5000)
                     player:updateBuffs()
                     until not player:hasBuff(623041)   
                  end

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Mon Jul 27, 2015 10:02 am
by cokebot
Thy Rock, I will test it tomorrow.
I made something similiar befor, but the client chrashed.

Code: Select all

						if player:hasBuff(623045) then
							buff = player:getBuff(623045);
							if buff.Level >= 60 then
							repeat
							yrest(5000)
							player:updateBuffs()
							until not player:hasBuff(623041)
							end
						end  

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Mon Jul 27, 2015 10:48 am
by rock5
You need to check if the buff exists first. So change this

Code: Select all

if buff.Level >= 60 then
to

Code: Select all

if buff and buff.Level >= 60 then

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Tue Jul 28, 2015 9:34 am
by cokebot
I tried your code today rock, but the client chrashed again.
Unbenannt.JPG

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Tue Jul 28, 2015 2:26 pm
by rock5
Argument #1 is getProc(). Sorry, but I don't know under what conditions getProc() would fail to return a value. As far as I know it should only fail if the client crashes or mm looses communication with it. are you having any performance issues?

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Wed Jul 29, 2015 5:05 am
by cokebot
I don't have any performance issus, but i'm using a model folder. Can that be the problem?

Because you wrote that it is a performance issu i added a yrest and now it works fine, thank you.

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Wed Jul 29, 2015 5:38 am
by rock5
Well you tell me. Remove the model folder and see it it reoccurs. I don't use the model folder anymore so I don't know what sort of problems it might cause.

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Tue Aug 18, 2015 9:18 am
by beanybabe
Cattle.xml is getting a nul error playeringrange

Code: Select all

		function isCowFree(cow)
				return not player:PlayerInRange(75, cow._X, cow._Z)
			end

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Wed Aug 19, 2015 12:37 am
by rock5
I'm not sure where that function is from. It might be from some userfunction that was not mentioned or he forgot to include it. But if all it does is return if the cow is not in range you can replace it with some simple code eg.

Code: Select all

function isCowFree(cow)
	player:updateXYZ()
	return distance (player,cow) > 75
end
I think that's right. It has to return true if the cow is out of range.

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Thu Aug 20, 2015 1:48 am
by beanybabe
It was strange i had used the same wp couple years back and it worked, something changed. Ill give your idea a go.

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Thu Jun 23, 2016 7:41 am
by Sasuke
hi guys,i need help because i use elementconverter.xml but don't work.i have always -1-1-1-1-1-1-1-1-1 .....i try to change title in "false" but not work...any suggestion?

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Thu Jun 23, 2016 8:11 am
by kenzu38
Had a look at the file. Just look for these lines and delete them:

Code: Select all

	if GetFailureTitle and not HaveFailureTitle then
		color = color + 1
		if color == 4 then color = 1 end
	end
If it still doesn't work after that, then your problem doesn't have any thing to do with failure title.

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Thu Jun 23, 2016 10:04 am
by Sasuke
ty i try

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Thu Jun 23, 2016 10:11 am
by Sasuke
cannot see the target,already casting and still -1.......what happen?i delete this line but not success

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
	--         Rock5's Element Converter
	--               Version 1.2
	--
	-- Thank's to Lisa for her original version

	-- User options ----------------------------

	local PauseBetweenCasts = 100			-- In ms
	local BallSizeToClick = 1.1 			-- Values between 0.5 and 2.5 (1.1 is optimal. Don't change)
	local GetFailureTitle = false			-- Set true to get title "There is nothing I cannot Break!" only if you don't have it.
	local ExchangeForCertificates = true	-- Auto exchanges Universal Components for Certificates.

	local When_Finished = "end"
		-- "end" to end script, "relog" to log next character, "charlist" to log next in 'charlist' and "waypointfilename" to load that waypointfile.

	local CharList = {}
		-- Character list to use when using the "charlist" option above. Requires my "userfunction_LoginNextChar" userfunction.
		-- Find it here. http://www.solarstrike.net/phpBB3/viewtopic.php?p=10350
		--		eg.
		--		CharList = {
		--			{account=4,chars={}},
		--			{account=8,chars={1}},
		--			{account=7,chars={1,2,5}},
		--		}

	--------------------------------------------

	local HaveFailureTitle = RoMScript("} for i = 0, GetTitleCount() do name, titleID, geted = GetTitleInfoByIndex(i) if titleID == 530897 then a = {geted} end end z= {")

	local Converters = {
		{
			Converter = {X = 3158, Z = -57},
			Balls = {{X = 3197, Z = 0}, {X = 3164, Z = 11}, {X = 3126, Z = 0}, {X = 3097, Z = -31}, {X = 3094, Z = -73}},
			CameraPos = {3084,203,60},
			Place = {{W = -0.333, H = 0.165}, {W = -0.226, H = 0.308}, {W = 0, H = 0.376}, {W = 0.255, H = 0.319},{W = 0.401, H = 0.157}},
		},
		{
			Converter = {X = 3002, Z = 123},
			Balls = {{X = 2982, Z = 60}, {X = 3015, Z = 66}, {X = 3048, Z = 86}, {X = 3062, Z = 116}, {X = 3061, Z = 149}},
			CameraPos = {3112,203,35},
			Place = {{W = -0.394, H = 0.157 }, {W = -0.248, H = 0.271}, {W = -0.023, H = 0.334}, {W = 0.172, H = 0.275}, {W = 0.308, H = 0.155}},
		},
		{
			Converter = {X = 3366, Z = 340},
			Balls = {{X = 3306, Z = 345}, {X = 3322, Z = 310}, {X = 3355, Z = 290}, {X = 3391, Z = 300}, {X = 3414, Z = 320}},
			CameraPos = {3340,203,204},
			Place = {{W = -0.364 , H = 0.077 }, {W = -0.243 , H = 0.230 }, {W = -0.027 , H = 0.296 }, {W = 0.161 , H = 0.195 }, {W = 0.259 , H = 0.077 }},
		},
		{
			Converter = {X = 3471, Z = 140},
			Balls = {{X = 3501, Z = 209}, {X = 3463, Z = 213}, {X = 3425, Z = 193}, {X = 3402, Z = 167}, {X = 3406, Z = 129}},
			CameraPos = {3365,203,259},
			Place = {{W = -0.405, H = 0.088 }, {W = -0.264, H = 0.236 }, {W = -0.018, H = 0.285 }, {W = 0.189, H = 0.265 }, {W = 0.306, H = 0.097 }},
		},
	}

	local settings

	function relog()
		if When_Finished == "relog" then
			ChangeChar()
			waitForLoadingScreen();
			yrest(3000)
			loadProfile()
			loadPaths(__WPL.FileName);
		elseif When_Finished == "charlist" then
			SetCharList(CharList)
			LoginNextChar()
			loadProfile()
			loadPaths(__WPL.FileName);
		elseif When_Finished == "end" then
			error("Ending script",2)
		else
			if not string.find(When_Finished,".", 1, true) then
				When_Finished = When_Finished .. ".xml"
			end
			local filename = getExecutionPath() .. "/waypoints/" .. When_Finished
			local file, err = io.open(filename, "r");
			if file then
				file:close();
				loadPaths(When_Finished)
			else
				error("'When_Finished' option is invalid",0)
			end
		end
	end

	function GetBalls()
		local objectList = CObjectList();
		objectList:update();
		local objSize = objectList:size()
		local obj
		local found = 0
		local Balls = {}
		for i = 0,objSize do
			obj = objectList:getObject(i);
			if (obj.Id == 120910 or obj.Id == 120911 or obj.Id == 120912) then
				local place
				if 5 > distance(obj.X, obj.Z, settings.Balls[1].X, settings.Balls[1].Z) then
					place = 1
				elseif 5 > distance(obj.X, obj.Z, settings.Balls[2].X, settings.Balls[2].Z) then
					place = 2
				elseif 5 > distance(obj.X, obj.Z, settings.Balls[3].X, settings.Balls[3].Z) then
					place = 3
				elseif 5 > distance(obj.X, obj.Z, settings.Balls[4].X, settings.Balls[4].Z) then
					place = 4
				elseif 5 > distance(obj.X, obj.Z, settings.Balls[5].X, settings.Balls[5].Z) then
					place = 5
				end

				if place then
					local tmpsize = memoryReadFloat(getProc(),obj.Address +0x74)
					local tmpcast = bitAnd(memoryReadByte(getProc(),obj.Address + 0xC8),0x8)
					if tmpsize >= BallSizeToClick and tmpcast == false then
						local tmpdata = {
							X = obj.X,
							Z = obj.Z,
							Id = obj.Id,
							Size = tmpsize,
							Place = place
							}
						table.insert(Balls,tmpdata)
					end
					found = found + 1
					if found > 4 then break end
				end
			end
		end
		table.sort(Balls,function (a,b) return a.Size > b.Size end)
		return Balls, found
	end

	function FindNearestConverterNotInUse()
		if distance(player.X,player.Z,3239,141) > 300 then
			return nil
		end
		local closest
		for i = 1,4 do
			settings = table.copy(Converters[i])
			local balls, found = GetBalls()
			if found == 0 then -- Available
				if closest == nil then
					closest = i
				else
					local last = Converters[closest].Converter
					local new  = Converters[i].Converter
					if distance(player.X,player.Z,last.X,last.Z) > distance(player.X,player.Z,new.X,new.Z) then
						closest = i
					end
				end
			end
		end
		return closest
	end

	function nomouse()
		-- x axis
		local addressX1 = addresses.functionMousePatchAddr
		local addressX2 = addresses.functionMousePatchAddr + addresses.mousePatchX2_offset
		local addressX3 = addresses.functionMousePatchAddr + addresses.mousePatchX3_offset
		memoryWriteString(getProc(), addressX1, string.rep(string.char(0x90),#addresses.functionMouseX1Bytes)); -- left of window
		memoryWriteString(getProc(), addressX2, string.rep(string.char(0x90),#addresses.functionMouseX2Bytes)); -- right of window
		memoryWriteString(getProc(), addressX3, string.rep(string.char(0x90),#addresses.functionMouseX3Bytes)); -- over window

		-- y axis
		local addressY1 = addresses.functionMousePatchAddr + addresses.mousePatchY1_offset
		local addressY2 = addresses.functionMousePatchAddr + addresses.mousePatchY2_offset
		local addressY3 = addresses.functionMousePatchAddr + addresses.mousePatchY3_offset
		memoryWriteString(getProc(), addressY1, string.rep(string.char(0x90),#addresses.functionMouseY1Bytes)); -- above window
		memoryWriteString(getProc(), addressY2, string.rep(string.char(0x90),#addresses.functionMouseY2Bytes)); -- below window
		memoryWriteString(getProc(), addressY3, string.rep(string.char(0x90),#addresses.functionMouseY3Bytes)); -- over window
	end

	-- Unfreeze mouse function
	function unnomouse()
		-- x axis
		local addressX1 = addresses.functionMousePatchAddr
		local addressX2 = addresses.functionMousePatchAddr + addresses.mousePatchX2_offset
		local addressX3 = addresses.functionMousePatchAddr + addresses.mousePatchX3_offset
		memoryWriteString(getProc(), addressX1, string.char(unpack(addresses.functionMouseX1Bytes)));
		memoryWriteString(getProc(), addressX2, string.char(unpack(addresses.functionMouseX2Bytes)));
		memoryWriteString(getProc(), addressX3, string.char(unpack(addresses.functionMouseX3Bytes)));

		-- y axis
		local addressY1 = addresses.functionMousePatchAddr + addresses.mousePatchY1_offset
		local addressY2 = addresses.functionMousePatchAddr + addresses.mousePatchY2_offset
		local addressY3 = addresses.functionMousePatchAddr + addresses.mousePatchY3_offset
		memoryWriteString(getProc(), addressY1, string.char(unpack(addresses.functionMouseY1Bytes)));
		memoryWriteString(getProc(), addressY2, string.char(unpack(addresses.functionMouseY2Bytes)));
		memoryWriteString(getProc(), addressY3, string.char(unpack(addresses.functionMouseY3Bytes)));
	end

	function useskill(target)
		local color = target.Id - 120909
		SlashCommand("/script UseExtraAction("..color..")")

		local wwidth = settings.Place[target.Place].W
		local wheight = settings.Place[target.Place].H

		local www = memoryReadIntPtr(getProc(),addresses.staticbase_char,addresses.windowSizeX_offset)
		local wwh = memoryReadIntPtr(getProc(),addresses.staticbase_char,addresses.windowSizeY_offset)
		local clickXw = math.ceil(www/2 + wwh*wwidth)
		local clickYw = math.ceil(wwh*wheight)
		memoryWriteIntPtr(getProc(),addresses.staticbase_char,addresses.mouseX_offset,clickXw)
		memoryWriteIntPtr(getProc(),addresses.staticbase_char,addresses.mouseY_offset,clickYw)
		yrest(50)
		SlashCommand("/script SpellTargetUnit()")
	end

	--Start Converter
	repeat
		local conv = FindNearestConverterNotInUse()

		if not conv then
			print("You're not near any Element Converters or none are available. Go to one, then continue.")
			player:sleep()
		else
			settings = table.copy(Converters[conv])
			player:moveInRange(CWaypoint(settings.Converter.X,settings.Converter.Z),50,true)
			player:target_NPC(120905) yrest(2000) -- Element Converter
			break
		end
	until false
	RoMScript("ChoiceOption(1)") -- Activates Element Converter.

	-- set camera distance
	camera:update()
	local oDist = camera.Distance
	camera:setDistance(150)

	-- Wait for balls to appear
	repeat
		yrest(1000)
		local balls ,found = GetBalls()
	until found > 0

	player:update()

	-- Set camera angle
	RoMScript(string.format("SetCameraPosition(%d, %d, %d)",settings.CameraPos[1],settings.CameraPos[2],settings.CameraPos[3]))

	local StartTime = os.clock()
	nomouse()
	while true do
		local Balls, Found = GetBalls()
		if Found == 0 or (os.clock() - StartTime) > 100 then -- finished
			break
		end

		-- Cast to all needed balls
		if #Balls > 0 then
			for k,v in pairs(Balls) do
				useskill(v)
				yrest(PauseBetweenCasts)
			end
		else
			yrest(PauseBetweenCasts)
		end
	end

	camera:setDistance(oDist)
	unnomouse()
	if ExchangeForCertificates and inventory:itemTotalCount(241606) > 0 then
		player:moveTo(CWaypoint(3280,287),true)
		player:target_NPC(120924) yrest(1500) -- Myden Neil
		RoMScript("ChoiceOption(2)") yrest(500)
	end

	relog()
</onLoad>
</waypoints>

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Fri Jun 24, 2016 5:49 pm
by kenzu38
You'll have to watch closely what's happening. Is it casting the wrong color? Or is the projectile reaching the ball when it's already disappeared?

I think you'll have to mess around with the user options.

Code: Select all

   local PauseBetweenCasts = 100         -- In ms
   local BallSizeToClick = 1.1          -- Values between 0.5 and 2.5 (1.1 is optimal. Don't change)
   

Re: Rock5's Constellation (Zodiac) Pet scripts

Posted: Wed Jul 03, 2019 5:06 pm
by Bat90
Hello,

Since there is Craft festival i want to get some wind elements by doing Element Convertor but i got this msg error, and i dont know hot to fix it. Can somebody help me :/


2019-07-03 23:58:40 - IGF:\SetCameraPosition(3112, 203, 35)\:IGF [string "local a={SetCameraPosition(3112, 203, 35)} ..."]:1: attempt to call global 'SetCameraPosition' (a nil value)


AL lib: DSoundOpenPlayback: Device init failed: 0x80070057
OpenAL error: alutInit() returned error code 'Invalid operation'
Please enter the script name to run.
Type in 'exit' (without quotes) to exit.
Script>