Jump to content

Need help with a project involving Bandits and Survivor NPC's


Tengu.

Recommended Posts

hello everyone, this is my first time in this forum but i have been lurking for a long time.

i have been creating a small mod for a private server that is a compilation from features of other mods here, and i managed to do everything except implement the most important feature i wanted which is adding NPC Bandits and Survivors to the game. I seen other mods that have this feature such as BadComp and War of the Walkers but i dont plan to use the features from those mods, all i wanted was the NPC's and i am fairly inexperient with programming which limits me even more. I am able to do very simple stuff with the files like editing and even maybe adding some small codes but i have no idea on how to add so much code of the NPC's in so many different files without breaking it.

 

i found a mod from a user named nanashi with the spare NPC codes:

https://7daystodie.com/forums/showthread.php?64422-A16E-NPC-Survivor-and-Bandit-MOD

 

but i would like to know if it would be safe to apply this code to the files and if this code is correct. would it be as simple as opening the files, going to the last line and pasting it ?

 

sorry for me being so inexperient on this subject but i really want to make this possible in anyway i can. any other suggestion would be greatly appreciated.

 

thanks everyone for taking the time reading this.

Link to comment
Share on other sites

ok so i just inserted the code from nanashi's mod, and aparently it kinda works but its broken.

the NPC items appear, but during my play test i wasnt able to find a single NPC spawning randomly on land so i wasnt able to find any bandit or survivor. only zombies spawn at POIs.

 

i got a few error messages as i started the game:

 

d3d: failed to create 2D texture id=1587 w=1 h=1 mips=1 d3dfmt=894720068 [invalid call]
d3d: failed to create 2D texture id=1591 w=1 h=1 mips=1 d3dfmt=894720068 [invalid call]
d3d: failed to create 2D texture id=1585 w=1 h=1 mips=1 d3dfmt=894720068 [invalid call]
WARNING: Shader Unsupported: 'Hidden/Dof/DX11Dof' - Pass '' has no vertex shader
WARNING: Shader Unsupported: 'Hidden/Dof/DX11Dof' - Setting to default shader.
2018-03-05T06:40:10 22.679 ERR Loading and parsing 'entityclasses.xml' (Mandatory property 'prefab' missing in entity_class 'npcSurvivorTemplate')
2018-03-05T06:40:10 22.682 ERR Loading of entity classes aborted due to errors!
2018-03-05T06:40:10 22.686 ERR   at EntityClass.Init () [0x00000] in <filename unknown>:0 
 at EntityClassesFromXml.LoadEntityClasses (.XmlFile _xmlFile) [0x00000] in <filename unknown>:0 
2018-03-05T06:40:10 23.033 ERR Loading and parsing 'entitygroups.xml' (Entity with name 'npcBanditAxe' not found)
2018-03-05T06:40:10 23.035 ERR Loading of spawning aborted due to errors!
2018-03-05T06:40:10 23.036 ERR   at EntityGroupsFromXml.LoadEntityGroups (System.Xml.XmlDocument _spawnXml) [0x00000] in <filename unknown>:0 
2018-03-05T06:40:11 23.862 ERR Loading and parsing 'spawning.xml' (Entity group 'SurvivorGroup' not existing!)
2018-03-05T06:40:11 23.863 ERR Loading of materials aborted due to errors!
2018-03-05T06:40:11 23.864 ERR   at BiomeSpawningFromXml.Load (.XmlFile _xmlFile) [0x00000] in <filename unknown>:0 

 

 

 

 

what i did before this was add manually the code from these files: link and files provided by nanashi in his thread

 

i added it at the end of each file from the game.

Link to comment
Share on other sites

The problem is displayed for you.

 

Mandatory property 'prefab' missing in entity_class 'npcSurvivorTemplate'

 

So under your "npcSurvivorTemplate" you need to add a new property

 

<property name="Prefab" value="NPC"/>

 

The thing is this was part of the vanilla file. Why did you remove the prefab property in the first place?

 

- - - Updated - - -

 

the Vanilla XML looks like this

 

