User talk:Battle Bott

From Valve Developer Community
Jump to: navigation, search

Code for Garry's mod 9, lua

eventPlayerSay()

function eventPlayerSay ( Owner, strText, bTeam )

    if string.find(strText, "nade") then

        local vVelocity;
        local grenade = _EntCreate("grenade_ar2");
        local pos = _EntGetPos (Owner)
        _EntSetKeyValue(grenade, "damage", "60");
        _EntSetPos(grenade, pos);
        _EntSetPos(grenade, _PlayerGetShootAng(Owner));
        _EntSetOwner(grenade, Owner);
        vVelocity = vecMul(_PlayerGetShootAng(Owner), 1500);
        _EntSetVelocity(grenade, vVelocity);
        _EntSpawn(grenade);

    else

        return strText;

    end;

end;

Block of variables that need to be defined

local vecpos = _PlayerGetShootPos( Owner );
local plyang = _PlayerGetShootAng( Owner );
_TraceLine( vecpos, plyang, 10000, Owner );
local hitpos = _TraceEndPos();
local surfaceang = _TraceGetSurfaceNormal();
local plyright = _EntGetRightVector( Owner );
local plyang = _PlayerGetShootAng(Owner)
local vecpos = _PlayerGetShootPos(Owner)
local ang2 = vecMul( plyang, vector3( 50, 50, 50 ) )
local ang3 = vecAdd( ang2, vector3( 0, 0, -10 ) )
local endpos = vecAdd( _PlayerGetShootPos(Owner), ang3 )
local muzzlepos = vecAdd( endpos, vecMul( plyright, vector3(10,10,0)))

Code?

Where is this code for? --dutchmega 01:45, 3 Jun 2006 (PDT)

Garry's mod I suppose—ts2do 12:50, 3 Jun 2006 (PDT)

Optimization Tutorial

We do have a lot of stuff here on Optimization already: Optimization (level design). I dunno what you have planned, but I thought I should bring those articles to your attention, to help you avoid directly overlapping with them. (Presumably you also have the original author's permission to copy the article here?) --Giles 12:11, 26 Jul 2006 (PDT)