Setting protection values

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Setting protection values

Post by Yukiko »

I need some insight from the experts on something.

I am adding protections for certain hides and ores. I had decided to set the intrinsic resistance mod members on the armour as it is crafted and, and for my custom protections set them as CProps on the item, then have the equip and unequip scripts add and remove the protections from the player as each item is equipped or unequipped respectively. I'm reading the protection info from a cfg file based on the objtype of the raw material. I'm storing the protection type and the base value of the protection in the cfg file. Is this the best way to do this or should I have the equip script look up these protections from the config file and apply them to the character's resist mod members on the fly as each item is equipped then do the same to remove protections as the items are unequipped?

Example of the config file:

Code: Select all

Item 0x8895
{
	Protection			Fire 3
}

My original idea would make writing the skill scripts used to identify protections inherent in a piece of armour (probably armslore) simpler but could add extra text to the world data file in the form of CProps. The latter idea sounds more clever but it would require the same look-up in the config file for the armslore skill when a player wanted to find out what protections are on a piece of armour. This isn't that big of a problem really though. Also the "on the fly" method would allow pre-existing items made from special materials prior to me getting this implemented to inherit the new protections. The pre-existing items wouldn't have the intrinsic mod values under my original method so would not have the protections added when equipped.

I'm not sure if I explained this clearly enough but I'll ask anyway. Which method would be the best? Would looking the values up in a cfg file each time an item is equipped/unequipped be much of a burden on the server versus the equip script just reading the intrinsic mod from the item and transferring that to the character and then removing it in the unequip script? Would one method be less likely to glitch and accidentally leave the mods on a character if an item is unequipped?

I hope this made sense.

Thanks in advance.
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Setting protection values

Post by Turley »

Didnt read everything cause still a bit drunk... :)
But in general reading from a CfgFile has the same or almost the same speed as reading a CProp (except the first time). Since a cfgfile remains in the memory.
The only downside is that you cannot store complex values inside it without a convertion. eg you can store an array direct as CProp but for a cfgelem you need to convert it.
I would suggest you read it with GetConfigStringDictionary() if its possible to have more then one protection element. This should be very close to your wanted format, you only need to do one CInt().
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Re: Setting protection values

Post by Yukiko »

Thanks Turley. I think I'm going to do it the way I originally had planned to. It seems the most logical rather than having the equip/unequip scripts do the work. After I made the post I thought about what I was asking and realized it was a stupid idea to change it. Well, the second idea I had was stupid anyway. I was trying to allow items created from "special" materials prior to incorporating protections to inherit them but it isn't that big of a problem since my playerbase is very small and those who are playing on my server know it's in beta phase right now.

Aren't you glad there are no police writing tickets for driving drunk on the Information Super Highway?

Happy New Year everybody!!!
Post Reply