• npc_combine_s drop weapon on spawn
    22 replies, posted
There is any answer why it can happen I am trying to figure out which spawnflag do that. In a map where the npc_combine_s spawn by a trigger and when they spawn they start Assault. But they drop their weapon on spawn... I can upload the map where I found this problem the map is using hl2 entities not from other mods.
You need to enable the flag number 8192, "Don't drop weapons"
[QUOTE=vrej;49967823]You need to enable the flag number 8192, "Don't drop weapons"[/QUOTE] I will try but you know what I am talking about? They drop their own weapon on spawn.
it in the flags tab of the entities properties :)
Still not working it did nothing. [IMG]http://i.imgur.com/lpTdc4c.png[/IMG] [B]Edited:[/B] I gave them weapon_ar2 still not working. [CODE] for k, v in pairs(ents.FindByClass("npc_combine_s")) do --print(v:HasSpawnFlags(SF_NPC_NO_WEAPON_DROP)) --PrintTable(v:GetKeyValues()) if (!v:HasSpawnFlags(SF_NPC_NO_WEAPON_DROP)) then v:Give("weapon_ar2") v.flag = v:GetKeyValues()["spawnflags"] print(v.flag) v.spawnflags = v.flag + 8192 v:SetKeyValue("spawnflags", v.spawnflags) print(v.spawnflags) end --v:SetKeyValue("spawnflags", tostring(v.spawnflags)) --v:SetKeyValue("spawnflags", tostring(v.spawnflags)) --print(v.spawnflags) --print(v:GetKeyValues()["spawnflags"]) --print(v:HasSpawnFlags(SF_NPC_NO_WEAPON_DROP)) end [/CODE] [B] Edited:[/B] They drop the ar2 also what I gave them :(
if you look at the main npc_combine_s options its default is to spawn with an smg you need to set that to nothing so when you spawn it with your script it spawns with the gun you give it and hopefuly it won't drop it
[QUOTE=taz0;49972135]if you look at the main npc_combine_s options its default is to spawn with an smg you need to set that to nothing so when you spawn it with your script it spawns with the gun you give it and hopefuly it won't drop it[/QUOTE] Weird thing is some combine not drop their own weapon.
hmm maybe just a glich ,, can you Set the weapon on spawn or is it only just Give weapon on spawn ??
[QUOTE=taz0;49972407]hmm maybe just a glich ,, can you Set the weapon on spawn or is it only just Give weapon on spawn ??[/QUOTE] They already get weapon onspawn by additionalequipment key value if I try to give them they drop it also.
[QUOTE=kem008;49972719]They already get weapon onspawn by additionalequipment key value if I try to give them they drop it also.[/QUOTE] Problem is huge and still dont know what the hell is causing it I am going to recreate the npc that the map is using. And not just npc_combine_s do this also npc_metropolice.
just an idea,,, place an npc template of the npc_combine_s set with the weapon you want it to spawn with and create a script to spawn it at a vector on the map with a trigger and see if it don't drop its weapon
[QUOTE=taz0;49992548]just an idea,,, place an npc template of the npc_combine_s set with the weapon you want it to spawn with and create a script to spawn it at a vector on the map with a trigger and see if it don't drop its weapon[/QUOTE] I realized that with template (100% if forcespawn but with npc_template always spawn with weapon.) it will spawn with weapon. [IMG]http://images.akamai.steamusercontent.com/ugc/288601701271329443/35ADAA5FE7BED0FCFC29F87688CD61095B50C64A/[/IMG]
So I need to fix all npcs to use npc_template to fix that problem??? Gmod cant manage npc directly spawned by the map without template or maker?
you'd only need to make the maximum npc_template/ maker for the amount you want to spawn at one time then have the script call those npc_template/makers to spawn at the vectors you set up in the triggers to active them i.e if you a max of 6 npc spawn at 1 time you'd have 6 npc_template/makers to be triggered if you want more npc's put the npc_template/makers on a timer to repeat every few seconds until they spawn the amount you wanted, just having the trigger spawn them at map co-ordinates when its triggered :)
[QUOTE=taz0;50003483]you'd only need to make the maximum npc_template/ maker for the amount you want to spawn at one time then have the script call those npc_template/makers to spawn at the vectors you set up in the triggers to active them i.e if you a max of 6 npc spawn at 1 time you'd have 6 npc_template/makers to be triggered if you want more npc's put the npc_template/makers on a timer to repeat every few seconds until they spawn the amount you wanted, just having the trigger spawn them at map co-ordinates when its triggered :)[/QUOTE] I need to add all to npc_template which got no template or maker. To prevent on initialized weapon drop. but I cant call this after initpostentity or I can? or I need to edit the map?
make a template or maker of each npc combine with different weapons in the map, then have the script trigger it when it's fired
[QUOTE=taz0;50003633]make a template or maker of each npc combine with different weapons in the map, then have the script trigger it when it's fired[/QUOTE] I will try but I realized all npc do that if has additionalequipment key and value like npc_citizen. Dunno what Garry has done with Gmod.
additionalequipment is how Sandbox gives NPCs their weapons, it cannot be the problem. [url]https://github.com/garrynewman/garrysmod/blob/1635c17fae8c521d8f47f4ced0f966e7e9d2ff5b/garrysmod/gamemodes/sandbox/gamemode/commands.lua#L393-L396[/url] Maybe post the map so others can see if the issue happens to them as well?
[QUOTE=Robotboy655;50004085]additionalequipment is how Sandbox gives NPCs their weapons, it cannot be the problem. [url]https://github.com/garrynewman/garrysmod/blob/1635c17fae8c521d8f47f4ced0f966e7e9d2ff5b/garrysmod/gamemodes/sandbox/gamemode/commands.lua#L393-L396[/url] Maybe post the map so others can see if the issue happens to them as well?[/QUOTE] So just on Sandbox I need to put that code on my gamemode also? [B]Edited:[/B] It is only for the spawnmenu function. [B]Edited:[/B] Something is missing from my gamemode which is not on the base gamemode and it need to paste some function from sandbox. [URL="https://www.dropbox.com/s/v0urfdbee1u66sg/syn_urbanchaos.bsp?dl=0"]Map Download Link[/URL] You will realize that it is working on Sandbox. [IMG]http://i.imgur.com/FECzz7e.jpg?1[/IMG] Tested on TTT same problem like on my gamemode. Now I am working on to insert that function. Maybe I should derive base? EDITED: Can I check if the weapon is an equipment of an npc? The weapon respawn is fuked up :D So I need to find a new way.
Uh, no, all of what you said is just false. The map works perfectly in Sandbox AND Base gamemode, no NPCs drop weapons. That means one of these things 1) An addon you have installed does this 2) Something you added to your gamemode, something that does not exist in Sandbox OR base gamemode, is doing this. As usual, it is a problem on your end, so figure it out. [editline]26th March 2016[/editline] [t]http://i.imgur.com/A6jtLt6.jpg[/t] Base gamemode, local multiplayer.
[QUOTE=Robotboy655;50009179]Uh, no, all of what you said is just false. The map works perfectly in Sandbox AND Base gamemode, no NPCs drop weapons. That means one of these things 1) An addon you have installed does this 2) Something you added to your gamemode, something that does not exist in Sandbox OR base gamemode, is doing this. As usual, it is a problem on your end, so figure it out. [editline]26th March 2016[/editline] [t]http://i.imgur.com/A6jtLt6.jpg[/t] Base gamemode, local multiplayer.[/QUOTE] The weapon respawn system cause this I found. But dunno how to chekc that weapon actually is an equipment of an npc. Because u can remove weapons from npcs also. So I need to figure out how to check that.
Check for GetParent()? [editline]26th March 2016[/editline] Or GetOwner()
Thanks I hope it will get the npc ;) [B]Edited:[/B] Ty ;)
Sorry, you need to Log In to post a reply to this thread.