I have different monsters with different image sizes but when I try to change their
self.sizeit doesn't affect anything.
I've searched throughout the whole script and it's only used here:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
--[[ function occupied(x,y,monsterid) for n, m in pairs (MONSTERS) do if monsterid ~= n and math.sqrt(math.pow(math.abs(m.x-x),2) + math.pow(math.abs(m.y-y),2)) <= m.size then return true end end return false end ]]
I suppose
self.sizeis supposed to be checked in this hook:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
addhook("attack", "RPG.attackHookMonster") function RPG.attackHookMonster(id) 	if gettile(PLAYERS[id].x, PLAYERS[id].y).SAFE or gettile(PLAYERS[id].x, PLAYERS[id].y).NOMONSTERS then 		return 	end 	if inarray({400, 401, 402, 403, 404}, PLAYERS[id].Equipment[7]) then 		hudMsg(id,"You may not attack on a horse.","note") 		return 	end 	local weapon, closest = player(id, 'weapontype') 	for _, m in ipairs(MONSTERS) do 		local x, y = player(id, 'x'), player(id, 'y') 		local dist = math.sqrt((m.x-x)^2+(m.y-y)^2) 		if dist <= (closest and closest[2] or (CONFIG.WEAPONRANGE[weapon] or CONFIG.WEAPONRANGE[50])) then 			local rot = player(id, 'rot') 			if math.abs(math.rad(rot) - math.atan2(y-m.y, x-m.x) + math.pi/2)%(2*math.pi) <= (CONFIG.WEAPONWIDTH[weapon] or CONFIG.WEAPONRANGE[50]) then 				if free_line(player(id,"x"),player(id,"y"),m.x,m.y) then 					closest = {m, dist} 				end 			end 		end 	end 	if closest then 		closest[1]:damage(id,math.floor(((PLAYERS[id].tmp.atk*10)/closest[1].def)), weapon) 	end end
I've tried adding it to the function in random places but either it's not the right way or I've done it wrong.
Another place where it could be placed in is this function where I used to use the occupied function until it caused some issues and I was told I better off not use it:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function Monster:pos(x, y) 	if not x and not y then 		return self.x, self.y 	else 		--if not occupied(x,y,self.id) then 			self.x, self.y = x or self.x, y or self.y 		--end 		for all = 1, 32 do 			if player(all,"exists") and getHealth(all) > 0 then 				if player(all,"x") >= self.x-800 and player(all,"x") <= self.x+800 and player(all,"y") >= self.y-800 and player(all,"y") <= self.y+800 then 					imagepos(self.image, self.x, self.y, self.imgang) 					if not self.alpha then 						self.alpha=1 					end 					imagealpha(self.image, self.alpha) 					break 				end 			end 			if all == 32 then 				imagealpha(self.image, 0) 			end 		end 	end 	return true end
Does anyone have a clue on what I'm supposed to do to fix it?