forums | blogs | polls | tutorials | downloads | rules | help

Error message

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in remember_me_form_alter() (line 78 of /var/www/siegetheday.org/sites/all/modules/contrib/remember_me/remember_me.module).

Enchantable item flag? (+ world level specific quest drops)

Sharkull's picture

I want to make a little tweak to the newbie gear (dropped by the dryad jailer), including a spell book (without requirements) that can be enchanted. The problem is that I can't find the flag / method to make an item enchantable.

Can someone give me a hint? :mrgreen:

Edit: updating subject name...

I knew you would end up modding! Laughing out loud

If you look at enchantable items, they have 4 different variations for the different enchantment types.

You have to add to PContent when they drop:

il_main = #dg_1h_dg:var1;

This would create a good dagger.

Unfortunately, I don't think it is possible to create those items without PContent.

For the requirements, you have to change or create a new weapon template:

[var1]
{
item_level = 10.0;
}

This says the "good" item is available for level 10 characters,

Sharkull's picture

Episthene wrote:
I knew you would end up modding! Laughing out loud

Nooooooooooooo!!!!!! I've been infected with the desire to tweak! ACK! :P

Thanks for the info. I'm assuming that the meaning of "[var1]", "[var2]"... is hard coded as being linked to magic level (and I couldn't change it to uber level...?).

Quote:
Unfortunately, I don't think it is possible to create those items without PContent.

What do you mean? Is using PContent a bad thing?

Otherwise, if I've correctly understood what you've written, then I have what I need (I was already expecting to have to create a new template). I'll let you know how it works out. Laughing out loud

pcontent is a mess Sad .

item_level IS the uber level.

You cannot change var1, var2, etc. It is a way to communicate between the template and the object which uses PContent.

PContent is quite limited, although they did release the code in this version, so I think most of it can be modified now. I was just thinking about Ultima which took out PContent completely, so a mod which would want to do that would not be able to use this enchantment system, so it is not really moddable, IMO. Also, if you wanted to add something better than "legendary", you could not. It is not a problem with PContent, it is a problem with the enchantment system which is not moddable.

This is why I said "Unfortunately".

Rather than mod the item that is currently dropped, why not change which item it is? I.e. subsistute the item in the jailer's list with an existing enchantable book?

Sharkull's picture

ghastley wrote:
Rather than mod the item that is currently dropped, why not change which item it is? I.e. subsistute the item in the jailer's list with an existing enchantable book?

Because I want non-magic characters (rangers & fighters) to be able to use the new enchantable book being dropped, (and existing enchantable books have level requirements in one of the magic classes). I also wanted to set the item levels higher than the equip requirements so that enchanting them is much more expensive (for some semblance of balance, because everything else in the mod is very "cheat" like) and so that they wouldn't show up for sale in shops until much later in the game.

The concept I started with was to boost Magic Finding, without the drastic (insane) affects of Guru's Rare Everywhere mod (plus I think books are a logical choice for something like this... since they are quite unimportant in the game). The use of enchantable items (and a couple tweaks to rgt_rainbow_trinket Smile ) allows the user to customize the extra MF effects by just equipping / unequipping the affected items. With v2.2's unfriendly attitude towards changing mod configurations, this was a key consideration.

Problem:
I have the mod all completed except one thing. I can't figure out a way to flag a quest drop (in act1_macros.gas) to be world level specific (mercenary / veteran / elite). I want a 3x3 enchantable book to be dropped at the beginning of Vet, and a 4x4 book at the beginning of Elite. I have the template I created set up properly with a var3 & var4, but can't find out how to restrict the drops properly. I suspect that the answer might require something much more than I'm capable of, so unless someone can let me know if this is possible with a flag, I think I'm going to package what I have up and find somewhere to host it.

Actually, I looked at it again after you comments about pricing.

equip_requirements = ranged:#item_level-2.0;

That is basically the line which tells who can equip it. In this case, rangers with a Uber level 2 less than the item_level.

item_level = 4.0;

Item-level is not the uber level like I said previously. It affects when it drops, and how it costs, mainly. In this case it also affects the wear requirement, but indirectly.

Finally, to restrict when it drops, you will need to set up a quest flag or something that gets saved, like you said. Most flags are set up in flick, so you probably can find some examples there. The jailer code should have some examples as well.

Sharkull's picture

