English Pack a Punch (CoD7) script help

5 replies
Goto Page
To the start Previous 1 Next To the start
Up
Fiz
User
Offline Off
Hi, I'm trying to make a 2D version on Pack a Punch which is in CoD7 and CoD5 zombie maps.
It is a machine that when used (default 'E'), it upgrades the weapon the player had in his hands when he pressed USE.
So his weapon, after using the pack a punch would be twice as better.
EG: parse("mp_wpndmg XM1014 26") - then after pack a punch, parse("mp_wpndmg XM1014 46")
It also needs to cost 5000 points.
if money>4999 then
parse("setmoney "..id.." "..(player(id,"money") - 5000)).
I can explain it more if you don't understand :P. Thank you
edited 2×, last 27.03.11 07:20:17 pm
27.03.11 02:22:17 pm
Up
RAVENOUS
BANNED
Offline Off
I understood, but where do you need help? You already made something? mp_wpndmg is for all players! so you need to figure out which projectile is from which player and add damage to it, if he upgraded his weapon.
"A work of art is the unique result of a unique temperament." - Oscar Wilde
27.03.11 07:21:59 pm
Up
Fiz
User
Offline Off
I need it so it does what i said below. I know i already have some stuff for it, but i don't know how to use those to make it the 'pack a punch, where only one player recieves the weapon damage.
28.03.11 08:55:07 am
Up
EngiN33R
Moderator
Offline Off
Code:
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
function initArray2(f,v)
local cmd={}
for c=1,f do
cmd[c]=v
end
return cmd
end

upgraded=initArray2(32,false)
upgradedw=initArray2(32,0)

addhook("usebutton","packapunchp")
function packapunchp(id,x,y)
     if (x==BUTTONX and y==BUTTONY) then
          if (player(id,"money")>=5000) then
               parse("setmoney "..id.." "..(player(id,"money")-5000))
               upgradedw[id]=player(id,"weapon")
               upgraded[id]=true
               msg2(id,"You have upgraded your "..itemtype(upgradedw[id],"name")..".")
          end
     end
end

addhook("hit","packapunchh")
function packapunchh(id,src,w,hp,ap)
     if (upgraded[src]) then
          if (w==upgradedw[src]) then
               parse("sethealth "..id.." "..(player(id,"health")-(hp*2)))
               if (ap>0) then
                    parse("setarmor "..id.." "..(player(id,"armor")-(ap*2)))
               end
          end
     end
end

addhook("die","packapunchf")
function packapunchf(id)
     if (upgraded[id]) then
          upgraded[id]=false
          upgradedw[id]=0
     end
end


Replace BUTTONX and BUTTONY with the X Y coordinates of your machine's activation button. Tell me if there are any bugs.
I code, therefore I exist. | Visit my blog for Lua tips and other interesting info
28.03.11 06:02:57 pm
Up
Fiz
User
Offline Off
thanks a load for this reply, ill try it out :).

EDIT: This is exactly what i wanted, thank you very much :).
I'll make sure i put you in credits for scripting in my next zombie map (including the pack a punch).

EDIT2: Just 1 problem, after using pack a punch, (eg: with an m4a1), when i get a kill with the upgraded m4a1, it dosn't count towards my kills, it just says 'zombie died' and not 'fizzykil killed zombie with an m4a1'. is there a way to fix this?
thanks again for this script, has helped a lot
edited 4×, last 28.03.11 09:22:07 pm
29.03.11 06:44:05 am
Up
Robotic-Brain
User
Offline Off
To the start Previous 1 Next To the start