Difference between revisions of "Lua:IsGrenInNoGren"

From Fortress Forever Wiki
Jump to navigationJump to search
 
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==IsGrenade==
+
{{Infobox manual/Header}}
 +
==IsGrenInNoGren==
  
IsGrenade is used to see if an entity index being passed into a function is a grenade or not.
+
IsGrenInNoGren is used to see if a grenade is in a "[[:lua:nogrens|nogrens]]" area. By default, a trigger_ff_script named "[[:lua:nogrens|nogrens]]" will not allow grenades to explode while the grenade is touching the "nogrens" trigger_ff_script entity.
  
 
===Usage===
 
===Usage===
<pre>IsGrenade( ent_id )</pre>
+
<pre>IsGrenInNoGren( ent_id )</pre>
  
 
===Input===
 
===Input===
Line 10: Line 11:
  
 
===Output===
 
===Output===
The output is true or false depending if ent_id is a grenade or not. A list of grenades can be found [[:Category:Grenades|here]].
+
The output is true or false depending if ent_id is a grenade and then if the grenade is in a "[[:lua:nogrens|nogrens]]" area or not. A list of grenades can be found [[:Category:Grenades|here]].
 
 
===Example===
 
Here's an example of giving a team a point whenever a grenade touches a trigger_ff_script named "red_goal":
 
 
 
<pre>-- In the map's .LUA file...
 
 
 
-- Define red_goal trigger_ff_script
 
red_goal = trigger_ff_script:new({})
 
 
 
-- When we're touched by a grenade, give the grenade owners team a point
 
function red_goal:ontouch( ent_id )
 
    if IsGrenade( ent_id ) then
 
          -- Add 1 point to the grenade owners team
 
          AddTeamScore( GetObjectsTeam( ent_id ), 1 )
 
    end
 
end</pre>
 
  
 
==Important Note==
 
==Important Note==
 
'''If you want trigger's to react to grenades you MUST 'check'/'tick' the "everything" option on the flags tab of the entity in Hammer.'''
 
'''If you want trigger's to react to grenades you MUST 'check'/'tick' the "everything" option on the flags tab of the entity in Hammer.'''
  
http://mulchman.trepid.net/tick-everything.JPG
+
[[image:tick-everything.JPG]]
  
[[Category:LUA_Commands]]
+
[[Category:Lua_Commands]]
 +
{{Infobox manual/Footer}}

Latest revision as of 16:39, 31 December 2007


IsGrenInNoGren

IsGrenInNoGren is used to see if a grenade is in a "nogrens" area. By default, a trigger_ff_script named "nogrens" will not allow grenades to explode while the grenade is touching the "nogrens" trigger_ff_script entity.

Usage

IsGrenInNoGren( ent_id )

Input

The ent_id passed in is simply an integer index that refers to an entities game code ENTINDEX().

Output

The output is true or false depending if ent_id is a grenade and then if the grenade is in a "nogrens" area or not. A list of grenades can be found here.

Important Note

If you want trigger's to react to grenades you MUST 'check'/'tick' the "everything" option on the flags tab of the entity in Hammer.

Tick-everything.JPG