How i make when a tool hurt me, my screen turns blue?

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

How i make when a tool hurt me, my screen turns blue?

by MineYoshi » Thu May 12, 2016 01:22

Only i want to change the color, that don't be red, that be blue or a random color!
How i do that?
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

Re: How i make when a tool hurt me, my screen turns blue?

by Calinou » Thu May 12, 2016 07:39

Changing the hurt flash color/effect is currently not possible without modifying the engine.
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: How i make when a tool hurt me, my screen turns blue?

by azekill_DIABLO » Sat May 14, 2016 16:55

*cries*
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
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
AiTechEye
Member
 
Posts: 409
Joined: Fri May 29, 2015 21:14

Re: How i make when a tool hurt me, my screen turns blue?

by AiTechEye » Sat May 14, 2016 20:44

Like this?

it replacing the red flash effect with randomly colors

Image


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
Attachments
screencolors.zip
(995 Bytes) Downloaded 66 times
screenshot_20160514sssa_223918.png
screenshot_20160514sssa_223918.png (692.41 KiB) Viewed 1234 times
Alive AI Mine/Build AI NPC
Gravitygun HL2
Portalgun Portal
Marssurvive Survive on mars
Bows bows + arrows
SoundCloud (Music)
SoundCloud (Classic)
YouTube
 

User avatar
ExeterDad
Member
 
Posts: 1121
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad

Re: How i make when a tool hurt me, my screen turns blue?

by ExeterDad » Sat May 14, 2016 23:14

UjEdwin wrote:Like this?

it replacing the red flash effect with randomly colors[/code]

I am totally saving that snippet for later! Awesome!
٩(̾●̮̮̃̾•̃̾)۶

Kibbie and I have a beautiful public server now! HOMETOWN
 

User avatar
Minetestforfun
Member
 
Posts: 936
Joined: Tue Aug 05, 2014 14:09
GitHub: Darcidride
IRC: Darcidride + MinetestForFun
In-game: Darcidride + MinetestForFun

Re: How i make when a tool hurt me, my screen turns blue?

by Minetestforfun » Sun May 15, 2016 21:44

@UjEdwin
Exellent idea, thank you for the tip !
 

User avatar
AiTechEye
Member
 
Posts: 409
Joined: Fri May 29, 2015 21:14

Re: How i make when a tool hurt me, my screen turns blue?

by AiTechEye » Tue May 17, 2016 19:59

many things is possible in minetest, even people dont know it :-)
Alive AI Mine/Build AI NPC
Gravitygun HL2
Portalgun Portal
Marssurvive Survive on mars
Bows bows + arrows
SoundCloud (Music)
SoundCloud (Classic)
YouTube
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: How i make when a tool hurt me, my screen turns blue?

by azekill_DIABLO » Wed May 18, 2016 15:24

UjEdwin wrote:many things is possible in minetest, even people dont know it :-)


this is true ;)
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
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: How i make when a tool hurt me, my screen turns blue?

by MineYoshi » Wed May 18, 2016 21:41

Yay!

For the positivism quotes!
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

Re: How i make when a tool hurt me, my screen turns blue?

by MineYoshi » Mon May 23, 2016 22:59

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?
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

User avatar
AiTechEye
Member
 
Posts: 409
Joined: Fri May 29, 2015 21:14

Re: How i make when a tool hurt me, my screen turns blue?

by AiTechEye » Tue May 24, 2016 16:50

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
Alive AI Mine/Build AI NPC
Gravitygun HL2
Portalgun Portal
Marssurvive Survive on mars
Bows bows + arrows
SoundCloud (Music)
SoundCloud (Classic)
YouTube
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 6 guests

cron