<entity_class name="npcSurvivorTemplate">   
   <property name="EntityType" value="Player"/>
   <property name="Faction" value="whiteriver"/>
   <property name="Mesh" value="Player/Male/player_maleRagdoll"/>
   <property name="AvatarController" value="AvatarUMAController"/>
   <property name="ModelType" value="NpcUMA"/>
   <property name="HasRagdoll" value="true"/>
   <property name="Prefab" value="NPC"/>
   <property name="Class" value="EntitySurvivor"/>
   <property name="Parent" value="Players"/>
   <property name="PhysicsBody" value="Player"/>


   <property name="AIPackages" value="Human Basic, Human Melee"/>


   <!--property name="AITarget-5" value="SetNearestEntityAsTarget" param1="EntityAnimalStag" /-->
   <property name="ItemsOnEnterGame.GameModeSurvivalSP" value="clubWood"/>
   <property name="ItemsOnEnterGame.GameModeSurvivalMP" value="clubWood"/>
   <property name="MaxHealth" value="150"/>
   <property name="MaxViewAngle" value="180"/>
   <property name="Weight" value="70"/>
   <property name="WanderSpeed" value="0.75"/>
   <property name="ApproachSpeed" value="1.15"/>
   <property name="NightWanderSpeed" value="0.75"/>
   <property name="NightApproachSpeed" value="1.15"/>
   <property name="PanicSpeed" value="1.15"/>
   <property name="CanClimbLadders" value="true"/>
   <property name="IsEnemyEntity" value="true"/>
   <property name="SurfaceCategory" value="organic"/>
   <property name="WalkType" value="7"/>
   <property name="ParticleOnDeath" value="blood_death"/>
   <property name="SoundRandomTime" value="200.0"/>
   <property name="SoundRandom" value="Player_Male/player1stamina"/>
   <property name="SoundHurt" value="Player_Male/player1painlg"/>
   <property name="SoundHurtSmall" value="Player_Male/player1painsm"/>
   <property name="SoundDeath" value="Player_Male/player1death"/>
   <property name="SoundStamina" value="Player_Male/player1stamina"/>
   <property name="SoundDrownPain" value="Player_Male/player1drownpain"/>
   <property name="SoundWaterSurface" value="Player_Male/player1drownsurface"/>
   <property name="SoundDrownDeath" value="Player_Male/player1drowndeath"/>
   <property name="SoundJump" value="Player_Male/player1Jump"/>
   <property name="SoundLandSoft" value="Player_Male/player1LandSoft"/>
   <property name="SoundLandHard" value="Player_Male/player1LandHard"/>
   <property name="SoundPlayerLandThump" value="PlayerLandThump"/>
   <property name="TimeStayAfterDeath" value="45"/>
   <property name="LootListOnDeath" value="15"/>
   <property name="HasDeathAnim" value="true"/>
</entity_class>

Link to comment
Share on other sites

The problem is displayed for you.

 

Mandatory property 'prefab' missing in entity_class 'npcSurvivorTemplate'

 

So under your "npcSurvivorTemplate" you need to add a new property

 

<property name="Prefab" value="NPC"/>

 

The thing is this was part of the vanilla file. Why did you remove the prefab property in the first place?

 

- - - Updated - - -

 

the Vanilla XML looks like this

 

<entity_class name="npcSurvivorTemplate">   
   <property name="EntityType" value="Player"/>
   <property name="Faction" value="whiteriver"/>
   <property name="Mesh" value="Player/Male/player_maleRagdoll"/>
   <property name="AvatarController" value="AvatarUMAController"/>
   <property name="ModelType" value="NpcUMA"/>
   <property name="HasRagdoll" value="true"/>
   <property name="Prefab" value="NPC"/>
   <property name="Class" value="EntitySurvivor"/>
   <property name="Parent" value="Players"/>
   <property name="PhysicsBody" value="Player"/>


   <property name="AIPackages" value="Human Basic, Human Melee"/>


   <!--property name="AITarget-5" value="SetNearestEntityAsTarget" param1="EntityAnimalStag" /-->
   <property name="ItemsOnEnterGame.GameModeSurvivalSP" value="clubWood"/>
   <property name="ItemsOnEnterGame.GameModeSurvivalMP" value="clubWood"/>
   <property name="MaxHealth" value="150"/>
   <property name="MaxViewAngle" value="180"/>
   <property name="Weight" value="70"/>
   <property name="WanderSpeed" value="0.75"/>
   <property name="ApproachSpeed" value="1.15"/>
   <property name="NightWanderSpeed" value="0.75"/>
   <property name="NightApproachSpeed" value="1.15"/>
   <property name="PanicSpeed" value="1.15"/>
   <property name="CanClimbLadders" value="true"/>
   <property name="IsEnemyEntity" value="true"/>
   <property name="SurfaceCategory" value="organic"/>
   <property name="WalkType" value="7"/>
   <property name="ParticleOnDeath" value="blood_death"/>
   <property name="SoundRandomTime" value="200.0"/>
   <property name="SoundRandom" value="Player_Male/player1stamina"/>
   <property name="SoundHurt" value="Player_Male/player1painlg"/>
   <property name="SoundHurtSmall" value="Player_Male/player1painsm"/>
   <property name="SoundDeath" value="Player_Male/player1death"/>
   <property name="SoundStamina" value="Player_Male/player1stamina"/>
   <property name="SoundDrownPain" value="Player_Male/player1drownpain"/>
   <property name="SoundWaterSurface" value="Player_Male/player1drownsurface"/>
   <property name="SoundDrownDeath" value="Player_Male/player1drowndeath"/>
   <property name="SoundJump" value="Player_Male/player1Jump"/>
   <property name="SoundLandSoft" value="Player_Male/player1LandSoft"/>
   <property name="SoundLandHard" value="Player_Male/player1LandHard"/>
   <property name="SoundPlayerLandThump" value="PlayerLandThump"/>
   <property name="TimeStayAfterDeath" value="45"/>
   <property name="LootListOnDeath" value="15"/>
   <property name="HasDeathAnim" value="true"/>
</entity_class>

 

thanks for the answer, i ended up figuring it out. nanashi removed the prefab files from this raw source code.

 

 

i managed to make it work 100% now, the only problems are that alot of survivors and bandits spawn, im trying to tweak the spawnrate but i cant go any lower now. is there any commands that would give them a probability to spawn instead of spawning every time? i will give yall an example of how things are looking like at the spawn script

 

    <biome name="wasteland_hub">
  <spawn maxcount="3" respawndelay="1" time="Day" entitygroup="ZombiesAll" />
     <spawn prob="20" maxcount="2" respawndelay="1" time="Any" entitygroup="SurvivorGroup" spawnDeadChance="0" />
     <spawn prob="40" maxcount="4" respawndelay="1" time="Any" entitygroup="BanditGroup" spawnDeadChance="0" />
     <spawn maxcount="5" respawndelay="1" time="Night" entitygroup="ZombiesWastelandNight" />
  <spawn prob="20" maxcount="1" respawndelay="1" time="Any" entitygroup="TraderStrayGroup" spawnDeadChance="0" />
  <spawn maxcount="1" respawndelay="1" time="Any" entitygroup="EnemyAnimalsWasteland" />
  </biome>

 

i tried to add the

prob=

command but doesnt seem to be working right, they still spawning alot. or maybe my prob is still too high.

 

 

 

i also have a problem were the new NPC's dont spawn loot when they get killed. im sure i saw the loot commands in other scripts so the commands are there atleast, it may need some tweaking. right now im trying to focus on the spawn rate. i wanna make the new NPCs much less comon to come across in the game.

Link to comment
Share on other sites

excuse me but whats up with this delay on this forum? i just made a post answering and it is not displaying on the thread at all...i tried to post it again and it said it was a duplicate and still not showing. wth

 

 

 

===============================EDIT======================================

 

 

 

The problem is displayed for you.

 

Mandatory property 'prefab' missing in entity_class 'npcSurvivorTemplate'

 

So under your "npcSurvivorTemplate" you need to add a new property

 

<property name="Prefab" value="NPC"/>

 

The thing is this was part of the vanilla file. Why did you remove the prefab property in the first place?

 

- - - Updated - - -

 

the Vanilla XML looks like this

 

 

