XYZ axis EventScripts

A Forum Thread for Counter-Strike: Source

Greetings! We are one of the oldest mod sites on the Interwebs. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation by sending BANANARAMA points.
  • Post: Give BANANARAMA your thoughts on this Thread.
  • Flag: Alert moderators and warn members of a problem with this Thread.
  • Watch: Get notified when this Thread is updated.
Mascot

Stop Lurking!

Sign up

Already a Bananite? Login

I am working on a mod and i want the enemies to be sorta like the zombies in zombie mod. I have given them the speed, but i dont know what to do to make them go backwards when hit. I know to type event player_hurt { est_physpush event_var(userid) x y z } but i don't know what axis to type the number in. If anybody knows what one to put the number in please post. Thanks -Bananarama

Posts

  • 9y
    KaT_FisH avatar
    KaT_FisH Offline
    Member Joined 11y
    37,686 points Ranked 106th
    event player_hurt
    {
    if (event_var(attacker) != event_var(userid)) do
    {
    if (event_var(attacker) != 0) do
    {
    // t = sqrt(x*x + y*y + z*z)
    // x /= t
    // y /= t
    // z /= t

    es_getplayerprop fA event_var(attacker) "CBaseEntity.m_vecOrigin"
    es_getplayerprop fB event_var(userid) "CBaseEntity.m_vecOrigin"
    es_createvectorfrompoints fC server_var(fA) server_var(fB)
    es_splitvectorstring x y z server_var(fC)

    es_keygetvalue _weapon weapons pushscale event_var(weapon)

    es_xmathparse vt "sqrt(x^2+y^2+z^2)"
    es_xmathparse x "_weapon*(x/vt)"
    es_xmathparse y "_weapon*(y/vt)"
    es_xmathparse z "_weapon*(z/vt)"

    es_createvectorstring fB server_var(x) server_var(y) server_var(z)
    es_setplayerprop event_var(userid) "CCSPlayer.baseclass.localdata.m_vecBaseVelocity" server_var(fB)
    }
    }
    }


    You need to combine it with a weapons database file though.
    'es_weapons_db.txt'
    "weapons"
    {
    "pushscale"
    {
    "awp" "600" // Magnum Sniper Rifle
    "g3sg1" "400" // D3/AU1
    "sg550" "300" // Krieg 550 Commando
    "galil" "100" // IDF Defender
    "ak47" "200" // CV-47
    "scout" "300" // Schmidt Scout
    "sg552" "300" // Krieg 552
    "famas" "100" // Clarion 5.56
    "m4a1" "300" // Maverick M4A1 Carbine
    "aug" "330" // Bullpup
    "usp" "80" // KM .45 Tactical
    "glock" "50" // 9x19mm Sidearm
    "p228" "60" // 228 Compact
    "deagle" "200" // Night Hawk .50C
    "elite" "100" // .40 Dual Elites
    "fiveseven" "80" // ES Five//Seven
    "m3" "250" // Leone 12 Gauge Super
    "xm1014" "230" // Leone YG1265 Auto Shotgun
    "mac10" "70" // Ingram MAC-10
    "tmp" "70" // Schmidt Machine Pistol
    "mp5navy" "100" // KM Sub-Machine Gun
    "ump45" "90" // KM UMP45
    "p90" "120" // ES C90
    "m249" "200" // M249
    "flashbang" "60" // Flashbang
    "hegrenade" "240" // Hegrenade
    "smokegrenade" "60" // Smoke Grenade

    }
    }


    This way eliminates the use of EST as well. =)
    I know I already showed you on STEAM, but this is just for anyone who might see the thread and wonder what the answer was.
    <3 <3 <3 avatar
    Mantra
    <3 <3 <3

Share

Shareable Image:
Share banner
HTML embed code:
BB embed code:
Markdown embed code:

More embeddable images

Bookmark and Share

Submitter

BANANARAMA avatar
BANANARAMA Offline
Member Joined 10y
2,598 points Ranked 1781st

BANANARAMA
Sign up to access this!
Sign up to access this!
Sign up to access this!
Sign up to access this!

Category

Stats

Posts
1
Views
1,039
Date Added
9y
bcp.crwdcntrl.net tracking pixel