Reduce and restore attributes?

At a certain point in my plugin I want to reduce several of the player's attributes (i.e. speed = 2, strength = 30, dexterity = 15, etc.) to simulate the hero being sick in the end-game. I know how to do that much, but what I don't know is how to restore the attributes that he had before he 'got sick'. Since I expect that every player will reach this point with different stats, I can't just do strength minus 50, cured plus 50. One player might have 90 strength and the next player might have 600 strength.

I know this is done somehow with global checks, but how do you get the original stats back?

------------------
My Doctor said I was having too much wine, women, and song - so I gave up singing because 2 out of 3 is not so bad.
The (url="http://"http://www.evula.org/rduck/")Kingdom of Garendall(/url) sectional map is easily printed from gif format pages.
Find those areas you missed the first time around. You'll want to explore those hidden areas now made accessible with Spells Expander.

Quote

Originally posted by Rubber Ducky:
**At a certain point in my plugin I want to reduce several of the player's attributes (i.e. speed = 2, strength = 30, dexterity = 15, etc.) to simulate the hero being sick in the end-game. I know how to do that much, but what I don't know is how to restore the attributes that he had before he 'got sick'.
...
I know this is done somehow with global checks, but how do you get the original stats back? **

Carefully. The problem with just setting and restoring with globals is that the player's stats can change. Ie, if they have a strength potion in inventory, they get lowered and the immediately quaff a potion, then their strength is now different. When you reset them they will lose that bonus unless you compensate for that.

If you are going to add/remove a constant from the attribute(ie, minus 2) then this is very easy. Just use attribute wizards to remove the constant, and after the effect has worn off you can add it back with the attribute wizard. It doesn't matter what the value has been changed to since you are going to add the same value back when you are finished.

However, if you are going to set the attribute to a specific value(like 5) then we must use globals as we don't know where the attribute started out at.

Here is what I would do(for 1 attribute; just repeat the steps for additional stats):

  • Create a global to store current attribute(ie. &&gb;_oldstr)
  • Store the current attribute to the global
  • Change the current attribute to whatever value you want

At this point the player's attribute is changed. We also have kept track of what their initial attribute was as it is stored in our global. When we return their loss we need to make some additional checks...

  • Create a new global to hold a temporary number(ie. &&gb;_tempattribute)
  • Use a conditional to check if their current attribute is equal to the value that it was originally set at
  • If the current attribute is different then set the value of &&gb;_tempattribute to be equal to the value of that current attribute.
  • Subtract the value that that attribute was originally stored as from the temporary global value(ie, if you originally set the player to 15 and it is now 18, you will store in &&gb;_tempattribute the value "18" and then subtract "15" from it, leaving it with the value of 3)
  • Add the value of the temporary global value(&&gb;_tempattribute) to the stored attribute holder(&&gb;_oldstr) and store it as &&gb;_oldstr.
  • Set the player's attribute to be equal to the value of the stored attribute holder &&gb;_oldstr.

Basically you are going to be looking at the player's current attribute and, if it is different than what you originally set it to be, you will find the difference and add it to the original, then set it to that value. If the player's attribute went down for some reason(set at 15 and was reduced to 14) then there is a net loss of -1 and you will be adding -1 to it, so this should work fine.

Make sense?

------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) | (url="http://"http://www.evula.net")EVula.net(/url) | (url="http://"http://mail.ambrosiasw.com/mailman/listinfo/coldstone_dev")Coldstone-dev mailing list(/url) | (url="http://"http://ucplugs.evula.net/pog.html")PoG Upcoming Plug-Ins Directory(/url)

edit:
Stark beat me and was more thorough

myshkyn

------------------
"I'll give the fans just what they want, and nothing else at all."

(This message has been edited by myshkyn (edited 04-10-2003).)

Quote

Originally posted by myshkyn:
Stark beat me and was more thorough

Hehe. And I did so while busy at work too! 🙂

In all seriousness, don't feel the need to delete what you wrote just because someone else answered before you. Sometimes 2 responses, while identical in approach, can be worded differently. And that different wording can sometimes help someone who, after reading one response and is confused, understand what is written.

------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) | (url="http://"http://www.evula.net")EVula.net(/url) | (url="http://"http://mail.ambrosiasw.com/mailman/listinfo/coldstone_dev")Coldstone-dev mailing list(/url) | (url="http://"http://ucplugs.evula.net/pog.html")PoG Upcoming Plug-Ins Directory(/url)

Actually, what I want to temporarily alter is the max strength and not the current strength. I would prefer it if the player was unable to drink a potion of strength during this period or use spells or items which increase his strength.

I'm trying not to reveal the plot in advance but here's the scene. The hero meets a foe unlike any he's ever seen before, suddenly he feels weak and everything seems like it's taking place in slow motion. For this to be a sucessful fight, I want the playing field to be level. No matter how many elixirs this hero has downed in the past, this foe is his equal (or close to it.) Then it comes down to the skill of the player to block and strike and not be dependant on the Staff of Lordship, or the Spell of Moki, or whatever new weapons or spells someone can dream up. The hero can still quaff health potions and his stamina will not be affected (Lord knows, he's going to need it) but it's one on one in an even fight. To do this, I either have to match the hero to the foe or the other way around.

Any suggestions?

------------------
My Doctor said I was having too much wine, women, and song - so I gave up singing because 2 out of 3 is not so bad.
The (url="http://"http://www.evula.org/rduck/")Kingdom of Garendall(/url) sectional map is easily printed from gif format pages.
Find those areas you missed the first time around. You'll want to explore those hidden areas now made accessible with Spells Expander.

As per your statement, Stark, here is a less wordy, algebraic form of your method.
Let X equal current strength.
Let Y = X - 50, or Y=X / 2, or whatever.
Set strength to Y.
When the time for the modification if up, add ( X - Y ) to the player's strength.
In this method, both X and Y should be saved as globals, and it can be repeated with several different stats.

------------------
A tomb now suffices for him for whom the world was not enough.

Quote

Originally posted by Rubber Ducky:
**< snip>

**

Sorry for the double post; I had already done my answer to Stark, and I didn't feel like editing. To do this, give all of your strength enhancing items a conditional on their use. This will check a global, called X, for now. If it's value is 0, then the strength boost goes through.

When the boss combat starts, set X to 1 and you've disabled all the strength enhancements. For weapons and such that boost strength, give them the same condition, but on equipping them.

To give them a max strength, called Y, check their strength. If it is greater than Y, store it with my method and change it. If not, leave it untouched.

If this is a plug-in, some of these things might not be possible, depending on the permissions. I don't have PoG registered yet, after all. 🙂

------------------
A tomb now suffices for him for whom the world was not enough.

Quote

Originally posted by Celchu:
**.... To do this, give all of your strength enhancing items a conditional on their use. This will check a global, called X, for now. If it's value is 0, then the strength boost goes through.

When the boss combat starts, set X to 1 and you've disabled all the strength enhancements. For weapons and such that boost strength, give them the same condition, but on equipping them. ...**

Thanks, Celchu. I can see this working for the known weapons and spells, but I'm also wanting to avoid someone's future super sword. Since this plugin is not class specific, that makes a lot of spells and weapons to crimp.

Edit: What I think I need to do is something like Wizard of War but in reverse. In other words, while engaged in this fight the player is blocked from equiping other weapons or spells until the fight is over.

------------------
My Doctor said I was having too much wine, women, and song - so I gave up singing because 2 out of 3 is not so bad.
The (url="http://"http://www.evula.org/rduck/")Kingdom of Garendall(/url) sectional map is easily printed from gif format pages.
Find those areas you missed the first time around. You'll want to explore those hidden areas now made accessible with Spells Expander.

(This message has been edited by Rubber Ducky (edited 04-10-2003).)

Quote

Originally posted by Rubber Ducky:
Edit: What I think I need to do is something like Wizard of War but in reverse. In other words, while engaged in this fight the player is blocked from equiping other weapons or spells until the fight is over.

For the weapon thing, this is easy.

  • Create a weapon that has, as its unequip condition, that a global be set(similar to making an item undroppable)
  • Give it to the player and force him to equip it(making sure the global isn't set to a value allowing it to be unequipped)
  • After the battle set the global to allow for unequiping and either let the player unequip himself or do it automatically

For the spells/skills thing, this is more difficult. Trinity based skills/spells rely on utilizing the spell book and/or recast keydown. The keydowns for the spell book and the recast both utilize a class check based on the &&PlayerClass; global.

Therefore, in order to eliminate any spell/skill use you are going to have to save the player's current class in another global, and then change the &&PlayerClass; global to something other than 0-2(swordsman/ranger/conjurer). This will make it so that the player is unable to cast spells or use ranger skills, as they will no longer be that class. Make sure you switch them back afterwards.

  • NOTE: I don't recall if the trinity class check for the spell book checks to see if the global is 1 or 2, or simply greater than 0. You will want to check this and, if it is greater than, set it to 0 or less.

------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) | (url="http://"http://www.evula.net")EVula.net(/url) | (url="http://"http://mail.ambrosiasw.com/mailman/listinfo/coldstone_dev")Coldstone-dev mailing list(/url) | (url="http://"http://ucplugs.evula.net/pog.html")PoG Upcoming Plug-Ins Directory(/url)

I think that the method would work, but I personally, have a problem with some of it. Conjurers are made for spells. Saying, "Conjurer, you can't use spells" is like saying, "Swordsman, you can't use a sword." You are cutting off the main abilities of the character. The weakening is ok, but the ability to stop spells...dead, makes no sense and completely ruins the role of the Conjurer. The Conjurer is then seen as a guy with spells to assist him, but these are rarely used and only to make things a bit more convenient... Maybe certain spells could be cut off, but the whole arsenal? I think the solution is to make the boss harder. If someone creates a supersword it is a cheat. They exist, and if people win by cheating, so be it. Meanwhile, I think that the idea of a fairer (never will be FAIR as you have an instant replay, read: save, button and a brain 😉 ) combat is a good idea. It means you actually have to think. However, a blocking/striking time test is not thinking. A computer can be programmed with the correct delay between blocks/strikes and do it better than us. A more challenging battle would need to be based on ideas and strategy. Maybe the guy shoots fireballs, or is surrounded by minions. Then you would need to think, who do I kill first, etc. Removing healing is a GREAT idea as it makes the player use their one life well and not go around recklessly attacking all ready to fire off filters of healing... Remember to remove healing spells and Axe's new mushrooms too! Anyway, the concept is good, but the details need a bit of fine-tuning.

------------------
CI-I@()s
(url="http://"http://www.evula.org/world-of-cha0s/")The Homepage of Cha0s(/url)

I have no problems with an anti-magic sphere/zone. I'm considering much the same thing for a little something I've got on the back burner... 🙂

------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) | (url="http://"http://www.evula.net")EVula.net(/url) | (url="http://"http://mail.ambrosiasw.com/mailman/listinfo/coldstone_dev")Coldstone-dev mailing list(/url) | (url="http://"http://ucplugs.evula.net/pog.html")PoG Upcoming Plug-Ins Directory(/url)

Quote

Originally posted by CI-Ia0s:
Remember to remove healing spells and Axe's new mushrooms too! Anyway, the concept is good, but the details need a bit of fine-tuning.

And how would you suggest that he limit which spells are castable?

In order to do that he would have to copy every spell currently in existance, and copy their code in order to put the proper conditional checks on their casting feature. Since I do not plan on making the Spells Expander source code public-ware, and I doubt you plan on doing so for WoC, and I doubt Cafallll will do it for TFM(whenever it is done), not to mention future plug-ins... well, this is not feasible.

You can restrict everything or nothing. It is possible to do this.

Now, if someone chooses to do this and you don't like it, well, you have the option not to use the plug-in. I, however, like a good challenge. 🙂

------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) | (url="http://"http://www.evula.net")EVula.net(/url) | (url="http://"http://mail.ambrosiasw.com/mailman/listinfo/coldstone_dev")Coldstone-dev mailing list(/url) | (url="http://"http://ucplugs.evula.net/pog.html")PoG Upcoming Plug-Ins Directory(/url)

How do multiple people restrict all spells? I don't think that is possible... You would have to make it impossible to open the spellbook which would require adding a conditional... But if two people did it... One person's no spell area would have no spells but the other would work normally WITH spells. Then people would have to start adding to eachother's plugins again, and we are already having troubles enough with timers, etc. The only other way to stop a spell from casting is to add a conditional to THAT spell and then you get the problem... Anyway, my point is that the spells should be the main force behind a Conjurer. Why else would you be a Conjurer? Conjurers can't wield the best weapons or armor. They can't brew potions and they are not very skilled with bows. So, what can they do? SPELLS. Like I said, it is like stripping a Swordsman of his sword, armor, and strength, his main abilities. Do you plan to do that and have him fight with his hands? And remove the bows and potions from the Ranger? I admit, it is not EXACTLY the same, but it is very similar.

------------------
CI-I@()s
(url="http://"http://www.evula.org/world-of-cha0s/")The Homepage of Cha0s(/url)

Quote

Originally posted by CI-Ia0s:
How do multiple people restrict all spells? .........

It only takes one person to change the lightbulb if the lightbulb really wants to change. I think I have it solved now, in my head at least, and I thank you all for your input. Being an eclectic type of person, I have harvested some ideas from several answers above and you will now have to wait until you play the plugin to know what the result is.

Thanks again, I'm off and writing. 🙂 ~RD

------------------
My Doctor said I was having too much wine, women, and song - so I gave up singing because 2 out of 3 is not so bad.
The (url="http://"http://www.evula.org/rduck/")Kingdom of Garendall(/url) sectional map is easily printed from gif format pages.
Find those areas you missed the first time around. You'll want to explore those hidden areas now made accessible with Spells Expander.

Quote

Originally posted by CI-Ia0s:
How do multiple people restrict all spells? I don't think that is possible... You would have to make it impossible to open the spellbook which would require adding a conditional... But if two people did it... One person's no spell area would have no spells but the other would work normally WITH spells.

Umm.. sure it is. Read my above switching of the player's class.

2 plug-ins can have the exact same conditional check as long as the event names are different. I would also assume that this is going to happen within a map of Ducky's creation which would be another check against conflicts.

Restricting all spells is very possible. Restricting selective spells is nigh impossible.

------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) | (url="http://"http://www.evula.net")EVula.net(/url) | (url="http://"http://mail.ambrosiasw.com/mailman/listinfo/coldstone_dev")Coldstone-dev mailing list(/url) | (url="http://"http://ucplugs.evula.net/pog.html")PoG Upcoming Plug-Ins Directory(/url)