Thanks... I had learned about the difference between item level and equip. requirements quite a while ago (while preparing the sets web pages), but wasn't sure that I could apply an "equip_requirements = " line the way I wanted to until I tested it yesterday. I feared that enchantable spell books with higher item levels were hard-coded to require magic levels, but I now know that isn't the case.

Quote:
Finally, to restrict when it drops, you will need to set up a quest flag or something that gets saved, like you said. Most flags are set up in flick, so you probably can find some examples there. The jailer code should have some examples as well.

Actually I was hoping / thinking more about an existing flag that I could use (like in the map's shops.gas there are items for sale marked with "world_specific = mercenary;", "world_specific = veteran;" and "world_specific = elite;"). :?

BTW, here's the template I settled on:

[t:template,n:book_glb_magic_new]
{
	doc = "book_magic_22";
	specializes = base_book_spell;
	[common]
	{
		screen_name = "Newbie Spell Book";
	}
	[pcontent]
	{
		[base]
		{
			item_level = 100000;
		}
		[var1]
		{
			item_level = 100000;
			texture = b_i_glb_book-magic-22;
			inventory_icon = b_gui_ig_i_it_magic-book-22;
		}
		[var2]
		{
			item_level = 30.0;
			equip_requirements = uber:#item_level-30;
			texture = b_i_glb_book-magic-22;
			inventory_icon = b_gui_ig_i_it_magic-book-22;
		}
		[var3]
		{
			item_level = 50.0;
			equip_requirements = uber:#item_level-20;
			texture = b_i_glb_book-magic-22;
			inventory_icon = b_gui_ig_i_it_magic-book-22;
		}
		[var4]
		{
			item_level = 80.0;
			equip_requirements = uber:#item_level-20;
			texture = b_i_glb_book-magic-22;
			inventory_icon = b_gui_ig_i_it_magic-book-22;
		}
	}
}

Quote:
"world_specific = mercenary;", "world_specific = veteran;" and "world_specific = elite;")

Sure, that should work.

Looks good.

Sharkull's picture

...but it doesn't. I've tried nesting the separate books in their own section (within the appropriate quest drop code) like this:

	[all*]
	{
		il_main = #book_glb_magic_new:var3;
		world_specific = veteran;
	}

And it still drops the book in Merc. I've played around with a few other guesses at syntax, but nothing I've tried filters the items properly. Sad

Well, it would work in a gas template I am pretty sure. Or maybe it only works in shops.

You would have to be more specific in which file you are trying to do that.

It can be done in skrit as well, but the syntax would be quite different.

Sharkull's picture

Sorry, I thought I had mentioned I was working on the quest drops as listed in act1_macros.gas ... :oops:

I should also mention that this type of thing doesn't seem to work either (nothing drops):

		[mercenary]
		{
			il_main = #book_glb_magic_new:var3;
		}

Sad I guess I might have to start looking at skrit files... to see if this is something I could do without too much effort.

Best way is to do it in flick.

if WhenModeElite
{
giveItem "#book_glb_magic_new:var4";
}
else if WhenModeVeteran
{
giveItem "#book_glb_magic_new:var3";
}
else
{
giveItem "#book_glb_magic_new:var2";
}

Put that in the warden flick. world/global/flick/sequences/ds2_world/act1_town/act1_town_warden_talk.flick

You have to put it somewhere in "thread QuestOne".

Sharkull's picture

Thanks Episthene... you really had my hopes up there for a while, but after a couple hours trying different permutations of your idea, it isn't working. Most of the changes I try (adding any new conditional statements, or even an "else" clause to the existing "if WhenModeNormal") end up breaking the warden's conversation just after the NIS with Amren.

