Author Topic: More wand woes  (Read 1571 times)

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9836
Re: More wand woes
« Reply #60 on: April 28, 2017, 05:46:38 PM »
But...
What I am saying is that it all appears to be working fine for me, using the script as it is. I am not using any of the user defined slots, but am using $TargetContext() and $AttackerContext() without any error messages. I can select the opponent, and the aura is given to them.
I don't really know what to say to this...I am not having any problems with this. i have been helping, or so I thought. But it sounds like not really as much as I had hoped.

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2235
Re: More wand woes
« Reply #61 on: April 28, 2017, 05:57:27 PM »
Quote
What I am saying is that it all appears to be working fine for me

If it works then it works because of a bug in the engine
and you have been lucky to have received the desired
data from a left-over context of another hook.

It won't work in the next engine release.  I have fixed it.

Edit:
Using undocumented features discovered by accident can
cause rather unexpected problems in the far future when
you are not so lucky.  I discourage it.
« Last Edit: April 28, 2017, 06:19:27 PM by Paul R. Stevens »

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9836
Re: More wand woes
« Reply #62 on: April 28, 2017, 06:23:03 PM »
Well, then.

I was using the $AURA_Create() function in the ProcessSpellTargetOverride Hook before there is a $TargetContext(). I know I can add a user defined parameter, three of them according to the documentation, but how can any of them be the target? Perhaps this will make sense after some more "trial and error", becaise it is not clear to me now.

I guess I really don't understand what you are saying as to the user defined slots. The function, $AURA_Create() has 3 user defined parameters. If you mean the ARUA_Create Hook and it's parameters, I don't understand how using a parameter helps if I can't use any contexts.

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2235
Re: More wand woes
« Reply #63 on: April 28, 2017, 07:07:24 PM »
Your script executes $AURA_Create().  That script is implementing
the ProcessSpellTargetOverride hook.  That hook runs with
TargetContext, AttackerContext, and SpellContext.

So you should:
var attacker = $IndexOf($AttackerContext());
var target = $IndexOf($TargetContext());
$AURA_Create(sa, param, attacker, target, ""); // data [0[ and [1];

In the hook "AURA_Create":
var attacker = $AURA_GetData(0);
var target = $AURA_GetData(1);
Instead of:   function($AttackerContext());
you would use:  function($IndexToActor(attacker));

Of course many functions use the index directly without conversion to actor:
$GET_CHAR_THAC0(attacker);
« Last Edit: April 28, 2017, 07:10:19 PM by Paul R. Stevens »

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9836
Re: More wand woes
« Reply #64 on: April 29, 2017, 02:38:22 PM »
Your script executes $AURA_Create().  That script is implementing
the ProcessSpellTargetOverride hook.  That hook runs with
TargetContext, AttackerContext, and SpellContext.

So you should:
var attacker = $IndexOf($AttackerContext());
var target = $IndexOf($TargetContext());
$AURA_Create(sa, param, attacker, target, ""); // data [0[ and [1];

In the hook "AURA_Create":
var attacker = $AURA_GetData(0);
var target = $AURA_GetData(1);
Instead of:   function($AttackerContext());
you would use:  function($IndexToActor(attacker));

Of course many functions use the index directly without conversion to actor:
$GET_CHAR_THAC0(attacker);

You know what? That actually all makes sense. I am declaring a vairable outside of the Hook, and that variable is coincidentally a context not used in the Hook. But in the Hook, the script sees a variable and doesn't know (or care) what the variable represents because it is above the Hook's pary grade.

Offline marainein

  • Sr. Member
  • ****
  • Posts: 372
Re: More wand woes
« Reply #65 on: April 29, 2017, 05:46:21 PM »
Can I request an updated version of this script, so I can see if it fixes the wand problem?

Also, when an aura is created, what happens to creatures caught in its area at the time of creation? Does AURA_Enter get called for them immediately after AURA_Create?

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9836
Re: More wand woes
« Reply #66 on: April 29, 2017, 06:05:48 PM »
As soon as I write the script (this weekend), I will post it in this thread. :)

In my past experimentation using AURA for a fireball type effect, damage was applied to all combatants in the AURA area when spell was cast, i.e. after AURA_Create but before the next round.

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2235
Re: More wand woes
« Reply #67 on: April 29, 2017, 07:02:42 PM »
Quote from: Manikus
doesn't know (or care) what the variable represents because it is above the Hook's pary grade.

Precisely.  And the central inversion (eversion??) of the hook's
penultimate parameter is symmetric to its own image, resulting
in the necessary confluence of inter-script gradient (or pary grade).

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9836
Re: More wand woes
« Reply #68 on: May 01, 2017, 01:13:45 PM »
Some people, who are not developers, may not know what "pary grade" is. Pary grade is that sweet spot that is exactly halfway in between "pay grade" and "party grade". ;)

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9836
Re: More wand woes
« Reply #69 on: May 02, 2017, 02:53:23 PM »
The scripts are rewritten, but they don't work yet. Well, one does, but the other is not going to work until after bugfix (this is first up in the queue after the current issue).

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9836
Re: More wand woes
« Reply #70 on: May 11, 2017, 05:57:19 PM »
Engine and editor 2.88 allow my scripts to function as intended. :)

Here is what I have...

Code: [Select]
\(BEGIN)
name = spellArcaneLight
[OverrideSpellTargeting] = $VAR p5; $VAR p6; $VAR list; $VAR loc;
-p5 = $GET_HOOK_PARAM(5);
-p6 = $GET_HOOK_PARAM(6);
-list = "$Map$Combatant";
-loc = "$" + p5 + "$" + p6;
-$SET_COMBATANT_SA($AttackerContext(),"spellArcaneLightTargetXY",loc);
-$RETURN list;
[ProcessSpellTargetOverride] = $VAR p5; $VAR com; $VAR atk; $VAR tgt;
-p5 = $GET_HOOK_PARAM(5);
-atk = $IndexOf($AttackerContext());
-tgt = $IndexOf($TargetContext());
-$AURA_Create("arcaneLightAURA",p5,atk,tgt,"");
\(END)

\(BEGIN)
name = arcaneLightAURA
[AURA_Create] = $VAR atk; $VAR tgt; $VAR prm; $VAR pXY; $VAR X; $VAR Y;
-atk = $AURA_GetData(0);
-tgt = $AURA_GetData(1);
-prm = $SA_PARAM_GET();
-pXY = $SA_COMBATANT_GET("spellArcaneLightTargetXY");
-X = $DelimitedStringSubstring(pXY,0);
-Y = $DelimitedStringSubstring(pXY,1);
-$IF (prm == "Combatant"){$AURA_Attach("Combatant");$AURA_Combatant(tgt);};
-$IF (prm == "Map"){$AURA_Attach("XY");$AURA_Location(X,Y);};
-$AURA_Shape("AnnularSector");
-$AURA_Size(0,2,0,360);
-$AURA_Spell("Light AURA");
-$AURA_Wavelength("Xray");
-$DELETE_COMBATANT_SA($IndexToActor(atk),"spellArcaneLightTargetXY");
[AURA_Enter] = $VAR sus;
-sus = $GET_COMBATANT_SA($CombatantContext(),"monsterLightSusceptible");
-$IF (sus == "-?-?-"){$RETURN;};
-$SET_COMBATANT_SA($CombatantContext(),"IsLightBlinded","");
[AURA_Exit] = $DELETE_COMBATANT_SA($CombatantContext(),"IsLightBlinded");
SpellDuration = $SA_PARAM_SET($GET_HOOK_PARAM(5));
\(END)