Any advice on how this is done? OnClient Enter and Exit?
Keeping Up Conditions on Players Between Modules
#1
Posté 04 août 2014 - 03:32
#2
Posté 04 août 2014 - 04:17
What kind of conditions? Like a curse?
I would think OnClientEnter would be the ideal way to do it, with a flag of some sort on PC. Like, if they were supposed to have some kind of plague, I'd just check to see the flag is set, and then apply the effect.
#3
Posté 04 août 2014 - 05:05
I mean all conditions...like ability drain, curses, etc. whcih tend to go away when you switch modules.
#4
Posté 04 août 2014 - 05:15
Are you talking about modules in the same campaign? I think global variables are retained across a campaign.
I guess then you'd need a script to loop through all the characters in the party, cycle through their conditions, and store their conditions as arrays, then restore them on the new module load.
If it's an independent module, probably all bets are off....
#5
Posté 04 août 2014 - 05:55
Yep, between modules in the same campaign. Only issue if Effects can't be stored as varibles, so this code bit will be a beast to do...unless someone has done it already, or if there is an include that does the tough work....
#6
Posté 04 août 2014 - 06:55
Yeah, it probably will be a pain to cover every effect. Too bad there's not an EffectToString/StringToEffect call.
I wonder whether ObjectToString/StringToObject will preserve active effects? I suspect it's module-specific though.
#7
Posté 04 août 2014 - 07:00
Oh, man... it's brutal.
I tried it. I got it *kind of* working, but there were some serious issues.
I wanted to keep all buffs on the PC and party members, and re-buff them when a cut-scene conversation ended. I love cut-scenes, but I hate losing buffs during the conversations. So I was doing the same thing you want to do: storing all the effects on each party member in variables, and then using those variables to re-buff each character. It can be done - but there are issues...
When I started trying to do this, my first thought was, "just cycle through the effects on the creature, and store the effect, and then call ApplyEffectToObject() on the creature to re-apply the effect." However... if you look into the spell scripts, there's a lot of work going on for individual spells, and a lot of calculations and such, depending on the exact spell, and all of that tends to happen before the effect is applied to the creature. Taking a look at the Mirror Image script will give you a good idea of all the work that happens before the effects are applied. And then there's the matter of applying the correct effect linkage, etc. I mean.. it's just not straight-forward to examine the creature's current set of effects and re-create them.
So... After I failed getting it to work going down that route, I opted to just re-cast the individual spells on the PC and party. It seemed like a straight-forward matter to simply record the spell as it was cast, get the caster's level, and then re-cast the spell on the target. You need to save much less data this way: just the spellId and who cast it. Now, this works, but still has issues, due to duration of spells related to caster level, randomly generated number of effects (again, Mirror Image is a problem here), and some other things.
Technically... this approach can work. But... given the time and effort to make it work, and some of the issues that still aren't solvable doing it, I wouldn't advise it. People expect their effects to go away when they cross modules. It's not a big deal.
I just give my campaign three special rods of Sequencing. It allows casters to buff themselves instantly, and non-spell-casting party members get the group buffs (like Bless), as they normally would. My rods allow the user to store 5, 10 or 15 spells, cast all instantly, and can be used 3x per day. In playtesting... it has been something I very much enjoy using (working great in MoTB).
If you want to make sure the PC or party members retain some sort of curse or plague or whatever, I'd just write some specialized code for that, in OnClientEnter.
If you still want to go down the road of saving and restoring spells, I can help. Pointer: start with spellhooking. That lets you capture the necessary data before the spell is cast, and then you can store the relevant data on the target object.
#8
Posté 04 août 2014 - 07:35
In terms of switching between modules, what I was think is if you just code it to preserve the permanent, supernatural effects, then it would be a lot easier to do. (On the principle that everything else will wear off.) Just check the GetEffectSubType and GetEffectDurationType for all effects.
#9
Posté 04 août 2014 - 10:11
yeah, the fact that "effect" is not a variable type is the real problem....since if it were. all that stuff would be in with it.
RJShae's idea isn't terrible,
all things considered, though my issue is that I will have module shifts inside dungeons (making dungeons updateable to add more areas makes this a must).. Spells are complicated, BUT most of those things can be captured as variables (all ints and floats mostly), so that's not a huge issue, but still...yeah.
#10
Posté 06 août 2014 - 05:25
So, I wrote an include file for this, but haven't tested it yet. A few things to note:
-I have no way to grab the actual duration (float fDuration) off of an effect, so Perm effects only
-some effects have floats in them (looking at you regeneration), so likely will not work either (not that those are usually perm)
-many have their integers stored in a dif order from the order you enter them in, and those will therefore be wrong in my code (until I, you know, change them)
#11
Posté 06 août 2014 - 09:39
Fail; doesn't seem to be firing from OnClient Scripts.





Retour en haut






