Forum

> > CS2D > Scripts > imagealpha and freeimage after timer
Forums overviewCS2D overview Scripts overviewLog in to reply

English imagealpha and freeimage after timer

3 replies
To the start Previous 1 Next To the start

old imagealpha and freeimage after timer

Alistaire
User Off Offline

Quote
So this is my script;

Spoiler >


If there is just 1 player, the script creates a laserbeam on attack, and removes it after 1000 milliseconds. When I add some bots tho, the images stay there, and I think one of these values isn't playerbound or something, because when 1 player shoots, the fade of the previous player stops.

I can't see any error in the console and I don't know how to see what happens with stuff like print(value), so..

Could anyone help me

.. to fix the script so it works with multiple players too?

----

Youtube video on the bug
Don't click fullscreen; eyecancer inducing quality

http://www.youtube.com/watch?v=V_woiqmEYew
edited 1×, last 21.02.12 08:18:36 pm

old Re: imagealpha and freeimage after timer

EP
User Off Offline

Quote
1
LS_img[id] = image('gfx/LaserShockwave/Shockwave.png', player(id, 'x'), player(id, 'y'), 1)
you can try to change this for
1
LS_img[id] = image('gfx/LaserShockwave/Shockwave.png',0,1, 1)
and i need the images to test it, upload them to www.mediafire.com and send me the link please

old Re: imagealpha and freeimage after timer

EP
User Off Offline

Quote
1 hour of work but its done
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
function Array(size,value) 
    local array = {}
    for i = 1, size do
        array[i]=value
    end
    return array
end

LS_img = Array(32,0)
LS_mode = Array(32,0)

addhook("attack","LS_attack")
addhook('attack2', 'LS_attack2')
addhook('collect', 'LS_collect')
addhook('select', 'LS_select')



function LS_attack(id)
	if player(id,"weapontype") == 45 then
		LS_img[id] = image('gfx/LaserShockwave/Shockwave.png', 0,1, 1,0)
         imagepos(LS_img[id], player(id,'x'), player(id, 'y'), player(id, 'rot'))
		 if LS_mode[id] == 0 then
               imagecolor(LS_img[id], 0, 255, 0)
          elseif LS_mode[id] == 1 then
               imagecolor(LS_img[id], 255, 0, 0)
          elseif LS_mode[id] == 2 then
               imagecolor(LS_img[id], 255, 255, 0)
          elseif LS_mode[id] == 3 then
               imagecolor(LS_img[id], 0, 0, 255)
          end
		  function LS_fade(fade)
		imagealpha(LS_img[id],fade)
end
			timer(100, 'LS_fade', 0.9)
			timer(200, 'LS_fade', 0.8)
			timer(300, 'LS_fade', 0.7)
			timer(400, 'LS_fade', 0.6)
			timer(500, 'LS_fade', 0.5)
			timer(600, 'LS_fade', 0.4)
			timer(700, 'LS_fade', 0.3)
			timer(800, 'LS_fade', 0.2)
			timer(900, 'LS_fade', 0.1)
			timer(1000,"freeimage",LS_img[id])
	end
end

function LS_attack2(id, mode)
     if player(id, 'weapontype') == 45 then
          LS_mode[id] = mode
     end
end

function LS_collect(id, iid, mode)
     if iid == 45 then
          LS_mode[id] = mode
     end
end

function LS_select(id, type, mode)
     if type == 45 then
          LS_mode[id] = mode
     end
end
later in skype i will explain you detailed what i did here
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview