Highv Priest wrote...
Lightfoot8 wrote...
Highv Priest wrote...
It doesn't transfer ownership(at least for effects which are the only things that have "GetCreator" anyway). For instance if you use executescript on a PC from a module event. The effect applied is applied under the module and not the PC. The executescript as far as I can tell only sets the OBJECT_SELF to be the thing it's running on, but doesn't flag it as the owner of the script being run.
It does transfer ownership, Even for effects. If from a module event you execute a script on the PC and the script that is now running on the PC creates an effect, the PC will be the creator not the module.
You must forgive me if I sound arrogant, but I know for certain that executescript does not change "GetEffectCreator" which is how I determine "ownership" of the script. Example =
if(GetLevelByclass(class_TYPE_ASSASSIN, oPC) >= 3)
{
ExecuteScript("bloodoath", oPC);
}
This script is applied both onrest and when weapons are unequipped, because we give an AC bonus for dual weilding and using large weapons(not that uncommonly). Assassins on our server receive an AC bonus relative to int mod(learned observation of combat methods and effective ability to deflect oncoming attacks based on perceived patterns is the explanation as to why they are given an AC bonus) Both events are module defined. On the weapon unequip this check is put to remove the AC bonus for weapons being removed:
while(GetIsEffectValid(eRemove))
{
if(GetEffectSubType(eRemove) == SUBTYPE_EXTRAORDINARY)
{
if(GetEffectType(eRemove) == EFFECT_TYPE_AC_INCREASE)
{
if(GetEffectDurationType(eRemove) == DURATION_TYPE_PERMANENT)
{
if(GetEffectCreator(eRemove) == oSelf) oSelf is the module here.
{
RemoveEffect(oPC,eRemove);
}
}
}
}
eRemove = GetNextEffect(oPC);
}
Now as you saw the executescript is being applied to the PC, which SHOULD transfer ownership of the effect to the PC, because the PC is defining, creating, and applying the effect. However it -doesn't-, the module is still considered the creator of the effect and between being stuck in exams and other problems I just decided to reapply the effect after weapon removal instead of figuring out what fool-proof method DOES transfer ownership. Although according to nwnlexicon(which is usually a pretty good resource) assigning an inner-include block of code with assigncommand does this, I couldn't be arsed to take the time testing it to find out until I get these real life problems out of the way.
Well it does not matter if you sound arrogant or not. Execute script does transferr the ownership.
As for your argument I only see the script getting ran on an object pointed to by the var oPC, I have now way to comfirm that it is a PC. There is really not enough of the application of the effect for me to tell who is applying it or how it is applyed.
To show that ownership does transfer I wrote two simple script. The first I placed in the OnEnter event for the first area. It is:
void main()
{
object oObj = GetFirstObjectInArea(OBJECT_SELF);
while (GetIsObjectValid(oObj))
{
ExecuteScript("effect",oObj);
oObj = GetNextObjectInArea(OBJECT_SELF);
}
}
The effect script that it runs on every object in the area is:
void main()
{
effect test = EffectCurse();
string Creator = ObjectToString(GetEffectCreator(test));
SendMessageToPC(GetFirstPC(),"Creator ="+Creator);
}
The output was as follows.
[CHAT WINDOW TEXT] [Thu Feb 07 17:32:51] Creator =d
[CHAT WINDOW TEXT] [Thu Feb 07 17:32:51] Creator =a
[CHAT WINDOW TEXT] [Thu Feb 07 17:32:51] Creator =4
[CHAT WINDOW TEXT] [Thu Feb 07 17:32:51] Creator =3
[CHAT WINDOW TEXT] [Thu Feb 07 17:32:51] Creator =b
[CHAT WINDOW TEXT] [Thu Feb 07 17:32:51] Creator =7
[CHAT WINDOW TEXT] [Thu Feb 07 17:32:51] Creator =2
[CHAT WINDOW TEXT] [Thu Feb 07 17:32:51] Creator =7ffffffe
[CHAT WINDOW TEXT] [Thu Feb 07 17:32:51] Creator =c
[CHAT WINDOW TEXT] [Thu Feb 07 17:32:51] Creator =6
[CHAT WINDOW TEXT] [Thu Feb 07 17:32:51] Creator =8
[CHAT WINDOW TEXT] [Thu Feb 07 17:32:51] Creator =9
[CHAT WINDOW TEXT] [Thu Feb 07 17:32:51] Creator =5
As you can see every effect was created by a differant object.
I am not shure what is causing the problem in your script. I can only tell you that it is not a problem with executeScript not changing ownership.
Modifié par Lightfoot8, 07 février 2013 - 10:48 .