<entity_class name="npcSurvivorTemplate">   
   <property name="EntityType" value="Player"/>
   <property name="Faction" value="whiteriver"/>
   <property name="Mesh" value="Player/Male/player_maleRagdoll"/>
   <property name="AvatarController" value="AvatarUMAController"/>
   <property name="ModelType" value="NpcUMA"/>
   <property name="HasRagdoll" value="true"/>
   <property name="Prefab" value="NPC"/>
   <property name="Class" value="EntitySurvivor"/>
   <property name="Parent" value="Players"/>
   <property name="PhysicsBody" value="Player"/>


   <property name="AIPackages" value="Human Basic, Human Melee"/>


   <!--property name="AITarget-5" value="SetNearestEntityAsTarget" param1="EntityAnimalStag" /-->
   <property name="ItemsOnEnterGame.GameModeSurvivalSP" value="clubWood"/>
   <property name="ItemsOnEnterGame.GameModeSurvivalMP" value="clubWood"/>
   <property name="MaxHealth" value="150"/>
   <property name="MaxViewAngle" value="180"/>
   <property name="Weight" value="70"/>
   <property name="WanderSpeed" value="0.75"/>
   <property name="ApproachSpeed" value="1.15"/>
   <property name="NightWanderSpeed" value="0.75"/>
   <property name="NightApproachSpeed" value="1.15"/>
   <property name="PanicSpeed" value="1.15"/>
   <property name="CanClimbLadders" value="true"/>
   <property name="IsEnemyEntity" value="true"/>
   <property name="SurfaceCategory" value="organic"/>
   <property name="WalkType" value="7"/>
   <property name="ParticleOnDeath" value="blood_death"/>
   <property name="SoundRandomTime" value="200.0"/>
   <property name="SoundRandom" value="Player_Male/player1stamina"/>
   <property name="SoundHurt" value="Player_Male/player1painlg"/>
   <property name="SoundHurtSmall" value="Player_Male/player1painsm"/>
   <property name="SoundDeath" value="Player_Male/player1death"/>
   <property name="SoundStamina" value="Player_Male/player1stamina"/>
   <property name="SoundDrownPain" value="Player_Male/player1drownpain"/>
   <property name="SoundWaterSurface" value="Player_Male/player1drownsurface"/>
   <property name="SoundDrownDeath" value="Player_Male/player1drowndeath"/>
   <property name="SoundJump" value="Player_Male/player1Jump"/>
   <property name="SoundLandSoft" value="Player_Male/player1LandSoft"/>
   <property name="SoundLandHard" value="Player_Male/player1LandHard"/>
   <property name="SoundPlayerLandThump" value="PlayerLandThump"/>
   <property name="TimeStayAfterDeath" value="45"/>
   <property name="LootListOnDeath" value="15"/>
   <property name="HasDeathAnim" value="true"/>
</entity_class>

 

thanks for the answer, i ended up figuring it out. nanashi removed the prefab files from this raw source code.

 

 

i managed to make it work 100% now, the only problems are that alot of survivors and bandits spawn, im trying to tweak the spawnrate but i cant go any lower now. is there any commands that would give them a probability to spawn instead of spawning every time? i will give yall an example of how things are looking like at the spawn script

 

 

    <biome name="wasteland_hub">
  <spawn maxcount="3" respawndelay="1" time="Day" entitygroup="ZombiesAll" />
     <spawn prob="20" maxcount="2" respawndelay="1" time="Any" entitygroup="SurvivorGroup" spawnDeadChance="0" />
     <spawn prob="40" maxcount="4" respawndelay="1" time="Any" entitygroup="BanditGroup" spawnDeadChance="0" />
     <spawn maxcount="5" respawndelay="1" time="Night" entitygroup="ZombiesWastelandNight" />
  <spawn prob="20" maxcount="1" respawndelay="1" time="Any" entitygroup="TraderStrayGroup" spawnDeadChance="0" />
  <spawn maxcount="1" respawndelay="1" time="Any" entitygroup="EnemyAnimalsWasteland" />
  </biome>

 

 

i tried to add the

prob=

command but doesnt seem to be working right, they still spawning alot. or maybe my prob is still too high.

 

 

 

i also have a problem were the new NPC's dont spawn loot when they get killed. im sure i saw the loot commands in other scripts so the commands are there atleast, it may need some tweaking. right now im trying to focus on the spawn rate. i wanna make the new NPCs much less comon to come across in the game.

 

 

============================EDIT==================================

 

i think i managed to fix the spawnrate of the bandits and survivors

Link to comment
Share on other sites

  • 2 weeks later...

I managed to make NPCs appear in the world

When NPCS die the game crashes aparese in red log

Something with the NPCS id when it dies on appears GoreBlock1Prefab

 

GoreBlock1Prefab id = 37

 

loot.xml

 

loot.xml

 

<! - gore block dummy ->

<lootcontainer id = "37" count = "0" size = "5.3" sound_open = "UseActions / open_corpse" sound_close = "UseActions / close_corpse" loot_quality_template = "baseTemplate">

<item name = "cobweb" count = "1" />

</ lootcontainer>

 

<! - bandit melee ->

<lootcontainer id = "71" count = "0.3" size = "7.4" destroy_on_close = "false" sound_open = "UseActions / open_corpse" sound_close = "UseActions / close_corpse" loot_quality_template = "baseTemplate">

<item group = "banditsGeneral" />

<item name = "clubSpiked" count = "1" prob = "0.7" />

</ lootcontainer>

 

<! - bandit ranged ->

<lootcontainer id = "72" count = "0.3" size = "7.4" destroy_on_close = "false" sound_open = "UseActions / open_corpse" sound_close = "UseActions / close_corpse" loot_quality_template = "baseTemplate">

<item group = "banditsGeneral" />

<item group = "weaponsPistol + ammo" count = "1" prob = "0.7" />

</ lootcontainer>

 

<spawn maxcount="1" respawndelay="6" time="Night" entitygroup="SurvivorGroup" />

<spawn maxcount="1" respawndelay="7" time="Night" entitygroup="BanditGroup" />

Link to comment
Share on other sites

Need something like this at the end

 

<property name="LootListOnDeath" value="200" />

<property name="CorpseBlock" value="npcFollowerMeleeCorpse" />

<property name="CorpseBlockChance" value="1" />

<property name="ExperienceGain" value="742" />

<property name="DeadBodyHitPoints" value="350" />

<property name="HasDeathAnim" value="true" />

 

that links to this

 

<block id="459" name="npcFollowerMeleeCorpse">

<property name="Class" value="Gore" />

<property name="CreativeMode" value="Dev" />

<property name="Material" value="organic" />

<property name="Shape" value="ModelEntity" />

<property name="Model" value="Entities/Gore/gore_block1_Prefab" />

<property name="ImposterDontBlock" value="true" />

<property name="Collide" value="movement,melee,bullet,arrow,rocket" />

<property name="Place" value="TowardsPlacerInverted" />

<property name="IsTerrainDecoration" value="true" />

<property name="Tag" value="Gore" />

<property name="FallDamage" value="true" />

<property name="LootList" value="211" />

<property name="DowngradeBlock" value="goreBlock1BonesPrefab" />

<drop event="Harvest" name="femur" count="1,3" tool_category="Butcher" />

<drop event="Harvest" name="rottingFlesh" count="2" tool_category="Butcher" />

<drop event="Harvest" name="rottingFlesh" count="1" />

<drop event="Harvest" name="femur" count="1" />

<drop event="Destroy" count="0" />

</block>

 

- - - Updated - - -

 

and then this

 

<block id="77" name="bonesPrefab">

<property name="Material" value="organic" />

<property name="Shape" value="ModelEntity" />

<property name="Texture" value="22" />

<property name="Place" value="TowardsPlacerInverted" />

<property name="Model" value="Entities/Gore/gore_block1_bonesPrefab" />

<property name="Collide" value="melee,bullet,rocket" />

<property name="IsTerrainDecoration" value="true" />

<property name="CreativeMode" value="Dev"/>

<drop event="Destroy" count="0" />

<drop event="Harvest" name="femur" count="5" tool_category="Butcher" />

<drop event="Harvest" name="rottingFlesh" count="3" tool_category="Butcher" />

<drop event="Harvest" name="rottingFlesh" count="1" />

<drop event="Harvest" name="femur" count="1" />

</block>

 

<block id="702" name="goreBlock1BonesPrefab">

<property name="CreativeMode" value="Dev" />

<property name="Material" value="organic" />

<property name="Shape" value="ModelEntity" />

<property name="Model" value="Entities/Gore/gore_block1_Prefab" />

<property name="ImposterDontBlock" value="true" />

<property name="Collide" value="movement,melee,bullet,arrow,rocket" />

<property name="Place" value="TowardsPlacerInverted" />

<property name="IsTerrainDecoration" value="true" />

<property name="FallDamage" value="true" />

<property name="CustomIcon" value="animalGore" />

<property name="Class" value="UpgradeRated" />

<property name="UpgradeRated.ToBlock" value="bonesPrefab" />

<property name="UpgradeRated.Rate" value="15" />

<property name="DowngradeBlock" value="bonesPrefab" />

<drop event="Harvest" name="femur" count="1,3" tool_category="Butcher" />

<drop event="Harvest" name="rottingFlesh" count="1" tool_category="Butcher" />

<drop event="Harvest" name="rottingFlesh" count="1" />

<drop event="Harvest" name="femur" count="1" />

<drop event="Destroy" count="0" />

</block>

 

- - - Updated - - -

 

and finally a loot container

 

<lootcontainer id="211" count="1,3" size="4,4" destroy_on_close="true" sound_open="UseActions/open_corpse" sound_close="UseActions/close_corpse"

loot_quality_template="baseTemplate">

<item group="medicine"/>

<item group="cannedfood"/>

<item group="rottenFood"/>

<item group="junk"/>

<item name="bottledWater" count="1,3"/>

<item group="clothes"/>

</lootcontainer>

 

adjust to your liking

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...