Aller au contenu

Photo

Handling spell targeting


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

#1
Lathaon

Lathaon
  • Members
  • 163 messages
What I'd like to do for a custom spell, is measure the range from the nearest object with a certain tag rather than from the caster, so the marker greys out (or whatever it does) outside this radius as if it was out of range. I'm fairly confident I could prevent it being cast, but what I'm not so sure about is how to get the UI to give some indication of where it can/can't be cast.

Is this possible?

#2
anakin5

anakin5
  • Members
  • 258 messages
I am not sure about this, but I never seen an ability beeing deactivated by the UI because you are to far away. I only saw this if you don't meet requirements like not having the right type of weapon equipped etc...



In you cast, the most important is to not be able to use the spell if the character is too far from the given object. You can handler this in scripts.



If your really need to have the button beeing disabled, I think you can cheat.

Just an idea :



- You create a new area effect and you apply this area effect permanently to the nearest object you are talking about.

- In the script of this effect, you make the effect giving an hidden ability to those who enter the area and removing this hidden ability to those who leave it.

- In the prereqability field of the spell you want to become grey, you put the ability given by the effect.



I don't know if not having the prereq abilities make the icon become grey, but you can try.



I got some others idea if tis doesn't work

#3
Lathaon

Lathaon
  • Members
  • 163 messages
Thanks, but I don't mean to disable the button. I'm talking about the way an AoE circle changes if you move it beyond the spell's range.



What I want is to be able to click the spell icon but only be able to select a target within a certain distance from a certain object. The caster may or may not be within this radius but the spell target must be.



Here's a diagram to illustrate what I'm looking for.



Posted Image

#4
anakin5

anakin5
  • Members
  • 258 messages
When you say "What I want is to be able to click the spell icon but only be able to select a target within a certain distance from a certain object", you want the mouse cursor to change ?

Modifié par anakin5, 24 janvier 2010 - 11:31 .


#5
Lathaon

Lathaon
  • Members
  • 163 messages
Umm... sort of.



Like this.



Attempting to cast Grease in range: http://i50.tinypic.com/amcosn.jpg

Attempting to cast Grease out of range: http://i48.tinypic.com/23wl3ie.jpg



It's not shown, but the cursor is actually a crosshair sort of thing.

#6
anakin5

anakin5
  • Members
  • 258 messages
You cannot do this easily, the range is handled by the engine and the ui, and probably based on the "range" field in abi_base. The range is calculated from yourself.



But I think you must forget thinking about a range matter. The idea is the same as in my previous post, you have to change one of the properties of enemies that comes near your object to make them valid for the spell, and thus, changing the mouse cursor.

I know the cursor change based on the "targettype" field of abi_base but you cannot change the type of enemies.



