Jump to content

Understanding what Creatures.txt file does


Recommended Posts

DB suggested a very cool idea for my mod which involves Creatures.txt & I just wanted to make sure I understand the file & what it's doing & where, etc & thought that we should probably share the knowledge with everyone else. I've put my comments in bold. Anyone elses comments/thoughts are welcome.

 

mgr.createCreature {
id = 1994,  [b]Creature ID, referenced to in Spells.txt for summoning/shifting spells.[/b]
itemtype_id = 12773, [b]Reference to itemtype.txt[/b]
name = "spell_dm_dragon_shapeshift", [b]Creature name, don't think it does anything per se[/b]
behaviour = "Invalid", [b]Which AI the creature uses if it's not player controlled (ie, an NPC)[/b]
dangerclass = 7, [b]Affects item drop classes & probably other stuff[/b]
groupmaxcount = 1, [b]max number of monsters in a group[/b]
elite_creature_id = 1994, 
probabilityforelite = 0.000000,
rank = 0,
tenergy_creature_id = 1994, 
livesremaining = 0, [b]How many times will it rise up after you kill it (only for undead)[/b]
unconscioustime = 20,
palettebits = "1111111111111111",
monstertype = 0, [b]0 = normal, 1 = champion, 2 = boss[/b]
faction_id = 1,
modelscale = 0.200000, [b]scalling applied to creature's model, <1 gives a smaller in-game appearance, >1 gives a larger in-game appearance[/b]
rise_from_ground = 0,
has_corpse = 1, [b]Does it create a corpse when it dies (undead have this as 0)[/b]
has_soul = 1, [b]Does it create a soul when it does (which can be "sucked up" by Soul Reaper)[/b]
can_strafe = 0,
spells = { [b]CAs that a creature can cast, per Spells.txt[/b]
	entry0 = { "enemy_area_weaken" },
},

}

 

What I'm not quite sure of is how to add spells & skills to a player character (ie, the two Dragon Mage forms). I assume that the section later on in the file is where you add skills, but I'm not sure which file the "bonus = " is referring to (though I have a suspicion that the answer is "later in the file" & only a few of the bonus ids are explicitly stated what they do, such as bonus = 256 is attack & bonus 258 is defence):

 

mgr.addCreatureBonus( 1994, {
intensity = 300,
bonus = 256,
})

mgr.addCreatureBonus( 1994, {
intensity = 1000,
bonus = 258,
})

 

Having had a further look down the file (after the bit with the player skills in it, I got to these entries:

mgr.addCreatureSkill( 1994, {
skill_id = 3,
advanced = 0,
skill_name = "skill_armor_lore",
})
mgr.addCreatureSkill( 1994, {
skill_id = 13,
advanced = 0,
skill_name = "skill_constitution",
})
mgr.addCreatureSkill( 1994, {
skill_id = 19,
advanced = 1,
skill_name = "skill_ancient_magic_lore",
})
mgr.addCreatureSkill( 1994, {
skill_id = 24,
advanced = 0,
skill_name = "skill_alchemist",
})
mgr.addCreatureSkill( 1994, {
skill_id = 27,
advanced = 0,
skill_name = "skill_perception",
})
mgr.addCreatureSkill( 1994, {
skill_id = 0,
advanced = 0,
skill_name = "skill_DM_dragonmagic_focus",
})
mgr.addCreatureSkill( 1994, {
skill_id = 0,
advanced = 0,
skill_name = "skill_DM_dragonmagic_lore",
})
mgr.addCreatureSkill( 1994, {
skill_id = 9,
advanced = 1,
skill_name = "skill_tactics_lore",
})

So I assume that that's where/how you add a skill to a creature/form (and possibly make it Mastered by changing the advanced = flag).

 

Then there's a section with:

mgr.addCreatureBpRelation {
creature_id = xxxx,
blueprint_id = yyyy,
}

where x & y are numbers and

 

mgr.addMapPos {
merchantType = 2,
   position = { 25,32,0 , 2708.030,578.617,-11.425, 208.000 },
}

Which would be how it spanws merchants. Interestingly there seems to be two forms for this:

mgr.addMapPos {
merchantType = 2,
   position = {
     x = 123550.00,
     y = 64500.00,
     z = 0.00,
     layer = 0,
     orientation = 0.000,
   },
}

Link to comment

groupmaxcount = 1 ---> how many mobs to be in group ( if you put 8 this will be 8 in this group how is the cobolt )

 

modelscale = 0.200000 ---> this is the height of the mobs

 

and this I read in ancient post of darkmatters and sorry for double post :thumbsup: and I hope I was helpful :thumbsup:

 

 

 

Link to comment

I wonder if Sacred 2 scales monsters using that modelscale line. So if you took the line for a Kobold & increased that value, would you have giant Kobolds? Or would it "just" change the physics of the creature (so it can't walk through doors if the modelscale value is toobig) without changing the graphics?

Link to comment

The line modelscale = ______ scales the model file and so you can have larger (or smaller) creatures like the kobold.

 

The itemtypeid tells the game which model to use for the creature.

 

mgr.addCreatureBonus does as you suggested, adds from I assume all possiblie item modifiers although the only commented ones I could find gives the following list of numbers and their bonus:

26 = experience
256 = AW
258 = VW
45 = fire armour
28 = phys armour
21 = npc dex
22 = npc int
23 = npc stam
20 = npc stre
24 = vit npc
25 = npc will
27 = phys dam
262 = attack speed
55 = prone phys
718 = crbonus_addVW
44 = magic armour
47 = xcrbonus damping phys
563 = chance to evade
246 = level ca all

 

mgr.addCreatureSkill is as you suggest, the advanced = 1 is mastery is probably correct.

Link to comment

So I assume that that's where/how you add a skill to a creature/form (and possibly make it Mastered by changing the advanced = flag).

The advanced flag determines which column of the skill page it appears in. 0 is left, 1 is right.

 

To modify the skill and make it mastered, you go to:

mgr.createSkill {
skill_name = "skill__enemy_focus",
advance_level = 255,
min_level = 1,
mean_value = 200,
advance_mean_value = 0,
skillgroup = "SKG_ASPECTS",
}

And change the advance_level value. Using 1 will mean that it's mastered straightaway.

Link to comment

So I assume that that's where/how you add a skill to a creature/form (and possibly make it Mastered by changing the advanced = flag).

 

Yes. The game just wants to know if the creature has mastered this particular skill or not. The rest is scaling to its level.

 

Adding new spells and CAs goes per spells entry in the mgr.createCreature sections. Keep in mind that the player character spells are somewhat hardcoded, at least the DMs to my experience. I never tried switching around spells from one toon to the other.

 

Also keep in mind, that a creature not only recieves bonuses and skills directly, but also those from their template_id creature (if they have one set).

 

addCreatureBpRelation ties a creature id to a blueprint id (this is used for the mounts that can be bought at mount vendors).

 

The merchant definitions (mgr.addMapPos) entries do not seem to work in any way (seems to be a leftover from the past). Merchants and the likes of them are now defined via the files in the persector.zip.

Link to comment
  • 4 years later...
  • 3 years later...

Hello all! I don't know if anyone is still active in this forum, but here it goes.

I'm trying to solve the bug described here:

Where you have a NPC that you were supposed to escort somewhere, but due to some fu**ery, he is still following the player around. This NPC's name is Lathor.

So I naively tried to use the creatures.txt file in order to be able to edit the faction.txt file, make my Seraphim and the NPC enemies so I can kill him. I added the following faction relation to the faction.txt file:

mgr.addFactionRelation {
    id1 = 1,
    id2 = 12,
    f1name = "FACTION_INVALID",
    f2name = "FACTION_HUMAN",
    relation = "FRT_ENEMY",
}

id1 is supposed to be the Seraphim, and id12 is supposed to represent humans. I indeed found out in the creatures.txt file that Lathor, the NPC I'm trying to kill, is a human.

However, my edits don't work and I am still unable to kill this NPC. Does anybody have a clue why? Should I edit more files to be able to kill a NPC? I already tried this but it didn't work either:

Thank you for your help :)

Link to comment
1 hour ago, tititoto69 said:

Hello all! I don't know if anyone is still active in this forum, but here it goes.

I'm trying to solve the bug described here:

Where you have a NPC that you were supposed to escort somewhere, but due to some fu**ery, he is still following the player around. This NPC's name is Lathor.

So I naively tried to use the creatures.txt file in order to be able to edit the faction.txt file, make my Seraphim and the NPC enemies so I can kill him. I added the following faction relation to the faction.txt file:


mgr.addFactionRelation {
    id1 = 1,
    id2 = 12,
    f1name = "FACTION_INVALID",
    f2name = "FACTION_HUMAN",
    relation = "FRT_ENEMY",
}

id1 is supposed to be the Seraphim, and id12 is supposed to represent humans. I indeed found out in the creatures.txt file that Lathor, the NPC I'm trying to kill, is a human.

However, my edits don't work and I am still unable to kill this NPC. Does anybody have a clue why? Should I edit more files to be able to kill a NPC? I already tried this but it didn't work either:

Thank you for your help :)

We are still alive, and happy you met Flix!

Welcome to DarkMatters

:)

 

gogo

  • Like! 1
Link to comment

Thank you very much to the both of you, @flix and @gogoblender! Glad to see this forum is still active after so many years. Sacred 2 is a really enjoyable game.

I will try to search the game files according to your hints, and if I find something interesting, I'll post it here and in the original thread. FYI, I didn't change the difficulty: I just took the Lathor quest, but right after I decided to follow another quest that was closer, and boom, the Lathor quest was bugged, as described in the thread I posted.

Link to comment
18 minutes ago, tititoto69 said:

Thank you very much to the both of you, @flix and @gogoblender! Glad to see this forum is still active after so many years. Sacred 2 is a really enjoyable game.

I will try to search the game files according to your hints, and if I find something interesting, I'll post it here and in the original thread. FYI, I didn't change the difficulty: I just took the Lathor quest, but right after I decided to follow another quest that was closer, and boom, the Lathor quest was bugged, as described in the thread I posted.

I just realized that the quest is "Salesman of Death" which was bugged in the vanilla game in exactly this way.  This was fixed in the Community Patch.  Do you have that installed?

  • Thanks! 1
Link to comment

Yes, "Salesman of Death", that's the one! And yes, I do have the Community Patch installed: on the main menu, it is written "CM-Patch 0160" at the bottom, and I do have v2.65.2 (Sacred 2 Gold via Steam). But I installed it after I had the bug. So maybe it fixed it for the players that did not start the quest yet?

By the way, I did some poking around in the scripts files to try to fix the bug. Here is what I did (I put it in a spoiler because maybe I should have posted it in the thread specific to the bug?):

Spoiler

So I searched in the creatures.txt file for the string "Lathor" and found this:


mgr.createCreature {
    id = 1687,
    itemtype_id = 11067,
    name = "Human_Story_Lathor",
    behaviour = "questCreatures",
    dangerclass = 5,
    groupmaxcount = 1,
    elite_creature_id = 1687,
    probabilityforelite = 0.000000,
    rank = 50,
    tenergy_creature_id = 1687,
    template_creature_id = 1374,
    livesremaining = 0,
    unconscioustime = 20,
    palettebits = "1111111111111111",
    monstertype = 0,
    faction_id = 12,
    equipset_id = 349,
    modelscale = 1.150000,
    rise_from_ground = 0,
    has_corpse = 1,
    has_soul = 1,
    can_strafe = 0,
}

That seems to be its creature definition, with the ID 1687. I tried to change its behavior to "Enemy_warrior_simple", but that didn't work.

Now, based on what you said, I search in the quest.txt file for the string "1687". I found a few occurrences, among them this one:


quest.createTaskCreature(8065, {
    itemtype = 11067,
    creature = 1687,
    behaviour = "questCreatures",
    ismortal = 0,
    isfighting = 0,
    persistent = 0,
    position = { 38,20,0 , 2674.110,2776.170,234.489, 225.000 },
})

Great! Its task creature ID is 8065. What if I set the ismortal property to 1? Well... that wouldn't have been to simple! That did not have the intended effect.

Now, I tried to search for the string "8065" in the quest.txt file, and again found a few occurrences. There were 6 lines detailing a groupchange, here they are:


{ 8065,2,1,"CM_Begleiter_feige",9 },
{ 8065,2,2,"Invalid",0 },
{ 8065,7,0,"Enemy_warrior_brave",57 },
{ 8065,7,1,"CM_Begleiter_feige",8 },
{ 8065,9,2,"questCreatures",66 },
{ 8065,10,2,"Invalid",0 },

I replaced them all with the following (X means I didn't change the original value from the line):


{ 8065,X,X,"Enemy_warrior_simple",12 },

I set 12 for the last parameter because the faction_id of Lathor defined in the createCreature function is 12, meaning "Human".

And then... that didn't work either. Not losing hope, I poked around the questscripts.txt file and searched for the string "8065". I found a few occurrences like these:


quest.setScript( 3070, "OnTaskFulfilled", function(args)
changeCreature {
tcid = 8065,
mortality = "IMMORTAL",
}
changeCreature {
tcid = 8554,
mortality = "IMMORTAL",
faction = "FACTION_FRIEND_HERO_ALL",
role = "ROLE_DIALOG",
behaviour = "questCreatures",
delay = 1,
}
end)

I tried to set the mortality to "MORTAL" for each one, but then again: no visible changes in the game.

It's as if the edits that I made were not taken into account by the game, at all. Do I need to do something particular after editing the game files, like compiling something? Note that I always did the edits while the game was fully closed. Also, I applied these edits cumulatively.

 

 

Link to comment

Wow Lathor has his own creature entry!  I bet you could just delete it and he would vanish because the quest couldn't find him.  I don't THINK that would cause any errors or crashes, but maybe back up the save game just in case?

It's pretty rare for a side quest NPC to have his own creature entry. Usually only main quest NPC's are unique like that.

And yes, CM Patch fixes it, but only if the quest was not yet started.

  • Thanks! 1
Link to comment

Well, that was good thinking, I didn't thought of it. It kinda works, in the sense of Lathor having disappeared, which is awesome! That leaves however the silver circle on the map where the beginning of his quest is supposed to be, in front of his house in the Badawi village. But that's no big deal.

Thank you very much for your help, and what you do for this community. I've been checking out your mods, I'll probably end up installing the music mod! I'll go explain the solution in the other topic.

Link to comment
  • 2 years later...

Reviving this with a question.

How do the Elite enemy spawns work? One could easily assume that the "probabilityforelite" simply means the % chance that an enemy would spawn as an Elite. But because every single creature defined in the creatures.txt has probabilityforelite = 0.000000, that must not be the case.

Changing this number seems to have no effect on enemy spawns. Tried 1.000000 and 0.900000, but didn't notice any visible difference.

Which means the game must be using some other method for spawning Elites. What does the "probabilityforelite" value mean/determine then?

Link to comment

OK first of all, Flix is definitely more experienced on this topic, I only really dealt with enemies spawned through quest.txt so far. AFAIK there are three possibilities to spwan in creatures:

  • through quest.txt:
On 2/14/2022 at 6:04 AM, Flix said:

Creatures spawned through quest.txt have their levels set when the game session starts.  Gartor is essentially waiting for you as soon as the game starts so possible to outlevel him.  It's the same for other bosses not tied to quests such as Scaron or Forest Guardian.  One solution would be to tie them to a quest so that they only spawn when the quest updates at a certain stage, but inventing quests is not something I want to do in this mod.

  • through questscripts.txt:
On 2/14/2022 at 6:04 AM, Flix said:

Creatures spawned through quest.txt have their levels set when the game session starts.  Gartor is essentially waiting for you as soon as the game starts so possible to outlevel him.  It's the same for other bosses not tied to quests such as Scaron or Forest Guardian.  One solution would be to tie them to a quest so that they only spawn when the quest updates at a certain stage, but inventing quests is not something I want to do in this mod.

  • through spawn.txt:

Now this is the one you're looking for. Normal enemies are spawned here:

mgr.addSpawn (10,48,0,{ -- Ork bear
	total_density = 8,
	layermap_id = 3,
	{951,5,"",0,0,0,0},
	{950,1,"",0,0,1,0},
	{949,5,"",0,0,2,0},
	{948,1,"",0,0,3,0},
	{949,5,"",0,0,4,0},
} )

as well as Elite Enemies:

mgr.addSpawn (10,48,0,{ -- Cobold Wolfrider Mage Elite
	total_density = 10,
	layermap_id = 1,
	{547,5,"",0,0,0,0},
	{642,3,"",0,0,0,0},
	{306,8,"",0,0,1,0},
	{1011,3,"",0,0,1,0},
	{306,5,"",0,0,2,0},
	{306,5,"",0,0,3,0},
} )

, enemy groups:

mgr.addSpawn (13,53,0,{ -- Orc Bear Groupspawn
	total_density = 10,
	layermap_id = 1,
	{434,5,"",0,0,0,0},
	{434,3,"",0,0,1,0},
	{949,6,"",0,0,0,0},
	{948,1,"",0,0,0,0},
	{950,1,"",0,0,1,0},
	{951,4,"",0,0,1,0},
} )

and environmental creatures:

mgr.addSpawn (13,53,0,{ -- Brown eagles atmo
	total_density = 5,
	layermap_id = 4,
	{101,10,"",0,0,0,0},
} )

I assume you're searching for garema ghost warrior elite spawns. Open creatures.txt, strg+F, "enemy_stance_ghostwalk". Copy all creature IDs of the garema elites. I have done that for you now exemplary:

  • 2122
  • 380
  • 388

Now close creatures.txt and open spawn.txt. Then strg+F again and search for those IDs.

Last but not least, I know ythat you know how sectors work, but for everyone else reading this:

I'm not aware of other ways to spawn in npcs, but possible.

Edited by Lindor
Reason: spelling mistake
  • Like! 1
Link to comment
1 hour ago, Lindor said:

I'm not aware of other ways to spawn in npcs, but possible.

Thanks a ton.

Does that mean that the number of enemies that spawn within a sector is always the same and it's just their placement that is randomized?

Say I want to increase the number of Elite Garema Spawns in the 41,10,0 coordinate. I look up this entry:

Spoiler

mgr.addSpawn (41,10,0,{ -- Garema melee
    total_density = 15,
    layermap_id = 1,
    {381,10,"",0,0,0,0},
    {380,1,"",0,0,0,0},
    {389,2,"",0,0,1,0},
    {381,6,"",0,0,1,0},
    {380,1,"",0,0,1,0},
} )

The coordinates are clear. We are setting the spawn rate of this monster in this one sector.

total_density - total number of enemies that should be spawned? Probably not as the second number after the creature ID is probably the number of spawns...

layermap_id - no idea.

And the 5 entries listed below that? The first number is the creature ID I think, so:

381 = Barb_garema_warrior

380 = Barb_garema_warrior_elite

389 = Barb_garema_officer

Now Garema are probably not the best enemy to try it on as they have a ton of subcategories and which is which is not really clear from the names in the creatures.txt. But nevertheless....

Seeing these enemies, I think it's safe to say that the number after the creature ID is the number of them the game should spawn. 380 being the normal Ghost Warrior and thus most numerous. The 381 is the Ghost Warrior Elite. 389 could the the Levin Array caster Garema?

So if I'm reading this correctly, there will always be 16 normal Garema Ghost Warriors, 2 Elite Garema Ghost Warriors and 2 "Officers" whatever Garema type they are.

Additional question: Why are the same creature IDs listed multiple times. 381 two times. 380 two times and 389 one time.

 

And what about the 4 numbers after that? Only the third one ever seems to change. What does that set?


 

Link to comment
22 minutes ago, Flix said:

Total density will increase the overall spawns in the sector.  The numbers after each creature ID are the proportions, not a hard count.

The density limit seems to be 100, correct?

Although I'm not sure I understand the proportions. Does it simply mean that compared to normal Garema (381,10) the Elite one (380,1) has a 10% chance of spawning compared to them?

25 minutes ago, Flix said:

The layermap ID's are like packs. You'll notice a single sector might have 1-4 spawn entries but each one has a different layermap ID. This his how humans can appear in a group, wolves can appear in a pack, etc. and they're not always just shuffled together.

Thanks for explaining. Not gonna be touching that :4rofl:

28 minutes ago, Flix said:

The multiple creatures per spawn are additional creatures that appear on higher difficulties based on the third digit (the only one that ever changes). 0 is bronze+, 1 is silver+, etc.  This allows more and more creatures to spawn in higher difficulties.

So in the example above, the spawns would be the same on Silver and above, correct?

But if we take a more complicated example:

Spoiler

mgr.addSpawn (11,50,0,{ -- Ork bear
    total_density = 8,
    layermap_id = 3,
    {951,5,"",0,0,0,0},
    {950,1,"",0,0,1,0},
    {949,5,"",0,0,2,0},
    {948,1,"",0,0,3,0},
    {949,5,"",0,0,4,0},
} )

So, on Bronze, only creature ID 951 would spawn.

On Silver, 951 and 950 would spawn. The 950 would have 20% chance of spawning (1/5)?

On Gold, 951, 950 and 949 would spawn. 951 and 949 would have the same chance of being spawned and 950 would still have only 20% chance?

On Plat, 951, 950, 949 and 948 would spawn. 80% of the time, it would be either 951 or 949 and 20% of the time, it would be either 950 or 948?

On Niob, the same creature that has been already used appears again. What does that mean exactly? Does it just double the number of enemies?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...
Please Sign In or Sign Up