Page 1 of 1
Only half of tech image shown
Posted: Thu Oct 10, 2013 4:12 am
by FreeER
I'm reworking the Tutorial on the Wiki (that adds a bomber) and for some reason only the right half of my technology icon is being shown in the research menu
Can anyone tell me why?

- 64x64 only half shown
- bomber_tech.png (8.5 KiB) Viewed 4764 times

- The larger image that I resized with Adobe PhotoShop to be 64x64
- bomber_tech_old.png (13.33 KiB) Viewed 4764 times
if for some reason you'd like to download the rest of the mod (maybe because you are lazy and do not want to change code to make it use the bomber_tech.png) the Tutorial is
here. I encountered this issue in Chapter 5 (which is where the technology is added).
Re: Only half of tech image shown
Posted: Thu Oct 10, 2013 6:35 am
by Nirahiel
Maybe because the icons should be 32 by 32 ?

Re: Only half of tech image shown
Posted: Thu Oct 10, 2013 6:48 am
by FreeER
Nirahiel wrote:Maybe because the icons should be 32 by 32 ?

lol, I wondered that myself, but if that was the case
1) it would show a quarter of the image not half and
2) the images in /data/base/graphics/technology are 64x64
I wish it were that simple though...
Re: Only half of tech image shown
Posted: Thu Oct 10, 2013 7:09 am
by Nirahiel
Here are some improvements for your code :
Code: Select all
local drop = false
local biters = 0
for k,v in pairs(bomb) do
if v.force.equals(game.forces.enemy) then
drop = true
if v.name == "small-biter" or v.name == "medium-biter" or v.name == "big-biter" then
biters = biters + 1
if biters < 5 then --if five or more will be killed then drop
drop = false
end
end
end
end
You create a drop var and set it to false, then for each entity of the bomb table, you reset it back to true, and then back to false again if biters < 5.
Here is what I'd do :
Code: Select all
local drop = false
local biters = 0
for k,v in pairs(bomb) do
if v.force.equals(game.forces.enemy) then
if v.name == "small-biter" or v.name == "medium-biter" or v.name == "big-biter" then
biters = biters + 1
end
end
end
if biters > 4 then
drop = true
end
But then you could make your script even better by not calling a for loop and just doing
Code: Select all
local enemies = game.findenemyunits(game.player.character.position, 5)
Find all enemies in a radius of 5 around the player.
Then something like
Code: Select all
if #enemies > 4 then
drop = true
end
should work

Re: Only half of tech image shown
Posted: Thu Oct 10, 2013 7:23 am
by FreeER
Nirahiel wrote:Here are some improvements for your code :
In your first 'improved' code, it only gets set to true if there are more than 4 biters, if you happen to run across a spawner (and it for some reason does not have enough biters) you'd be unable to destroy it. Also I seemed to have issues with targeting worms...
Ah I forgot about findenemyunits (actually I don't think it existed when I originally made this mod) lol. That would certainly make it much better, BUT I also intend to change it to use capsules so that the player can actually control the bombs. Before the capsules were created I thought about using code to auto switch out the player's weapon with a rocket launcher (or similar) but...capsules just seem like a better idea to me xD
Re: Only half of tech image shown
Posted: Thu Oct 10, 2013 8:34 am
by rk84
@FreeER There is one thing that has been bothering me for while
Talk:Modding_Tutorial
Re: Only half of tech image shown
Posted: Thu Oct 10, 2013 8:42 am
by Nirahiel
FreeER wrote:Nirahiel wrote:Here are some improvements for your code :
In your first 'improved' code, it only gets set to true if there are more than 4 biters
Same thing for you dude, if you set it to true, but then set it to false again before the end of the for loop, then after the for loop exits, your variable will be set to false.
I really just improved your code, I didn't change it's behavior.
The get enemies thing should also target worms and spawners ... i guess
Re: Only half of tech image shown
Posted: Thu Oct 10, 2013 10:14 am
by kovarex
Try to delete crop-cache, it's location depends on system, but it is in the directory where you saves directory is.
Re: Only half of tech image shown
Posted: Thu Oct 10, 2013 5:15 pm
by FreeER
kovarex wrote:Try to delete crop-cache, it's location depends on system, but it is in the directory where you saves directory is.
ah ha! You sir are a genius
Oh, I'll fix that lol! I don't think I really truly understood those two files when I wrote the tutorial lol
Re: Only half of tech image shown
Posted: Sat Dec 21, 2013 12:01 pm
by Animar
Back to Topic
FreeER wrote:
I'm reworking the Tutorial on the Wiki (that adds a bomber) and for some reason only the right half of my technology icon is being shown in the research menu
Can anyone tell me why?
I run in the same issue 32 Pixel just work fine but in a very ugly way, if i try to use 64x64 ( wich even the base research imgaes are ) i got only the top left quarter shown, as you can see

Re: Only half of tech image shown
Posted: Sat Dec 21, 2013 12:53 pm
by kovarex
Animar wrote:Back to Topic
FreeER wrote:
I'm reworking the Tutorial on the Wiki (that adds a bomber) and for some reason only the right half of my technology icon is being shown in the research menu
Can anyone tell me why?
I run in the same issue 32 Pixel just work fine but in a very ugly way, if i try to use 64x64 ( wich even the base research imgaes are ) i got only the top left quarter shown, as you can see

This didn't help?:
kovarex wrote:Try to delete crop-cache, it's location depends on system, but it is in the directory where you saves directory is.
Re: Only half of tech image shown
Posted: Sat Dec 21, 2013 1:21 pm
by Animar
I shouldn't do anything if i where half asleep, i apologize that i didn't saw that you already posted a solution for that