It is like blood control that cannot be cast on enemies without blood (I don't know if the cursor change in this case). There is also the example of backstab abilities where you have to be behing the target.

#7
Magic

Magic
  • Members
  • 187 messages
I got the impression that Lathaon wants to achieve something different than you're proposing, anakin5. The mage seems to be channeling a specific spell through an object, and for that the range between object and ground target matters. Maybe think of the Water Elemental in WoW, if you know that.

#8
Lathaon

Lathaon
  • Members
  • 163 messages
Okay, I've had a look at the script for blood control and it looks like it just gives you an "immune" message when you try to cast it on something without blood, so it doesn't look like it stops you trying... Interesting idea, though.

It looks like I'm just going to have to prevent the spell being cast, then. Or maybe make it so that if you cast it a little bit out, it will change the target location to the furthest it can be in that direction from the object. The reason I wanted to do what I explained earlier is so that the player wouldn't waste time and mana trying to cast it somewhere where it isn't going to work. I should be able to cancel the spell if the target is intially out of range, though, through the spell's EVENT_TYPE_SPELLSCRIPT_PENDING event.

Edit: Magic: yes, I think you're right, don't know about the WoW thing though. I do want ground targets to be an option.

What I'm actually trying to do is make some special earth spells which only work in certain places, and using an object means the player has indication of where there are.. points of interest, shall we say. Certain spells might even work differently in different places. I'm thinking if you bring up lava on a rocky surface, it'll hurt anything that steps there, whereas if you bring up lava on a river, it could solidify and form a bridge.

Modifié par Lathaon, 24 janvier 2010 - 12:45 .


#9
anakin5

anakin5
  • Members
  • 258 messages
Why not let the player decide where he want to cast the spell and just handle in the script what it does or doesn't depending on where it is cast ?

#10
Lathaon

Lathaon
  • Members
  • 163 messages

Lathaon wrote...

The reason I wanted to do what I explained earlier is so that the player wouldn't waste time and mana trying to cast it somewhere where it isn't going to work.



#11
anakin5

anakin5
  • Members
  • 258 messages
Wasting mana or not is part of the gameplay. It is using the right spell on the right target at the right moment. If you remove that, it is like ... playing wow ?

#12
Craig Graff

Craig Graff
  • Members
  • 608 messages
You can mostly accomplish what you seem to want just by not having any casting animations associated with the ability and giving some sort of immediate feedback (visual effect or floaty text) one way or another after the player has clicked a location with the targeting reticle.

#13
Lathaon

Lathaon
  • Members
  • 163 messages

anakin5 wrote...

Wasting mana or not is part of the gameplay. It is using the right spell on the right target at the right moment. If you remove that, it is like ... playing wow ?


At it is, you can cast a fireball instantly, so the only delay is the time it takes the fireball to reach its target. This makes timing a lot less of an issue, and you almost never waste any mana. Even when you do, it doesn't matter. As it is, I feel that magic - especially healing - requires too little thought, and spamming powerful spells like fireballs just makes magic seem very trivial. In DA:O, I honestly found playing a warrior much more interesting than playing a mage. That goes as a "congratulations Bioware, you made warriors fun" as well as a "damn it Bioware, mages used to be awesome".

So, the solution. One of the things I want to do is to change things so that spells take time to cast, time which increases with the power and complexity of a spell. This makes timing essential as enemies may be in a different place by the time you cast it. It also puts more importance on slowing them down or luring them into position. I also want to give spells a greater impact to compensate. If you take the time to cast a good spell and you time it and target it well, it should be devastating. If your party members are in the way, they will be in big trouble. If you miss, you probably won't get another chance in that battle so will have to try something else. If the spell doesn't even do anything then the player isn't going to be too pleased if he/she thought it would.

The other thing is, I want to add complexity to the way spells work. They seem to rarely interact with the environment, mostly only have one use and this is never outside of combat, and seldom interact with each other except when you're spamming the same spell combination again and again. What I want is to be able to cause a rockslide on those enemies running along the foot of a cliff, converse with plants to find out who has come along the road, earth a lightning bolt through a tall rod made from my own copper coins, and bring up lava to a) form a bridge across a river; B) kill enemies; and c) summon a lava elemental to fight for me. I want to have a few spells I must constantly try make the most of in different ways and different situations, not lots of spells I can use in the same way in any situation, and certainly not spells which do the same thing.

Craig Graff wrote...

You can mostly accomplish what you seem to want just by not having any
casting animations associated with the ability and giving some sort of
immediate feedback (visual effect or floaty text) one way or another
after the player has clicked a location with the targeting reticle.


As I hopefully explained above, instantaneous casting is not what I'm looking for. This does make me wonder about the order of a spell, though. Is it like this?


1) Fire EVENT_TYPE_SPELLSCRIPT_PENDING event
2) Deduct mana
3) Fire EVENT_TYPE_SPELLSCRIPT_PRECAST event
4) Play casting animation
5) Fire EVENT_TYPE_SPELLSCRIPT_CAST event
6) Handle the projecile, if there is one
7) Fire EVENT_TYPE_SPELLSCRIPT_IMPACT event

Or something different?

#14
TimelordDC

TimelordDC
  • Members
  • 923 messages

Lathaon wrote...

What I'm actually trying to do is make some special earth spells which only work in certain places, and using an object means the player has indication of where there are.. points of interest, shall we say. Certain spells might even work differently in different places. I'm thinking if you bring up lava on a rocky surface, it'll hurt anything that steps there, whereas if you bring up lava on a river, it could solidify and form a bridge.


I don't know if this will be suitable to your needs but if the target area around the 'channeling object' is not too big, you could try creating an aura around the object. Not an actual aura that bestows some effects but just the vfx part so that the players will know that casting within that aura will be required.
If they cast outside that area, you could just abort the spell during the IMPACT event -> the spell would still fire and the projectile (if there is one) would still go out but would be ineffective without the channeling object's domain.