Also note:
giveItem "#book_glb_magic_new:var3";
This doesn't seem to drop anything... I substituted it for the line "activate reward_a1_pq3_dryad_outpost_begin;", and when the conversation ended the ground was bare. I also tried this:
giveItem (#book_glb_magic_new:var3);
But that again breaks the conversation.

I've also thought about putting a new reward template into act1_macros.gas and calling it from act1_town_warden_talk.flick, but without a working conditional statement that idea quickly becomes useless. Why is this so difficult?
:dunce:

Thanks again for all the help.

It has to be difficult so people cannot mod the game. Wink

I thought GiveItem would work, but I guess it only gives items to someone (a playable character). It seemed simpler.

You can still do it with the if statement I put, but just use the activate reward in conjuntions with your macros.gas, instead of GiveItem.

Create 3 separate rewards and call the one you want.

I would test it, but I swore not to start DS2 ever again.

Of course if they cared, they would answer your question on their own site, which would make things easier. Somehow they expect people like me to help others, all the while being called "rogue" or what not. I suppose I should bend over and "say than you GPG!". But I am just ingrateful like that. Smile

Balderstrom's picture

Check in the Monster template files, they do something with mob stats in gas files...I don't know if it would apply...I don't recall off the top of my head, something like this

il_main = #book_glb_magic_new:var(0 + #dif_merc * 2 + #dif_elite * 3 + #dif_vet * 4)

Sorry if that doesn't help.

Sharkull's picture

Thanks for the idea Balderstrom... after fixing up the syntax (by checking the monster templates) and testing, it seems like the engine doesn't like a calculated value being substituted into a parameter's name. Oh well, it was worth a try.

Episthene,
Thanks for the continued assistance. I've gone back to your original formula, and think I have something working for a conditional statement (the following code gives the newbie stuff in Vet)...

				if WhenModeNormal
				{
				deputy_talker:
					Report "deputy talk";
					startConversation deputy_give_gear, wait;
					if !WhenConversationChoice( deputy_talker, cancel_conversation )
					{	
						activate reward_a1_pq3_dryad_outpost_begin;// quest reward drop
					}
				}
				//This is the new stuff I've added...
				else if WhenModeVeteran
				{
					activate reward_a1_pq3_dryad_outpost_begin; //need to change this
				}

I think the previous failures were due to a combination of factors... all little things I didn't rule out independantly. It's been quite a while since I've debugged code (10-15 years?). :mrgreen:

Now, when I try to add a new reward template to the macros.gas file, and call it in the WhenModeVeteran section, I can't get it to work. Here's what I put into act1_macros.gas:

[a1_pq3_dryad_outpost_begin_veteran]
{
	[all*]
	{
		player_drop_type = all;
		il_main = #book_glb_magic_new:var3;
	}
}

When I try to activate a1_pq3_dryad_outpost_begin_veteran from the flick file, I break the conversation. I noticed there's a "role" initialization listing at the top of the flick file, so I added a reference to the new reward template there, still with no good effect. I am beginning to suspect that I'm missing a middle step... because the macros.gas file has templates for "a1_pq3_dryad_outpost_begin" and "a1_pq3_dryad_outpost_begin_mp" but the flick file calls "reward_a1_pq3_dryad_outpost_begin" (note the extra "reward_")... I been searching for another reference to "reward_a1_pq3_dryad_outpost_begin" but I'm stumped. Stare

Not sure where that reward comes from. They must have hard-coded something for that.
That's why I wanted documentation, since you end up doing guess work for no reason without good docs.
The only other reference is in the same file.

external role (prop) cell_door_1, cell_door_2, cell_door_3, cell_door_4,
taarIndicator,
warden_walk_back,
reward_a1_pq3_dryad_outpost_begin,

Maybe try to add

reward_a1_pq3_dryad_outpost_begin_veteran

and then you call it:

activate reward_a1_pq3_dryad_outpost_begin_veteran;

And then hope it magically reads your template, like it does for the other rewards.

If not, I would just give up and make it in skrit. There is no skrit documentation either, but at least if follows some known coding conventions. It does not magically append stuff for no obvious reason.

Creating an item is simple spell_summon.skrit has that. Just make your book instead of a monster.
I think it would be possible to link it with the flick system through the flick bindings (the only nice moddable addition with DS2, IMO).
Although I never tried before, the system seems solid, so it should not be a problem.

By the way, Activate and WhenModeVeteran are also flick bindings/functions. They are implemented in skrit, ultimately.

I don't suppose there is anythng about this in the new siegeU?

Balderstrom's picture

I've played thru the first half of Merc a number of times, the drops in the beginning was always the same. Thus what is dropped there is stored in a gas or skrit file no?

If your spell book has distinct levels you should be able to do the drop with pcontent and specify which item, and the level of the item by by doing that multiplication I mentioned earlier, ie: 30 * #LEV_MERC

I know pcontent can be used to specify specific things or random things, and what level as well...
Has this been attempted? why overlook doing so like that?

He wants an enchantable spellbook which gets better depending on the level (merc = good, etc.).

I doubt you could do that in the template only, but I could be wrong.
And yes, the drop is in a gas file.

The formulas like #is_normal, etc. are not always accessible. And they are never used in PContent drops, as far as I know.
When they are used (for monster levels and such), it is always when the end value is a number. Not a string/formula like:

il_main = #book_glb_magic_new:var2;
il_main = #book_glb_magic_new:var3;

which are formulas, but specific to PContent. you will not be able to append your calculated number at the end of this formula.
What you can do in templates is pretty limited, and if it is not already there, chances are it is not possible.

I think what you are missing is that enchantable items are pretty much like different templates, and they have to be called separately.
il_main = #book_glb_magic_new;
would probably only drop a normal spellbook, or a random spellbook (normal, good, etc.)
Even if you are able to set the item level in the spellbook template with your formula (which is possible), you will not be able to get the enchantable type you want (good, excellent, etc.).

Edit:

Maybe you are thinking something like this:

il_main = #book_glb_magic_new/10;

Assuming 10 is the item_level for good, let's say.
That could work.
But is no different than
il_main = #book_glb_magic_new:var2;

But the problem is to actually get to the right "il_main" line in the first place.

One thing that could be tried is this:

il_main = #book_glb_magic_new;
pcontent_min_level = (10 * #is_normal) + (20 * #is_veteran) + (30 * #is_elite);
pcontent_max_level = (10 * #is_normal) + (20 * #is_veteran) + (30 * #is_elite);

where 10, 20 and 30 are the corresponding item_level for the object.
I don't think it will work, but it is worth trying.

Balderstrom's picture

The latter part is what I was talking about, I just don't have the game installed atm to quote exact syntax.

Sharkull's picture

Thanks for the help folks... I havn't read all of SU yet, but I did read something that finally convinced me to start testing in DS2Mod (I'd been using TC2 + the retail exe :oops: ).

RE:

il_main = #book_glb_magic_new; 
pcontent_min_level = (10 * #is_normal) + (20 * #is_veteran) + (30 * #is_elite); 
pcontent_max_level = (10 * #is_normal) + (20 * #is_veteran) + (30 * #is_elite); 

This produces a magic book (blue), and breaks any other il_main items in the reward that allow pcontent... so: Sad

RE:

Maybe try to add 

reward_a1_pq3_dryad_outpost_begin_veteran 

and then you call it: 

activate reward_a1_pq3_dryad_outpost_begin_veteran; 

And then hope it magically reads your template, like it does for the other rewards. 

This doesn't work, but DS2Mod did produce a couple very helpful errors during the attempt:
Quote:
Type : Error
Severity : 2
Module : C:\Program Files\Dungeon Siege II Tool Kit\DungeonSiege2Mod.exe
Location : FlickManager.cpp line 3697 (at c:\depot\ds2\main\code\projects\mohawk\World\)
Contact : level design
Fail Count : 1 (w:166, e:5, x:0)
Exe timestamp: Nov 2 2005 23:38:24

CONTENT ERROR: It looks like flick[act1_town_warden_talk] role[reward_a1_pq3_dryad_outpost_begin_veteran] is missing from the flick source region[a1_01_06_jngtown]! As well as any other region in worldMap[ds2_world]! Did you forget to add this role's scidName in the editor? The Flick owner's goid[0x13000052] scid[0x001013be] template[cmd_run_flick].


Quote:
Type : Error
Severity : 2
Module : C:\Program Files\Dungeon Siege II Tool Kit\DungeonSiege2Mod.exe
Location : FlickManager.cpp line 4396 (at c:\depot\ds2\main\code\projects\mohawk\World\)
Contact : level design
Fail Count : 1 (w:166, e:6, x:0)
Exe timestamp: Nov 2 2005 23:38:24

CONTENT ERROR: Flick Role declaration Error! Sequence address[world/global/flick/sequences\ds2_world\act1_town\act1_town_warden_talk.flick] name[act1_town_warden_talk]
You cannot use a dynamic, non reserved, external role[reward_a1_pq3_dryad_outpost_begin_veteran]!


I found the scid_names.gas file, but have no clue how to safely add a new entry properly... (nor where any other references are needed). I had been hoping to avoid SE2 for now (preferring to stick with Notepad...) but I'll have to poke my nose around a bit before I (hopefully) find out what I need to do, and at least I have a clue now.

The reward thing is a container.

They are in ctn_quest.gas

gen_pcontent_a1_pq3_dryad_outpost_begin is the name of the one used.

you will need to create 3 new ones and drop them in SE2, for your spell book.

It is the easiest if you do not want to do it in skrit.

I think you are on your way now, so I will bow my reverence again. lol.
I am supposed to be gone. Just wanted to help you out on your first mod, since I know help is tough to get.

Episthene wrote:
The reward thing is a container.

They are in ctn_quest.gas

gen_pcontent_a1_pq3_dryad_outpost_begin is the name of the one used.

you will need to create 3 new ones and drop them in SE2, for your spell book.

It is the easiest if you do not want to do it in skrit.

I think you are on your way now, so I will bow my reverence again. lol.
I am supposed to be gone. Just wanted to help you out on your first mod, since I know help is tough to get.

It would be nice if you could help out. There is not so many with your coding knowledge that are willing to help out. We are not gpg and we could use all the help we can get Smile . Sorry to go on a tangent. Pm me if you want to comment.

I'm also happy to see you modding sharkull Smile . woot.

Sharkull's picture

Victory! :yahoo:

Total solution:
- Created two new macros in act1_macros.gas as follows:

[a1_pq3_dryad_outpost_begin_veteran]
{
	[all*]
	{
		player_drop_type = all;
		il_main = ... (stuff to drop in veteran only)
	}
}
[a1_pq3_dryad_outpost_begin_elite]
{
	[all*]
	{
		player_drop_type = all;
		il_main = ... (stuff to drop in elite only)
	}
}

- The quest reward that I wanted to tweak was limited to Mercenary by default, so I had to modify act1_town_warden_talk.flick to ensure that the quest reward was triggered in Vet and Elite too...
			if WhenModeNormal
			{
			deputy_talker:
				Report "deputy talk";
				startConversation deputy_give_gear, wait;
				if !WhenConversationChoice( deputy_talker, cancel_conversation )
				{	
					activate reward_a1_pq3_dryad_outpost_begin;// quest reward drop
				}
			}
			//new stuff starts here
			else 
			{
				activate reward_a1_pq3_dryad_outpost_begin;// quest reward drop
			}

- And finally the working conditional statement that eluded me for soooooooo long, in ctn_quest.gas:
[t:template,n:gen_pcontent_a1_pq3_dryad_outpost_begin]
{
	category_name = "quest";
	specializes = base_generator_pcontent;
	doc	= "gen_pcontent_a1_pq3_dryad_outpost_begin";
	extra_doc = "reference a1_01_06_jngtown  - talk flick act1_town_warden_talk";
	[gui]
	{
		item_level = (4.0 * #is_normal) + (40.0 * #is_veteran) + (64.0 * #is_elite);
	}
	[inventory]
	{
		create_pcontent_on_drop = true;
		[pcontent]
		{
			[oneof*]
			{
				[all*]
				{
					macro = a1_pq3_dryad_outpost_begin;
					chance = (1.0 * #is_normal);
				}
				[all*]
				{
					macro = a1_pq3_dryad_outpost_begin_veteran;
					chance = (1.0 * #is_veteran);
				}
				[all*]
				{
					macro = a1_pq3_dryad_outpost_begin_elite;
					chance = (1.0 * #is_elite);
				}
			}
		}
	}
}

I suspect that this logic would have worked in the macro, but I haven't tried that yet. Strangely enough, even though everything seems to work perfectly, I get the following error at runtime:
Type         : Error
Module       : C:\Program Files\Dungeon Siege II Tool Kit\DungeonSiege2Mod.exe
Location     : GoInventory.cpp line 8000 (at c:\depot\ds2\main\code\projects\mohawk\World\)
Fail Count   : 1 (w:54, e:1, x:0)
Exe timestamp: Nov  2 2005 23:38:24

Total 'remaining' is <= 0, nothing left for auto chance items! Check your math at 'world:contentdb:templates:interactive:containers:gen_pcontent_a1_pq3_dryad_outpost_begin:inventory:pcontent:oneof*'.
 

I can't understand why I should be warned about having a zero remainder on the chance ...but I can live with it.

Thanks again for all the help. ^_^

Take out [oneof*]
It should fix your problem.

Sharkull's picture

Thanks... I bypassed / removed the change to ctn_quest.gas, and got the chances to work in the macros. The error went away when I changed the [oneof*] to [all*] ... Laughing out loud

Nice work Sharkull. Maybe you'll be the one to make the next big TC? Wink

Sharkull's picture

sol77 wrote:
Maybe you'll be the one to make the next big TC? Wink

Laughing out loud
Sol77->> :tease: Crazy Insane

Pages