Forum

> > CS2D > Scripts > Knockback unstuck
Forums overviewCS2D overview Scripts overviewLog in to reply

English Knockback unstuck

6 replies
To the start Previous 1 Next To the start

old Knockback unstuck

_Vava_
User Off Offline

Quote
i have this Code for Knockback
1
2
3
4
5
6
7
8
addhook('hit','Knockback')
function Knockback(p1,p2,Weapon)
     local Damage, pX, pY = itemtype(Weapon,'dmg')
     local Angle = math.rad(math.abs(player(p2,'rot') - 90))
     pX = player(p1,'x') + math.cos(Angle) * Damage
     pY = player(p1,'y') + math.sin(Angle) * Damage
     parse('setpos '..p1..' '..pX..' '..pY)
end
when i shot zombie , zombie's stuck in wall
can some one help me in unstuck script ?
thx

old Re: Knockback unstuck

Pagyra
User Off Offline

Quote
Something like this:
1
2
3
4
5
6
7
8
9
10
addhook('hit','Knockback')
function Knockback(p1,p2,Weapon)
     local Damage, pX, pY = itemtype(Weapon,'dmg')
     local Angle = math.rad(math.abs(player(p2,'rot') - 90))
     pX = player(p1,'x') + math.cos(Angle) * Damage
     pY = player(p1,'y') + math.sin(Angle) * Damage
     if tile(px, py, "walkable") then
          parse('setpos '..p1..' '..pX..' '..pY)
     end
end

old Re: Knockback unstuck

VADemon
User Off Offline

Quote
user Pagyra
1
2
3
4
5
6
7
8
9
10
addhook('hit','Knockback')
function Knockback(p1,p2,Weapon)
     local Damage, pX, pY = itemtype(Weapon,'dmg')
     local Angle = math.rad(math.abs(player(p2,'rot') - 90))
     pX = player(p1,'x') + math.cos(Angle) * Damage
     pY = player(p1,'y') + math.sin(Angle) * Damage
     if tile((pX + (math.cos(Angle) >= 0 and 10 or -10)) * 32 , (pY + (math.sin(Angle) >= 0 and 10 or -10)) * 32, "walkable") then
          parse('setpos '..p1..' '..pX..' '..pY)
     end
end
May or may not work

old Re: Knockback unstuck

_Vava_
User Off Offline

Quote
Thx all .
i want to make zombie plague mod like user SQ
he's lua don't work for me i want to make make

old Re: Knockback unstuck

Infinite Rain
Reviewer Off Offline

Quote
If you cannot properly install user SQ's Zombie Plague, then you will not be able to "make make" your own script. I mean seriously, how is it that hard to install a simple script?

old Re: Knockback unstuck

Skyppy
User Off Offline

Quote
You lua are bad maked.

Admin/mod comment

Please avoid such comments unless you have CONSTRUCTIVE ideas for improvements /DC
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview