Jump to content

Modding Sacred 2 Spells.txt


Codex

Recommended Posts

I intend to break down each field so that either myself or another member can build a tool which will allow you to automatically update the spells as needed.

For instance in the above example:

entry0 = {"et_self_shapeshift", 1000, 1995, 0, 41 },

1995 refers to the creatures id, just using notepad++ I searched the entire spells document for that value where it only found 1 occurrence to the value. This means that its a unique id which only applies to this spell.

So I did a directory search on the value 1995 and found in creatures.txt amongst other places, more data in relation to the spell.

mgr.createCreature {
	id = 1995,
	itemtype_id = 12484,
	name = "spell_dm_berserker_shapeshift",
	behaviour = "Invalid",
	dangerclass = 7,
	groupmaxcount = 1,
	elite_creature_id = 1995,
	probabilityforelite = 0.000000,
	rank = 0,
	tenergy_creature_id = 1995,
	livesremaining = 0,
	unconscioustime = 20,
	palettebits = "1111111111111111",
	monstertype = 0,
	faction_id = 1,
	modelscale = 1.000000,
	rise_from_ground = 0,
	has_corpse = 1,
	has_soul = 1,
	can_strafe = 0,
}

It could just be a coincidence but spell_dm_berserker_shapeshift does seem to relate to the original spell.

Next if I take the itemtype id value found in that block of code and I do a search in the itemtype.txt, I find this.

newItemType = {
	-- standard info
	renderfamily = "RENDERFAM_CREATURE",
	renderprio   = 0,
	family       = "FAMILY_CREATURE",
	subfamily    = "SUBFAM_LIFE_DRAGON",
	classification = "CLF_DEFAULT",
	flags        = "FLAG_HASPREVIEWIMAGE",
	weargroup    = "WEARGROUP_INVALID",
	-- 3d model + animation info
	model0Data = {
	  name         = "models/npc/monsters/draconian/h_draconian.GR2",
	  user         = "WEARGROUP_INVALID",
	},
	-- logic bounding box
  logicBox = {
    minx=-34.466, miny=-56.174, minz=-0.641, 
    maxx=29.876, maxy=38.901, maxz=94.403, 
	},
	dangerclass   = 0,
}
mgr.typeCreate(12484, newItemType);

All of this data is relevant its just a matter of picking things apart to see how they relate to one another.

Edited by Codex
  • Like! 1
Link to comment

Some where down the road all of these values can be simplified, in that functions can be created to automatically execute these values so we won't have to search for them all.

I've completely re-written game server frameworks to do just that, lua is pretty flexible and easy to work with. :)

Link to comment

So for instance if I were to create a test function, labeled testFunction.

function testFunction() return (6000 * 60 * 24) end

Then call it from within entry1, it will execute and return a value of 86400, which will then be applied to the duration value for the spell.

entry1 = {"et_duration_sec", testFunction(), 25, 0, 8 },

Creating a structure in this fashion allows us to consolidate but also easily manage or update the code.

The way lua works is that the code is evaluated way before it is sent to whatever called the document, this means that we can write code which manipulates the values prior to sending it to the application. (hopefully that makes sense) :P

Link to comment

Progress so far, if you add the -console in the shortcut to the target.
y7siWNR.jpg
Then while at any point in the game you hit tilde (~) key and a persistent window will overlap the screen, then type help, that is as far as I've gotten so far :P

u74PgsL.jpg

Currently I am running one of the dll's (s2logic.dll) through a debugger. This is how I came to the conclusion that the game might have a debug window.
Initially I did a search for et_duration_sec in notepad++ in txt, exe & dll file types, which lead me to this dll, then I opened it up in x64dbg and did a search for all related strings.

Edited by Codex
Link to comment

I intend to break down each field so that either myself or another member can build a tool which will allow you to automatically update the spells as needed.

 

A spell editor... well more power to you. It would be a marvelous tool indeed. I would love it if you could figure out what the fourth number in the spell token string signifies. The first number is (usually) the starting value, the second number is (usually) the gain on level up, the third number signifies a modification, but the fourth number is mystery to me.

 

All of this data is relevant its just a matter of picking things apart to see how they relate to one another.

 

Correct, that is why the Berserk can be replaced with a different form like a Werewolf.

  • Like! 1
Link to comment

 

I just discovered this game yesterday 11-27-16 and its pretty cool, I also noticed it had a script directory which eventually led me to this community.

 

I tried all the classes, one which I enjoyed the most was Dragon Mage and this one spell called Dragon Berserk. The only bad thing about the spell is it had a long cool down which really didn't make it that useful.

 

So I took a look at the text files in the scripts directory and noticed they are all written in lua. So I started to mess around with some of the files, given I have a background in programming, the worst that can happen is I would have to reinstall the game.

 

So I thought I would investigate these files and see if I could reduce the cool down of this spell. As you can see from the picture below I've done just that reduced the cool down to 1 second. I've also increased the duration 86,401 seconds :) basically set it to infinity (for a day)

giZYRyJ.jpg

 

The way I did this is actually quite simple, all I did was open up spells.txt and looked for the spell

mgr.defineSpell( "dm_dm_berserkerform", {
    eiStateName = "cSpellCast",
    fxTypeCast = "FX_DM_MORPH_BERSERKER_C",
    fxTypeSpell = "FX_DM_MORPH_BERSERKER",
	fxTypeCastSpecial = "",
    duration = 10.000000,
    animType = "ANIM_TYPE_SM17",
    animTypeApproach = "",
    animTypeRide = "",
    animTypeSpecial = "ANIM_TYPE_RIDESM17-SPECIAL",
    causesSpellDamage = 1,
    tokens = {
        entry0 = {"et_self_shapeshift", 1000, 1995, 0, 41 },
        entry1 = {"et_duration_sec", 2750, 25, 0, 8 },
        entry2 = {"et_life_leech", 75, 25, 0, 9 },
        entry3 = {"et_AWVW_rel", 0, 100, 0, 5 },
        entry4 = {"et_charge_shapeshift", 120, 0, 0, 5 },
        entry5 = {"et_weapondamage_physical", 0, 25, 0, 9 },
        entry6 = {"et_charge_shapeshift", 50, 0, 1, 5 },
        entry7 = {"et_addAttackspeed", 200, 0, 2, 41 },
        entry8 = {"et_duration_sec", 1000, 10, 3, 8 },
        entry9 = {"et_life_leech_rel", 35, 0, 4, 9 },
        entry10 = {"et_charge_shapeshift", 50, 0, 5, 5 },
        entry11 = {"et_addspell_blutrausch", 1000, 0, 6, 5 },
        entry12 = {"et_armor_any_rel", 0, 50, 0, 41 },
        entry13 = {"et_life_buff", 150, 260, 0, 9 },
        entry14 = {"et_chance_surehit", 100, 2, 0, 5 },
        entry15 = {"et_physical_to_magic", 250, 0, 0, 5 },
    },
    fightDistance = 0.000000,
    aspect = "EA_DM_DRAGONMAGIC",
    cooldown = 40.000000
    soundProfile = 0,
    cost_level = 250,
    cost_base = 500,
    focus_skill_name = "skill_DM_dragonmagic_focus",
    lore_skill_name = "skill_DM_dragonmagic_lore",
    spellClass = "cSpellDmMorph",
    spellcontroltype = "eCAtype_b_boost_self",
    sorting_rank = 0,
})

And made the changes, please note I did not remove the original values all I did was comment them out and apply the changes.

mgr.defineSpell( "dm_dm_berserkerform", {
    eiStateName = "cSpellCast",
    fxTypeCast = "FX_DM_MORPH_BERSERKER_C",
    fxTypeSpell = "FX_DM_MORPH_BERSERKER",
	fxTypeCastSpecial = "",
    duration = 1.000000, -- 10.000000 -- the 10 seconds might just be a default value
    animType = "ANIM_TYPE_SM17",
    animTypeApproach = "",
    animTypeRide = "",
    animTypeSpecial = "ANIM_TYPE_RIDESM17-SPECIAL",
    causesSpellDamage = 1,
    tokens = {
        entry0 = {"et_self_shapeshift", 1000, 1995, 0, 41 },
        entry1 = {"et_duration_sec", (6000 * 60 * 24), 25, 0, 8 }, -- {"et_duration_sec", 2750, 25, 0, 8 },
        entry2 = {"et_life_leech", 75, 25, 0, 9 },
        entry3 = {"et_AWVW_rel", 0, 100, 0, 5 },
        entry4 = {"et_charge_shapeshift", 120, 0, 0, 5 },
        entry5 = {"et_weapondamage_physical", 0, 25, 0, 9 },
        entry6 = {"et_charge_shapeshift", 50, 0, 1, 5 },
        entry7 = {"et_addAttackspeed", 200, 0, 2, 41 },
        entry8 = {"et_duration_sec", 1000, 10, 3, 8 },
        entry9 = {"et_life_leech_rel", 35, 0, 4, 9 },
        entry10 = {"et_charge_shapeshift", 50, 0, 5, 5 },
        entry11 = {"et_addspell_blutrausch", 1000, 0, 6, 5 },
        entry12 = {"et_armor_any_rel", 0, 50, 0, 41 },
        entry13 = {"et_life_buff", 150, 260, 0, 9 },
        entry14 = {"et_chance_surehit", 100, 2, 0, 5 },
        entry15 = {"et_physical_to_magic", 250, 0, 0, 5 },
    },
    fightDistance = 0.000000,
    aspect = "EA_DM_DRAGONMAGIC",
    cooldown = 1.000000, -- 40.000000 (cool down period)
    soundProfile = 0,
    cost_level = 1, -- 250 (cost level & cost base make up the regen)
    cost_base = 1, -- 500
    focus_skill_name = "skill_DM_dragonmagic_focus",
    lore_skill_name = "skill_DM_dragonmagic_lore",
    spellClass = "cSpellDmMorph",
    spellcontroltype = "eCAtype_b_boost_self",
    sorting_rank = 0,
})

Welcome to DarkMatters, Codex!

I never did modding but loved playing, along with the friends that came with it, this wonderful community just can't be beat

Enjoy the boards

 

:)

 

gogo

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