• Unborrow Flag - Antlion Guard on Spawn
    11 replies, posted
As I've seen on the Valve Developer Wiki here and here: [url]https://developer.valvesoftware.com/wiki/Npc_antlionguard[/url] [url]https://developer.valvesoftware.com/wiki/Mapping_with_Antlions[/url] [QUOTE]To make an antlion that unburrows on spawn, check the [I]Start Burrowed[/I] flag on the antlion, configure the npc_template_maker normally with the antlion in the template and then add the following output: OnSpawnNpc, (your antlion), Unburrow[/QUOTE] The antlion has a function to unborrow itself when spawned; how can I trigger this via Lua? I'm trying to make an Antlion Guard spawn and unborrow itself from the ground when it does to create a smooth transition. I couldn't find any documentation on the Wiki or previous threads here.
[lua]ent:Fire('Unborrow')[/lua] [editline]24th January 2014[/editline] I might have read your post wrong, perhaps this might work? [lua]ent:SetKeyValue( "spawnflags", 2048 )[/lua] 2048 corresponds to "Template NPC: This entity is a template for the npc_template_maker. It will not spawn automatically and cannot be used with point_template.", as mentioned on the wiki page.
[QUOTE=samm5506;43660837][lua]ent:Fire('Unborrow')[/lua] [editline]24th January 2014[/editline] I might have read your post wrong, perhaps this might work? [lua]ent:SetKeyValue( "spawnflags", 2048 )[/lua] 2048 corresponds to "Template NPC: This entity is a template for the npc_template_maker. It will not spawn automatically and cannot be used with point_template.", as mentioned on the wiki page.[/QUOTE] Both don't work.
Andlion guard has a KEYVALUE for start burrowed, not a spawnflag, so you go to hl2 or base.fgd, check whatever string valve use for "Start Burrowed" keyvalue and use Ent:SetKeyValue( k, v ) and then fire "Unborrow".
[QUOTE=Robotboy655;43664089]Andlion guard has a KEYVALUE for start burrowed, not a spawnflag, so you go to hl2 or base.fgd, check whatever string valve use for "Start Burrowed" keyvalue and use Ent:SetKeyValue( k, v ) and then fire "Unborrow".[/QUOTE] Found the correct keyvalue, firing Unborrow doesn't work.
Wouldn't it be Unburrow?
[QUOTE=Jeezy;43666521]Wouldn't it be Unburrow?[/QUOTE] Still doesn't work, although you're right.
You are doing it wrong. Show your code.
[lua] local function InitalizeBeast() local beast = ents.Create( "npc_antlionguard" ) --local spawn = table.Random(ents.FindByClass("info_player_deathmatch")):GetPos() beast:SetPos( Vector(25.577255, 1233.858154, 128.031250) ) beast:SetHealth( 1000 ) beast:SetKeyValue( "startburrowed", 1 ) beast:Fire( "Unburrow" ) beast:Spawn() end [/lua] I've also tried reordering where I fire Unburrow. As it stands, when I execute this function with startburrowed set to one nothing happens and I don't see the antlion. When I set startburrowed to 0 it spawns in instantly like normal.
You gotta fire the input after you spawn it.
[QUOTE=Robotboy655;43668277]You gotta fire the input after you spawn it.[/QUOTE] I tried that as well no joy.
Have you tried to add a timer that fires the input like half a second to a second after it spawns?
Sorry, you need to Log In to post a reply to this thread.