User talk:Battle Bott: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(4 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
function eventPlayerSay ( Owner, strText, bTeam ) | ==Code for Garry's mod 9, lua== | ||
== eventPlayerSay() == | |||
<pre> | |||
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); | |||
end;< | vVelocity = vecMul(_PlayerGetShootAng(Owner), 1500); | ||
_EntSetVelocity(grenade, vVelocity); | |||
local vecpos = _PlayerGetShootPos( Owner ); | _EntSpawn(grenade); | ||
local plyang = _PlayerGetShootAng( Owner ); | |||
_TraceLine( vecpos, plyang, 10000, Owner ); | else | ||
local hitpos = _TraceEndPos(); | |||
local surfaceang = _TraceGetSurfaceNormal(); | return strText; | ||
local plyright = _EntGetRightVector( Owner ); | |||
local plyang = _PlayerGetShootAng(Owner) | end; | ||
local vecpos = _PlayerGetShootPos(Owner) | |||
local ang2 = vecMul( plyang, vector3( 50, 50, 50 ) ) | end; | ||
local ang3 = vecAdd( ang2, vector3( 0, 0, -10 ) ) | </pre> | ||
local endpos = vecAdd( _PlayerGetShootPos(Owner), ang3 ) | |||
local muzzlepos = | ==Block of variables that need to be defined== | ||
-- | <pre> | ||
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))) | |||
</pre> | |||
== Code? == | |||
Where is this code for? --[[User:Dutchmega|dutchmega]] 01:45, 3 Jun 2006 (PDT) | |||
:Garry's mod I suppose—'''[[User:Ts2do|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?) --[[User:Giles|Giles]] 12:11, 26 Jul 2006 (PDT) |
Latest revision as of 12:12, 26 July 2006
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)