Forum

> > CS2D > Scripts > [REQ] Hud images
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch [REQ] Hud images

15 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt [REQ] Hud images

Xseba360
User Off Offline

Zitieren
Hello,
Could anyone make a script that:
> When you spawn, there is image on your hud ( gfx/hud/CSS_n.png)
> When you use weapon that doesn't require ammo like knife, chainsaw, portalgun (the ammo bar is invis) it shows another image ( gfx/hud/CSS_k.png )
> When you die, it disappears, so it doesn't stay in hud when you spectate.
> Works on listenserver (from other thread i learned cs2d lua hook startround isnt called when on listenserver)
Both of the images are PNGs and are 640x480
This is gonna be included in mod of mine so if you want i'll put you in the credits...

alt Re: [REQ] Hud images

Alistaire
User Off Offline

Zitieren
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
27
28
29
30
31
32
33
34
35
36
37
-- add all melee stuff in huditms
huditms = {}
huditms[50] = 1
huditms[69] = 1

hud = {}
for i = 1, 32 do hud[i] = 0 end

addhook('spawn', 'AA_spawn')
addhook('select', 'AA_select')

function AA_hud(id, t)
	hud[id] = image('gfx/hud/CSS_'..t..'.png', 320, 240, 2, id)
end

function AA_spawn(id)
	local c = false
	for i = 1, #huditms do
		if huditms[i] == player(id, 'weapontype') then
			AA_hud(id, 'k')
			c = true
			break
		end
	end
	if c == false then
		AA_hud(id, 'n')
	end
end

function AA_select(id, type)
	freeimage(hud[id])
	if huditms[type] == 1 then
		AA_hud(id, 'k')
	else
		AA_hud(id, 'n')
	end
end

EDIT

EDIT 2

I see what you want to do, this should work.
2× editiert, zuletzt 03.08.12 19:17:57

alt Re: [REQ] Hud images

Xseba360
User Off Offline

Zitieren
@user Alistaire
EDIT:
That sorta doesnt work either...
I'll upload the images and screenshot how does it look ingame.
https://dl.dropbox.com/u/19656788/cs2d/de_dust2_css_rc2_00000.png
https://dl.dropbox.com/u/19656788/cs2d/de_dust2_css_rc2_00001.png
https://dl.dropbox.com/u/19656788/cs2d/CSS_n.png
https://dl.dropbox.com/u/19656788/cs2d/CSS_k.png
EDIT2:
when i switch back from knife to pistol it's fine but when i switch back it's again like on screenshot 2
2× editiert, zuletzt 03.08.12 17:20:10

alt Re: [REQ] Hud images

omg
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
hud={}
melee={50,41,69,74,78,85}

addhook("startround","rofl_mao")
function rofl_mao()
	for id=1,32 do
		hud[id]=image("gfx/hud/CSS_n.png",0,1,200+id,id)
	end
end

addhook("select","prized_potato")
function prized_potato(id,weapon)
	freeimage(hud[id])
	for _,match in pairs(melee) do
		if weapon==match then
			hud[id]=image("gfx/hud/CSS_k.png",0,1,200+id,id)
			return
		end
	end
	hud[id]=image("gfx/hud/CSS_n.png",0,1,200+id,id)
end

rofl_mao()
1× editiert, zuletzt 04.08.12 18:09:14

alt Re: [REQ] Hud images

Alistaire
User Off Offline

Zitieren
user omg hat geschrieben
Spoiler >


Your script does this:

- triggers startround once
- on startround everyone gets the same hud
- if someone selects, first the image gets freed
- if the weapon matches a weapon in the table use a melee hud
- then, just add another random image over the melee image (if it's there), making it impossible to free it

Bitchplease.

alt Re: [REQ] Hud images

omg
User Off Offline

Zitieren
r u dumb or something? the function returns if it finds a melee match. u always let urself get corrected by me so easily

alt Re: [REQ] Hud images

Alistaire
User Off Offline

Zitieren
user omg hat geschrieben
r u dumb or something? the function returns if it finds a melee match. u always let urself get corrected by me so easily


You're wrong on this one.

alt Re: [REQ] Hud images

omg
User Off Offline

Zitieren
how am i wrong? the compiler skips over my returns? bitchplease
1× editiert, zuletzt 04.08.12 21:33:24

alt Re: [REQ] Hud images

omg
User Off Offline

Zitieren
oh woops, replace the +200s with +132
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
hud={}
melee={50,41,69,74,78,85}

addhook("startround","rofl_mao")
function rofl_mao()
     for id=1,32 do
          hud[id]=image("gfx/hud/CSS_n.png",0,1,132+id,id)
     end
end

addhook("select","prized_potato")
function prized_potato(id,weapon)
     freeimage(hud[id])
     for _,match in pairs(melee) do
          if weapon==match then
               hud[id]=image("gfx/hud/CSS_k.png",0,1,132+id,id)
               return
          end
     end
     hud[id]=image("gfx/hud/CSS_n.png",0,1,132+id,id)
end

rofl_mao()

alt Re: [REQ] Hud images

omg
User Off Offline

Zitieren
oh. try using alistaires image setup then:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
hud={}
melee={50,41,69,74,78,85}

addhook("startround","rofl_mao")
function rofl_mao()
     for id=1,32 do
          hud[id]=image('gfx/hud/CSS_n.png', 320, 240, 2, id)
     end
end

addhook("select","prized_potato")
function prized_potato(id,weapon)
     freeimage(hud[id])
     for _,match in pairs(melee) do
          if weapon==match then
               hud[id]=image('gfx/hud/CSS_k.png', 320, 240, 2, id)
               return
          end
     end
     hud[id]=image('gfx/hud/CSS_n.png', 320, 240, 2, id)
end

rofl_mao()

alt Re: [REQ] Hud images

Alistaire
User Off Offline

Zitieren
user omg hat geschrieben
1
[b]hud[id]=image('gfx/hud/CSS_n.png', 320, 240, 2, id)


You really don't get it do you. This line is wrongly placed.

alt Re: [REQ] Hud images

omg
User Off Offline

Zitieren
alistaire, i have no idea what ur talking about. at least clarify if u think im wrong
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht