Aller au contenu

Photo

Replace melee touch attacks with melee basic attacks?


  • Veuillez vous connecter pour répondre
9 réponses à ce sujet

#1
Alphakiller

Alphakiller
  • Members
  • 221 messages

In Pathfinder, one class I really like is the Magus, who has arcane spells and the ability to weave them into his sword.

 

Specifically, one of his features is that whenever he casts a spell that comes with a free melee touch attack in order to deliver it, he may instead make a melee basic attack to deliver it. A hit means he deals damage with his weapon AND with the spell he is casting, a good example being shocking grasp.

 

Basically, I want to reproduce this feature... but I don't know how. I've looked at how to add custom feats, I've been able to change the description of it and the icon, but I've kinda hit a wall there. I put this topic in scripting because I'm fairly sure I can take the steps necessary for everything except for the script. My idea is that it's a persistent feat (may want to make it a toggled combat mode so that I can choose to remain as a touch attack if I so choose). I read in some FAQ that to make a persistent feat, you also have to link it to a spell which is linked to a script, and I believe I've got everything there.

 

But what I don't know how to do is to make a script that is properly attached to that feat, and I don't know how to make an effect that checks all your spellcasting for melee touch attacks and replaces them with melee basic attacks, if even possible.

 

Can anyone help me with this?



#2
Loki_999

Loki_999
  • Members
  • 430 messages

Tricky to say the least.

 

What you would have to do is at least modify all 2da entries for those spells to remove the spell cast anim (ill explain why in a moment).

 

Then you are going to have to create a function (i'd make a new include file to hold this) that does the calculation for the physical attack and damage.

 

The function is going to have to do several things:

 

1) return a boolean back to the spell script to say whether the physical attack succeeded (AB vs target AC roll .. there may be a function that can make a simulated attack roll, not something i've ever looked at).

1b) Also return a fail if the caster has a ranged weapon in their hands.... or handle some other way.

2) Calculate the damage to be applied and apply it. This is going to be a mess, because you are going to have to consider base damage, weapon properties, other damage effects (eg: Divine Might, Sacred Flames), not to mention target resistance, and then create damage effects for each damage type, link them, and then apply to target.

3) Play attack animation - because we removed from the 2da, and you play different anims depending on what weapon(s) you are wielding, so you need to check to see what weapons you are attacking with and play the appropriate anim.

 

The next step then is to edit every single spell script where you want this effect to occur, add your new include to it, then wrap the whole spell script inside an if statement that calls your new function. If that returns a fail, then the spell will not happen... although you would still lose a spell slot use.  Hmm... and you would also need to edit those spells to not make the touch attack.

 

There may be a better way, i can't see it.

 

Also, this makes all spells that you modify so they will always use melee attack and you will never be able to make a touch attack.  To make it be able to select which type of attack to make is going to be trickier. Either you make two versions of the spells, or perhaps make a new combat mode type of thing where you can select between touch spells or melee spells (where appropriate).

 

Overall, a tricky and messy job i think.



#3
Alphakiller

Alphakiller
  • Members
  • 221 messages

Maybe to go down another line of thinking... what if we treated it like a metamagic feat? Can you set up a metamagic feat to where it doesn't increase the spell level? This would give preparation spellcasters an additional limitation to where they have to prepare the spell as a "melee basic attack" spell in order to use it that way, but I think the functionality would work fairly well and would even work perfectly with sorcerer type spellcasting, but the disadvantage would be that you can no longer use other metamagic with the spells.

 

Does it necessarily have to be that I edit all the spells? What if I made some kind of mode where the character makes a melee basic attack, and then piggybacks the casting of the spell into the damage calculation?

 

You mentioned a combat mode. Could you elaborate on that?



#4
kevL

kevL
  • Members
  • 4 070 messages


Does it necessarily have to be that I edit all the spells? What if I made some kind of mode where the character makes a melee basic attack, and then piggybacks the casting of the spell into the damage calculation?

like Loki says, engine not really set up to do this elegantly.

if I were hell-bent on it, would use custom spellscripts that simply apply an OnHitCastSpell itemproperty to my current weapon. Then perhaps have a delay that removes the IP, 6 seconds later

But this suffers in that such ip-spells have a predetermined casterLevel, ala .2da file. i mean, maybe you could make a rather large iprp_spells.2da etc.


yeah, long messy challenge/effort on this one. If creatures had an 'OnSuccessfulMeleeAttack' event (but they don't, and most events that we do have won't fire for a controlled character anyway.)

Maybe to go down another line of thinking... what if we treated it like a metamagic feat? Can you set up a metamagic feat to where it doesn't increase the spell level? This would give preparation spellcasters an additional limitation to where they have to prepare the spell as a "melee basic attack" spell in order to use it that way, but I think the functionality would work fairly well and would even work perfectly with sorcerer type spellcasting, but the disadvantage would be that you can no longer use other metamagic with the spells.

pretty sure the results of metamagic are hardcoded. Can't just up & change a metamagic to do something different ...

#5
kevL

kevL
  • Members
  • 4 070 messages

hmmm, i wonder if they could be treated as Invocations ( think, Hideous Blow )



#6
Alphakiller

Alphakiller
  • Members
  • 221 messages

That's an idea. The first thought I have with that, though, isn't eldritch blast technically a class feat? If that's the case, I don't think we can do the same thing with caster spells. Then again, doesn't activating a feat calls up a spell from spells.2da?

 

It's an interesting thought. I might have to look at eldritch blast/Hideous blow and see how they interact...

 

One problem, I seem to remember that hideous blow uses a round to cast, then you use a round to make your melee attack. If we treat the spells this way, would there be a way to prevent having to do it that way?



#7
Loki_999

Loki_999
  • Members
  • 430 messages

Yeah, metamagics are all hardcoded.

 

Regarding combat modes - think like Parry and Power Attack - but you'd still need the big mess of all the other coding.

 

KevL makes an interesting suggestion with item properties, with the problem of caster levels mentioned.  So, if you cast the spell directly on the target it works regularly, and if you cast on your weapon it adds a special property for 6 seconds or something.... or perhaps until the effect spell script is triggered.

 

Still requires 2da editing to let those spells be cast on a weapon (target type) and all the spell scripts need editing to check the target and then if the target is a weapon and apply the property. Not to mention then new scripts to actually handle the oh-hit effect.



#8
Darin

Darin
  • Members
  • 282 messages

Try Spellhooking?

 

I forget exactly how it works, but there are scripts that the spells will check before they run...what you could do is...

 

-set the touch attack spells to check the "Magus" feat

-if you have the Magus feat, add an OnHitProperty to the weapon (that mimics the spell effect and the the vfx for it)

-remove the property after it hits, or after the spell duration ends

 

only way I can think of, metamagic is weird (and may be spellhooking anyway), and combat modes are all hard-coded (hence the "parry" skill....)

 

But look up Spellhooking.



#9
Psionic-Entity

Psionic-Entity
  • Members
  • 195 messages

I've done this with some spells before, here's how.

 

For starters, you need a script that simulates attacks from the game engine. This one's a bit tricky, but luckily for you someone else has already done it. http://nwvault.ign.c...l.Detail&id=471 includes a set of scripts that give you an easy way of making a melee attack from a script. You'll have to sift through the includes yourself but it's very easy. With this, you can take any spell script in the game, replace the melee touch attack with a call to these bots_ includes, and use the return value (hit, miss, critical) just as you would the touch attack results.

 

Second, you need a method of determining when the player wants to attempt these actions. You could perhaps make a feat that enters a "mode" in which all spells function this way, and subsequently edit all of the melee touch spells to check for this mode. To make a custom mode work you need to make it a feat that sets/removes either a variable or an effect on the player when it's used, and you need to edit the feats.2da line to make it instant cast. You could also do custom feats (one for each spell like this), or even subselection (though everyone would see these options, not just people with the spell), etc. if you want to allow this for only some spells.

 

One alternative mentioned above is to add an "onhit" event. It's fairly easy to do, just create a new "on hit cast spell" event in the 2das, and use a script to apply it as an item property whenever the player equips a weapon (gotta do some checks to prevent duplication but whatever, this is simple and the equip hooks exist already). More advanced on hit events can be made by giving players an "on hit cast" on their armor and using some script logic to make sure exactly one script fires for every hit in the game. I highly recommend having an on hit event, but I do not recommend it for this system, because the game engine cannot be made to detect a missed attack and as such, you have no way of expending spell use. This is better for stuff like "the next hit creates an effect" rather than "if you miss you get nothing" type events.

 

 

 

Personal recommendation is to do the mode/editing spell scripts method.



#10
kevL

kevL
  • Members
  • 4 070 messages

One problem, I seem to remember that hideous blow uses a round to cast, then you use a round to make your melee attack. If we treat the spells this way, would there be a way to prevent having to do it that way?


TonyK's AI uses some method of doing both in one round (as an option on the CharacterSheet|Behavior tab) -- pretty deadly.