Author Topic: Need scripting help with new system  (Read 627 times)

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Need scripting help with new system
« on: August 29, 2011, 10:08:34 pm »


               OK, so, what I want to do is use Feats, applying them to the PC's skin, to apply properties which will in turn will substitute Racial Bonuses, obviously I will be using Great Strength I / II / III / etc, but I will be using ALL of the Feats for Great (ability) 1 - 10.

Basically what I need is help scripting the removal & adding of feats (to the PC Properties) based upon whether or not a PC has the actual feat. (This script will fire from the OnPCLevelUp Module Event)

Don't know if this is possible if the PC already has feat of the same type on their skin.
(On their skin and taking the same feat at level up)

GetHasFeat seems like it would probably just return if the PC has the Feat at all, not whether or not if it's actually a feat that they took at Level Up.

Anyone have any suggestions?
               
               

               


                     Modifié par _Guile, 29 août 2011 - 09:09 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Need scripting help with new system
« Reply #1 on: August 30, 2011, 12:58:23 am »


               

_Guile wrote...

OK, so, what I want to do is use Feats, applying them to the PC's skin, to apply properties which will in turn will substitute Racial Bonuses, obviously I will be using Great Strength I / II / III / etc, but I will be using ALL of the Feats for Great (ability) 1 - 10.

Basically what I need is help scripting the removal & adding of feats (to the PC Properties) based upon whether or not a PC has the actual feat. (This script will fire from the OnPCLevelUp Module Event)

Don't know if this is possible if the PC already has feat of the same type on their skin.
(On their skin and taking the same feat at level up)

GetHasFeat seems like it would probably just return if the PC has the Feat at all, not whether or not if it's actually a feat that they took at Level Up.

Anyone have any suggestions?


GetHasFeat() would return item feats as suspected.  You could on Levelup remove all the Great Ability feats on the skin and then readd them as necessary.
               
               

               


                     Modifié par WhiZard, 30 août 2011 - 12:00 .
                     
                  


            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Need scripting help with new system
« Reply #2 on: August 30, 2011, 12:38:21 pm »


               Yes, that was what I was thinking as well, except, there would need to be some way of keeping track of what has been applied to the skin, maybe a copy the properties to another item?

Or better yet, maybe just take the skin from the PC and then give it back when we are done?
Unfortunately that would lower ability scores and players would get ticked having to re-memorize spells etc. '<img'>

Maybe a custom function which looked for iProp, if found, set local int on the PC remove iProp, and then after a delay return the property back on the item.  This way we don't have to remove all properties, only those that we are checking.

What do you recommend?
               
               

               


                     Modifié par _Guile, 30 août 2011 - 11:41 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Need scripting help with new system
« Reply #3 on: August 30, 2011, 06:53:41 pm »


               

_Guile wrote...

Yes, that was what I was thinking as well, except, there would need to be some way of keeping track of what has been applied to the skin, maybe a copy the properties to another item?

Or better yet, maybe just take the skin from the PC and then give it back when we are done?
Unfortunately that would lower ability scores and players would get ticked having to re-memorize spells etc. '<img'>

Maybe a custom function which looked for iProp, if found, set local int on the PC remove iProp, and then after a delay return the property back on the item.  This way we don't have to remove all properties, only those that we are checking.

What do you recommend?


I haven't put the great ability feats into an item property 2da, but it does look like each ability feat replaces all earlier ones for the full bonus without stacking.  So if your ability bonus is 2 (higher also works) you could leave a gap and only go through in removing when the gap begins to fill.  E.g. if race/subrace gives +2 strength, use only Great Strength II and not Great Strength I.  When character gets Great Strength I, then recalculate.  Again this is just a suggestion, I have not tested how particular feats would stack  in this regard.
               
               

               
            

Legacy_Terrorble

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Need scripting help with new system
« Reply #4 on: August 31, 2011, 12:30:26 am »


               Sorry, slightly off topic...
I tried adding Gr Str feats to skins in the past and it didn't seem to have any effect.  What I was
trying to do was have shifters use base stats for certain abilities, then add a certain amount of Gr Str/Dex etc feats based on level and shape.  Problem was, the feats applied to the skin didn't seem to have any effect.  Maybe I didn't actually add them to the player skin, but to the shape's skin instead.  It was a long time ago.
So the question is, adding Gr Str feats to the player skin does actually work?
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Need scripting help with new system
« Reply #5 on: August 31, 2011, 03:20:25 am »


               

Terrorble wrote...

Sorry, slightly off topic...
I tried adding Gr Str feats to skins in the past and it didn't seem to have any effect.  What I was
trying to do was have shifters use base stats for certain abilities, then add a certain amount of Gr Str/Dex etc feats based on level and shape.  Problem was, the feats applied to the skin didn't seem to have any effect.  Maybe I didn't actually add them to the player skin, but to the shape's skin instead.  It was a long time ago.
So the question is, adding Gr Str feats to the player skin does actually work?


Shifts don't merge skins, so that could be another explanation.  However, I agree it would be a good idea if the great ability feats were retested.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Need scripting help with new system
« Reply #6 on: August 31, 2011, 11:45:28 am »


               I also tested this loong time ago. Great abilities doesnt work on the skin. Only Epic toughness.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Need scripting help with new system
« Reply #7 on: August 31, 2011, 12:54:06 pm »


               

ShaDoOoW wrote...

I also tested this loong time ago. Great abilities doesnt work on the skin. Only Epic toughness.


Did your test include a recalculation thereafter
(e.g. ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectAbilityIncrease(...), oCreature, 0.1)'<img'>

I remember you saying something similar about monk speed, though recent Toolkit tests indicate that this feat when used on creatures in Toolkit does indeed raise max speed from 1.5 to 3.0 + monk level/3.
               
               

               


                     Modifié par WhiZard, 31 août 2011 - 11:59 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Need scripting help with new system
« Reply #8 on: August 31, 2011, 04:00:37 pm »


               

WhiZard wrote...

ShaDoOoW wrote...

I also tested this loong time ago. Great abilities doesnt work on the skin. Only Epic toughness.


Did your test include a recalculation thereafter
(e.g. ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectAbilityIncrease(...), oCreature, 0.1)'<img'>

I remember you saying something similar about monk speed, though recent Toolkit tests indicate that this feat when used on creatures in Toolkit does indeed raise max speed from 1.5 to 3.0 + monk level/3.

No I didnt tried it in those times, why should it change anything? But... I took that work to try it again just to proof again and it doenst work of course, why it should really?

But same as monk speed I havent tried in on NPC only on PC, also why since you can set ability/speed directly in toolset? It has no effect on non-monk PC, what the advantage of it on NPC?
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Need scripting help with new system
« Reply #9 on: August 31, 2011, 04:06:54 pm »


               Did you guys edit the 2da to add the property to the "iprp_feats" list?

I'm not even sure there is a constant in the list for Great Strength I-X (etc) in the script editor, how did you apply the property to the skin without definining the constant?
               
               

               


                     Modifié par _Guile, 31 août 2011 - 03:08 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Need scripting help with new system
« Reply #10 on: August 31, 2011, 04:24:50 pm »


               Ofc, you must edit the ippr_feats.2da and add it. But as I said it doesnt work for Great abilities so you can spare some work. Also can suggest to download BH's itemproperties expanded which contains lots of additional bonus feats via edited iprp_feats.2da
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Need scripting help with new system
« Reply #11 on: September 01, 2011, 01:46:23 am »


               Thanks Shadow. '<img'>
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Need scripting help with new system
« Reply #12 on: September 01, 2011, 04:20:43 am »


               

ShaDoOoW wrote...
No I didnt tried it in those times, why should it change anything? But... I took that work to try it again just to proof again and it doenst work of course, why it should really?


I assume this means you don't know what weird commands like this do to "recalculate".  If you do then simply ignore the following discussion.

--- Effect Stacking and Recalculation---
Ever wonder why occasionally effects when added in different orders can produce differing results?

Take for instance damage immunity increase/decrease for example.
First define 3 damage immunity effects
2 will resist 60% fire and 1 will give 40% vulnerability.  (Make sure the two 60% are gotten separately, otherwise removing one will remove them both).

Now look at the two different progressions of applying effects.

Progression 1
1. Add a 60% increase (Damage immunity is now at 60%)
2. Add a 40% decrease (Damage immunity is now at 20%)
3. Add a 60% increase (Damage immunity is now at 80%)
4. Remove a 60% increase (Damage immunity is now at 20%)

Progression 2
1. Add a 60% increase (Damage immunity is now at 60%)
2. Add a 60 % increase (Damage immunity is now at 100%)
3. Add a 40% decrease (Damage immunity is now at 60%)
4. Remove a 60% increase (Damage immunity is now at 20%)

What just happened?
The system when it adds effects often procedes recursively.  I add 60% to 60% and reach the cap at 100%.  I subtract 40% from 100% and get 60%.  Even the damage applications do not call the system to look at all the effects, however removing an effect will cause the system to do a recalculation.  When a recalcuation is performed all the related effects are re-totaled and then the cap is applied at the end.

Example 2 Monk/Barbarian speed
Monk and Barbarian speed are the more noticable recursives as they do not need a cap to show their unusal traits.  Note: monk and barbarian speed bonuses do not stack.

Consider a level 3 monk that is given mass haste and expeditious retreat.

Normal speed: 1.1 * base speed
Mass haste speed:  1.75 * base speed
Expeditious and Mass haste speed: 2.725 * base speed
Speed after removing either haste or expdetious retreat: 1.6 * base speed.

What happened? 
Monk/barbarian speed is an added percent of base speed while effects are multiplicative.
The system uses the following equation to go from one application to the next:
New speed = Old speed * (new effect multiplicative factor) + monk/barbarian speed.
*Note the new speed is capped at 1.5 * base speed, unless the target has monk speed in which case the cap is (3.0 + monk bonus) * base speed.

For our example then
The first speed is the simple 1 + 0.1 = 1.1
The second is 1.5 * first + 0.1 = 1.75
The third is 1.5 * second + 0.1 = 2.725
The fourth is a removal and thus performs a recalcuation.

For speed the recalculation is to multiply all the effects in adding the monk/barb bonus in once thereafter.
So at step four we would have 1.0 (normal) * 1.5 (effect remaining) + 0.1 (monk bonus) = 1.60

---- Summary ----
The game often does not look at the character but often does recursive math when stacking effects.  The removal of an effect that would influence the calculation will call for a recalculation; otherwise the game is quite happy to consider the "recursive score" for its damage, speed and other calculations.

A good fix for telling the game to perform a recalculation is to apply a short lasting (e.g. 0.1 second) effect that would influence the relevant calculation so that its immediate removal would trigger a recalculation.



But same as monk speed I havent tried in on NPC only on PC, also why since you can set ability/speed directly in toolset? It has no effect on non-monk PC, what the advantage of it on NPC?

Adding monk speed may not trigger the necessary recalculation.  Non-monks with monk speed benefit not from the speed bonus, but rather from the speed cap (1.5) being increased (to 3.0 + monk bonus).  This allows for faster travel than haste.