Forum

> > CS2D > Scripts > Laser Shockwave
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Laser Shockwave

4 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Laser Shockwave

Viper97
User Off Offline

Zitieren
How to convert this script to run it on all weapons, not just one?

Zitat
function Array(size,value)
     local array = {}
     for i = 1, size do
          array[i] = value
     end
     return array
end

LS_att = Array(32, 0)
LS_lit = Array(32, 0)
LS_ht = Array(32, 0)
LS_mode = Array(32, 0)

StPth = 'gfx/LaserShockwave/45'

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

function LS_attack(id)
     if player(id, 'weapontype') == 45 then
          LS_att[id] = image(StPth..'.png', 0, 1, 1)
          imagepos(LS_att[id], player(id, 'x'), player(id, 'y'), player(id, 'rot'))
          LS_lit[id] = image(StPth..'f.png', 0, 1, 1)
          imagepos(LS_lit[id], player(id, 'x'), player(id, 'y'), player(id, 'rot'))
          if LS_mode[id] == 0 then
               imagecolor(LS_att[id], 0, 255, 0)
               imagecolor(LS_lit[id], 0, 255, 0)
          elseif LS_mode[id] == 1 then
               imagecolor(LS_att[id], 255, 0, 0)
               imagecolor(LS_lit[id], 255, 0, 0)
          elseif LS_mode[id] == 2 then
               imagecolor(LS_att[id], 255, 255, 0)
               imagecolor(LS_lit[id], 255, 255, 0)
          elseif LS_mode[id] == 3 then
               imagecolor(LS_att[id], 0, 0, 255)
               imagecolor(LS_lit[id], 0, 0, 255)
          end
          tween_alpha(LS_att[id], 1000, 0.0)
          tween_alpha(LS_lit[id], 200, 0.0)
          timer(1000, 'freeimage', LS_att[id])
          timer(200, 'freeimage', LS_lit[id])
     end
end

function LS_hit(id, source, weapon)
     if player(id, 'team') ~= player(source, 'team') then
          if weapon == 45 then
               LS_ht[id] = image(StPth..'h.png', 0, 1, 1)
               imagepos(LS_ht[id], player(id, 'x'), player(id, 'y'), player(source, 'rot'))
               if LS_mode[source] == 0 then
                    imagecolor(LS_ht[id], 0, 255, 0)
               elseif LS_mode[source] == 1 then
                    imagecolor(LS_ht[id], 255, 0, 0)
               elseif LS_mode[source] == 2 then
                    imagecolor(LS_ht[id], 255, 255, 0)
               elseif LS_mode[source] == 3 then
                    imagecolor(LS_ht[id], 0, 0, 255)
               end
               tween_alpha(LS_ht[id], 1000, 0.0)
               timer(1000, 'freeimage', LS_ht[id])
          end
     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


current script only works for weapons with ID 45 or laser, and the question will refer to you asking how to make it work on more than one weapon or all ... please help

alt Re: Laser Shockwave

omg
User Off Offline

Zitieren
a few simple changes...notice that this gives random colors
LOL alistaire isn't this your script?
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
function Array(size,value)
     local array = {}
     for i = 1, size do
          array[i] = value
     end
     return array
end

LS_att = Array(32, 0)
LS_lit = Array(32, 0)
LS_ht = Array(32, 0)

StPth = 'gfx/LaserShockwave/45'

addhook('attack', 'LS_attack')
addhook('hit', 'LS_hit')

function LS_attack(id)
     LS_att[id] = image(StPth..'.png', 0, 1, 1)
     imagepos(LS_att[id], player(id, 'x'), player(id, 'y'), player(id, 'rot'))
     LS_lit[id] = image(StPth..'f.png', 0, 1, 1)
     imagepos(LS_lit[id], player(id, 'x'), player(id, 'y'), player(id, 'rot'))
     imagecolor(LS_att[id], math.random(256)-1, math.random(256)-1, math.random(256)-1)
     imagecolor(LS_lit[id], math.random(256)-1, math.random(256)-1, math.random(256)-1)
     tween_alpha(LS_att[id], 1000, 0.0)
     tween_alpha(LS_lit[id], 200, 0.0)
     timer(1000, 'freeimage', LS_att[id])
     timer(200, 'freeimage', LS_lit[id])
end

function LS_hit(id, source, weapon)
     if player(id, 'team') ~= player(source, 'team') then
          LS_ht[id] = image(StPth..'h.png', 0, 1, 1)
          imagepos(LS_ht[id], player(id, 'x'), player(id, 'y'), player(source, 'rot'))
          imagecolor(LS_ht[id], math.random(256)-1, math.random(256)-1, math.random(256)-1)
          tween_alpha(LS_ht[id], 1000, 0.0)
          timer(1000, 'freeimage', LS_ht[id])
     end
end

alt Re: Laser Shockwave

Alistaire
User Off Offline

Zitieren
user omg hat geschrieben
a few simple changes...notice that this gives random colors
LOL alistaire isn't this your script?


It is, and in GoreExtension there is a script that does this for every weapon, with special weaponflares..
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht