Forum

> > CS2D > General > Magazine image?
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Magazine image?

6 replies
To the start Previous 1 Next To the start

old Magazine image?

hacked
User Off Offline

Quote
I somehow find a magazine image in gfx/weapons folder. What is it for?

old Re: Magazine image?

Pseudon
User Off Offline

Quote
I guess it's something that you can read when you're bored and just wait as a spectator.
Or... it's a lockpick magazine that we'll teach the BR(o)s how to lockpick doors.
Or... he plans for you to drop the magazine on reload? I mean, for all players.

old Re: Magazine image?

hacked
User Off Offline

Quote
I'm making a simple lua where if you reload, it will create a magazine image below you. By the way, can someone teach me how to use [pl] parameter in cs2d lua cmd image?

And usage of modes in cs2d lua hook reload?

old Re: Magazine image?

DC
Admin Off Offline

Quote
I planned to make the player drop a magazine on reload. This makes no sense however because you normally don't drop your empty magazines. You refill them if possible. Therefore I didn't add it to the game. I simply forgot to remove the image.

old Re: Magazine image?

Sparty
Reviewer Off Offline

Quote
what user DC said on the 'You can refill them possible' ETC.. could be done by lua script.

old Re: Magazine image?

Pagyra
User Off Offline

Quote
Ok i will upload magazine script which was created a few weeks ago for @user Mora:
file cs2d Magazine script
After reloading your weapon - image, of ejected magazine, created on the ground for each weapontype.
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
dropped_magazine = {}

weapon_type_name = {"pistols", "shotguns", "smgs", "rifles", "mguns", "flames", "rockets"}

weapon_type_id = {
  pistols = {1, 2, 3, 4, 5, 6},
  shotguns = {10, 11},
  smgs = {20, 21, 22, 23, 24},
  rifles = {30, 31, 32, 33, 34, 34, 36, 37, 38, 39, 91},
  mguns = {40, 90},
  flames = {46},
  rockets = {48, 49}
}

mag_type_param = {
  [1] = {"gfx/weapons/pistolmag.png", "items/magdrop.wav"},
  [2] = {"gfx/weapons/shotgunmag.png", "items/magdrop.wav"},
  [3] = {"gfx/weapons/smgmag.png", "items/magdrop.wav"},
  [4] = {"gfx/weapons/riflemag.png", "items/magdrop.wav"},
  [5] = {"gfx/weapons/mgunmag.png", "items/magdrop.wav"},
  [6] = {"gfx/weapons/flamemag.png", "items/magdrop.wav"},
  [7] = {"gfx/weapons/rocketmag.png", "items/magdrop.wav"},
}

function drop_magazine(x, y, rot, magtype)
  local I = 0  
  for I = 1, table.maxn(dropped_magazine) + 1, 1 do
    if (dropped_magazine[I] == nil) then
   dropped_magazine[I] = image(mag_type_param[magtype][1], x, y, 0)
   tween_rotate(dropped_magazine[I],0,x,y,rot)
   timer(1000, "parse", 'lua tween_alpha('..dropped_magazine[I]..',3000,0)')
   timer(8000, "parse", 'lua freeimage('..dropped_magazine[I]..')')
   timer(9000, "parse", 'lua dropped_magazine['..I..']=nil')
   parse("sv_sound \""..mag_type_param[magtype][2].."\"")        
      return nil
    end
  end  
end

addhook("reload","reload_finished")
function reload_finished(id,mode)
  local weap_table = nil
  local pl_weap_type = player(id,"weapontype")
  local I = 0
  local J = 0  
  if (mode == 2) then
    for I = 1, table.maxn(weapon_type_name), 1 do
      weap_table = weapon_type_id[weapon_type_name[I]]      
      for J = 1, table.maxn(weap_table), 1 do
        if (pl_weap_type == weap_table[J]) then
          drop_magazine(player(id,"x"), player(id,"y"), player(id,"rot"), I)          
          return nil
        end
      end
    end
  end
end
edited 3×, last 26.10.14 04:11:11 pm
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview