NPC.SetLastPosition

From GMod Wiki

Revision as of 01:41, 4 November 2009 by Crazy Quebecer (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax npc:SetLastPosition( Vector vector )
Description:
Sets the last registered or memorized position for an npc
Returns: nil
In Object: Npc
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=NPC.SetLastPosition]NPC.SetLastPosition [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionMake the npc's current base position( last memorized position ) to where the player shoots, redirect his action AI to run, which should make him run to the position.
Used onNewerServer.png
Code
 
npc:SetLastPosition( util.QuickTrace( plyobj:GetShootPos(), plyobj:GetAimVector()*1000 ).HitPos + Vector( 0, 0, 40 ) );
npc:SetSchedule( SCHED_FORCED_GO ) -- run move
 
OutputCauses the NPC to run towards the hit position of the player gun shot (aim trace) having info_node entities helps the NPCs navigate so they can travel far distances


Additional Notes

See Also

NPC.SetSchedule

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox