Page 1 of 1
How i make when a tool hurt me, my screen turns blue?
Posted:
Thu May 12, 2016 01:22
by MineYoshi
Only i want to change the color, that don't be red, that be blue or a random color!
How i do that?
Re: How i make when a tool hurt me, my screen turns blue?
Posted:
Thu May 12, 2016 07:39
by Calinou
Changing the hurt flash color/effect is currently not possible without modifying the engine.
Re: How i make when a tool hurt me, my screen turns blue?
Posted:
Sat May 14, 2016 16:55
by azekill_DIABLO
*cries*
Re: How i make when a tool hurt me, my screen turns blue?
Posted:
Sat May 14, 2016 20:44
by AiTechEye
Like this?
it replacing the red flash effect with randomly colors
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_on_player_hpchange(function(player, hp_change)
if hp_change<0 then
local name=player:get_player_name()
minetest.after(0, function(name,player)
local r,g,b=screencolor.rndhexcolor(),screencolor.rndhexcolor(),screencolor.rndhexcolor()
screencolor.user[name]=player:hud_add({
hud_elem_type = "image",
text ="screencolor_scr.png^[colorize:#" .. r .. g .. b .. "aa",
name = "rndcsc",
scale = {x=-100, y=-100},
position = {x=0, y=0},
alignment = {x=1, y=1},
})
end,name,player)
minetest.after(0.8, function(name,player)
player:hud_remove(screencolor.user[name])
screencolor.user[name]=nil
end,name,player)
end
end)
screencolor={user={}}
--screencolor.user[name] then id is stored as a global var if you want to use it to somthing
function screencolor.rndhexcolor()
local a="0123456789ABCDEF"
local a1=math.random(1,16)
local a2=math.random(1,16)
return string.sub(a,a1,a1) .. string.sub(a,a2,a2)
end
Re: How i make when a tool hurt me, my screen turns blue?
Posted:
Sat May 14, 2016 23:14
by ExeterDad
UjEdwin wrote:Like this?
it replacing the red flash effect with randomly colors[/code]
I am totally saving that snippet for later! Awesome!
Re: How i make when a tool hurt me, my screen turns blue?
Posted:
Sun May 15, 2016 21:44
by Minetestforfun
@UjEdwin
Exellent idea, thank you for the tip !
Re: How i make when a tool hurt me, my screen turns blue?
Posted:
Tue May 17, 2016 19:59
by AiTechEye
many things is possible in minetest, even people dont know it :-)
Re: How i make when a tool hurt me, my screen turns blue?
Posted:
Wed May 18, 2016 15:24
by azekill_DIABLO
UjEdwin wrote:many things is possible in minetest, even people dont know it :-)
this is true ;)
Re: How i make when a tool hurt me, my screen turns blue?
Posted:
Wed May 18, 2016 21:41
by MineYoshi
Yay!
For the positivism quotes!
Re: How i make when a tool hurt me, my screen turns blue?
Posted:
Mon May 23, 2016 22:59
by MineYoshi
A question, how to make exactly white?
I mean if you can setup what color turns the screen when you are in lava, how you can't do it with a tool?
Re: How i make when a tool hurt me, my screen turns blue?
Posted:
Tue May 24, 2016 16:50
by AiTechEye
you can do it with everything that works with the code :-)
the screencolor.rndhexcolor() makes a random code (0 to F)
image.png^add_effect_or_image
How hex/colors works:
the last 6 numbers is replaced with letters
0.1.2.3.4.5.6.7.8.9.10.11.12.13.14.15
0.1.2.3.4.5.6.7.8.9..A..B...C...D..E..F
so 3E = 3*14
red,green,blue,alpha
NN.NN.NN.NN
......................red....green...blue....alpha
3EFFBCFF = 3*14, 15*15,11*12, 15*15
so FFFFFFFF = full,full,full,ful = 100% white