Author Topic: How do I make a spell that targets a combatant or a location?  (Read 1043 times)

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2138
Re: How do I make a spell that targets a combatant or a location?
« Reply #15 on: February 08, 2017, 11:07:49 AM »
Quote
If you choose "combatant"...the area would move with the combatant....
If you choose "location"...the spell would be an area around that location. It would not move,

I thought I offered that interpretation many days ago.  But, looking back
I see that I failed to allow for the 'last-second player choice'.

In any case, this makes total sense.

Assuming we have gotten to the crux of the matter:

Is there currently any way in DC combat to attach
an area spell to a combatant?  Or do I have to invent
that in addition to a method selecting the option? 
I don't look forward to implementing
either of these features.  Does FRUA have these features?

Online manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9585
Re: How do I make a spell that targets a combatant or a location?
« Reply #16 on: February 08, 2017, 01:30:19 PM »
Well,l it sounds like we both thought we were being clear and the other person not so much. ;)

To answer new questions:
Is there a way to have area effects target a combatant? DC has Area Effect targeting which does not  target a combatant (areacircle, SelectByHitDice, arealinepickstart, arealinepickend, areasquare, areacone). The other targeting types do no target locations (self, selectByCount, party, touch).
There is currently no way to target a combatant with an area effect.

However I had never planned on using an area effect, beacuse I am going to use AURAs.

Here is what seems simlest to me, which may or may not mean anything.
I propose using the targeting type "selectByCount" Using this we would need a new Hook, similar to the OverrideSpellSelection Hookk but for targeting - OverrideSpellTargeting.  The player would have two options: the comabtant (just like the targeting normally does) or the location at which the combatant is currently standing. I would also need a way to track what the decision was so that I could choose the correct AURA function to use.

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2138
Re: How do I make a spell that targets a combatant or a location?
« Reply #17 on: February 08, 2017, 01:47:21 PM »
OK.

First I need to fix the "OverrideSpellSelection" hook as it
currently does not list the options properly.

Then I will try to implement the "OverrideSpellTargeting".
But, as I understand it, the engine needs not to know
the result of this override.  It simply pases that information
to the hook.  You say the "Hook needs to track" the decision.
Do you mean tracking external to the hook itself or only
while the hook is executing?  If the former, couldn't the
aura that you create contain that information.  If the latter,
then that is your business.

Online manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9585
Re: How do I make a spell that targets a combatant or a location?
« Reply #18 on: February 08, 2017, 02:09:55 PM »
Let me rephrase the last bit of my earlier post...

Since the Hook will retain the decision made, how do I go about accessing that in a different script? I was not aware that the Hook retained any kind of info  because of my lack of understanding the mechanics of how they work. This does not mean that you have not explained it to me. It just means I don't know how to access any info that a Hook may have retained, with the exception of Hooks that have parameters that have the value of the lat time the Hook ran.

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2138
Re: How do I make a spell that targets a combatant or a location?
« Reply #19 on: February 08, 2017, 03:36:35 PM »
I am to supply a hook named "SpellTargeting".
It will be attached to a Special Ability definition.
Then the 'xxyyzz' spell will be given that Special Ability
which might be named "SA_xxyyzz'.

The hook will return with the list of options to be displayed
at the time a cell or combatant is selected by the player.
Now the question is:  How do we communicate the
resultant selection to future hooks?

a) Is this the question? 
b) If I answer this question does it solve your problem?

We should note that the "OverrideSpellSelection" hook has
already run before the target is selected!







Online manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9585
Re: How do I make a spell that targets a combatant or a location?
« Reply #20 on: February 08, 2017, 03:48:47 PM »
a) Yes
b) Depends on your answer, but I highly suspect it will solve the problem of how to make this happen.

As far as the OverridespellSelection Hook is concerned, I hadnt actually planned on using it in this case. However, there are a number of situations with default spells (spells for the official DC releases) that OverrideSpellSelection should be used (for Dungeons & Dragons reasons). Once I get Light and Darkness working, I would like to make them default spells.

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2138
Re: How do I make a spell that targets a combatant or a location?
« Reply #21 on: February 08, 2017, 04:12:34 PM »
Hopefully we are getting somewhere.  It feels good.

Now the player has been presented options at the time
he is selecting the target.  He positions the cursor on
a cell, combatant, or both.  We run hook "SpellTargeting"
and the player is presented with the options:
"Punt"
"Pass"
"Run"
"Fumble"
He selects "Pass".

How long do we have to remember this selection?
If we remember this in a Global variable it will be overwritten
the next time the same spell is cast.  So the BIG question is:

a)Do we have to remember that the player chose "Pass"
after the player is again presented with these same options?

and

b)Why or why not?  Ie: Where and when will this choice be used?

I worry that the answer is that we do have to remember
several choices.  Perhaps because the spell can target
several locations/combatants.  Perhaps for other reasons.
If so, the problem is more difficult because the choice must
be remembered with each instance of spell/target rather
than simply a global choice.





Online manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9585
Re: How do I make a spell that targets a combatant or a location?
« Reply #22 on: February 08, 2017, 06:16:57 PM »
Hopefully we are getting somewhere.  It feels good.

Now the player has been presented options at the time
he is selecting the target.  He positions the cursor on
a cell, combatant, or both.  We run hook "SpellTargeting"
and the player is presented with the options:
"Punt"
"Pass"
"Run"
"Fumble"
He selects "Pass".

How long do we have to remember this selection?
If we remember this in a Global variable it will be overwritten
the next time the same spell is cast.  So the BIG question is:

a)Do we have to remember that the player chose "Pass"
after the player is again presented with these same options?
No. The script will process this immediately.

Quote from: Paul
and

b)Why or why not?  Ie: Where and when will this choice be used?
We will use it before the player is presented with the choice again. This choice will be used in the script that immediately applies the AURA to the target, whether it be combatant or location.

Quote from: Paul
I worry that the answer is that we do have to remember
several choices.  Perhaps because the spell can target
several locations/combatants.  Perhaps for other reasons.
If so, the problem is more difficult because the choice must
be remembered with each instance of spell/target rather
than simply a global choice.
For what I want to use this for, we do not need to remember multiple choices. I can foresee someone else wanting to do things differently. I have several suggestions as to resolve this. I am sure there are things I'm not going to think of.
1) You create the Hook so that it only allows a count of 1, so that know matter what number the designer uses with this particular selectByCount, that we only honor the first and ignore rest.
2) You create a new targeting type for the Hook to work with - SelectTarget or some such that is exactly like selectByCount except that it only has 1 target.
3) The global variable holds a delimited string instead of a single value. After the spell resolves, by which I mean the effects are applied to the targets (we would know this is done because the next combatant gets a turn meaning that all of this spell taking affect is done, not that the spell is done, just the applying of it)

We should do whichever is easiest or best, depending on how hard these would be to implement. Or, we choose option #4.

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2138
Re: How do I make a spell that targets a combatant or a location?
« Reply #23 on: February 08, 2017, 06:52:23 PM »
The problem is that the "SpellTargeting" hook exits and
provides the options to be displayed in its return value.
Ouch.   The hook has disappeared.

What if we make two hooks? 
1) "SelectSpellTarget"   (returns with options to display)
2) "TargetSelected"      (receives the players choice)

The other option is to put the options directly into the
spell's Special Ability parameter.  I think this is ugly because
the parameter should be reserved for the hooks to examine.

Online manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9585
Re: How do I make a spell that targets a combatant or a location?
« Reply #24 on: February 08, 2017, 07:02:55 PM »
And thus by having two Hooks we can have multiple targets in one spell? This sounds great to me. :D

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2138
Re: How do I make a spell that targets a combatant or a location?
« Reply #25 on: February 08, 2017, 07:26:23 PM »
Quote
we can have multiple targets in one spell?

Yes, I think that would work.

Online manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9585
Re: How do I make a spell that targets a combatant or a location?
« Reply #26 on: February 08, 2017, 07:38:19 PM »
I think this will be fun testing out. :D

Online manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9585
Re: How do I make a spell that targets a combatant or a location?
« Reply #27 on: February 14, 2017, 01:31:46 PM »
I am having a couple of issues with the new hooks, actually with the second one. I suspect that they are due to my misunderstanding. :)

1)   ProcessSpellTargetOverride does not allow $SET_SPELL_SA() in the editor. The documentation states that the Hook states the context as "the spell". This would be a perfect time to use $SA_SPELL_SET(), however the editor continues to tell me that is not a valid function.
2)   My goal is to pass the target choice to the AURA. Having the new Hooks in the same SA as the AURA Hooks did not work. Putting them in two separate SAs on the same spell, makes the spell appear to work, however regardless of my coise, the map is always chosen.
I thought that perhaps setting Paramater [1] would give the SA the  value to the SA.
The Hook docs state the Return value is ignored, so I haven't tried just Returning the value.

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2138
Re: How do I make a spell that targets a combatant or a location?
« Reply #28 on: February 14, 2017, 01:56:57 PM »
1) You are no doubt right.  The editor interaction
with the contexts is a bit fragile.  I'll look into that.

2) I'll look into this, too.  Not sure I understand the question yet.
Having the new hooks in the same SA as the AURA hooks should
not have any effect on their operation. 

But let me fix 1) and then return to 2).

Online manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9585
Re: How do I make a spell that targets a combatant or a location?
« Reply #29 on: February 14, 2017, 04:01:35 PM »
tHANKS, pAUL.

aS FAR AS #2 IS CONCERNED, i AM SURE IT CAN BE WORDED BETTER.. i'M TRYING TO FIND A WAY TO PASS INFO OUT OF THIS hOOK TO BE USED BY THE aura. nOT SURE HOW TO DO THAT.