Aller au contenu

Photo

Stopping movement toward target during Unique Power use


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

#1
rjshae

rjshae
  • Members
  • 4 491 messages
I am using an item with a ranged Unique Power spell that triggers an On Activate tag-based script. However, in certain instances the PC using the item begins by moving until it is adjacent to the target before activating the ranged Unique Power. (For example, when applying the power to a door or to a non-hostile creature.) The only way I've found to avoid this is to set up the script so that it finds a target object based on proximity to a target location. (I.e. I activate the item and then select a location next to the target.) Is there a way to prevent the PC from advancing like this when selecting the object directly?

Thank you.

#2
diophant

diophant
  • Members
  • 116 messages
From my experience, this happens when the target is too far away. You could check the distance to the target, and if it's too far, clear all actions on the PC and send a message that the target is out of reach, or calculate a position between the target and the PC and let the PC move there.

Btw., are you working on a telekinesis spell?

#3
rjshae

rjshae
  • Members
  • 4 491 messages
The thing is, I can target a location next to the object and it works. It also works if there are obstacles in the way. It's just when there is a clear path and I select the target object, then the PC moves up next to the object. It's a kind of inane A.I. behavior.



Regarding telekinesis: in a sense it could be interpreted that way. But there are differences.

#4
diophant

diophant
  • Members
  • 116 messages
I tested a little bit, also targetting the floor has a maximum distance.The bad thing is that the spell script fires after the player runs to the object, so my suggestions won't work... But AFAIK it's the same problem when casting a ranged spell.

#5
Guest_ElfinMad_*

Guest_ElfinMad_*
  • Guests
You could use the GUI function UIObject_Input_ActionTargetScript() which can be used to turn the mouse cursor into a targeting cursor. Clicking the target cursor on the ground, creature or something then invokes another script to do what you want. This approach involves more scripting but I don't think you'll see the same odd movement behaviour.

#6
rjshae

rjshae
  • Members
  • 4 491 messages

ElfinMad wrote...

You could use the GUI function UIObject_Input_ActionTargetScript() which can be used to turn the mouse cursor into a targeting cursor. Clicking the target cursor on the ground, creature or something then invokes another script to do what you want. This approach involves more scripting but I don't think you'll see the same odd movement behaviour.


That's interesting, but wouldn't you have to run that before the item activation script gets called? Perhaps there is another script hook I don't know about? Thank you.

#7
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
Did you try  to use the item props of any of the Cast Spell --> Activate Item (like Activate Item Long Range) instead of using a Unique Power property? I have one which uses the Long Range and I can target pretty much anything that you could see on the screen, even stuff wayyyyy off in the distance (like all the way across an area). PC has never run up to it.

Modifié par _Knightmare_, 07 octobre 2010 - 10:33 .


#8
Guest_ElfinMad_*

Guest_ElfinMad_*
  • Guests

rjshae wrote...

ElfinMad wrote...

You could use the GUI function UIObject_Input_ActionTargetScript() which can be used to turn the mouse cursor into a targeting cursor. Clicking the target cursor on the ground, creature or something then invokes another script to do what you want. This approach involves more scripting but I don't think you'll see the same odd movement behaviour.


That's interesting, but wouldn't you have to run that before the item activation script gets called? Perhaps there is another script hook I don't know about? Thank you.


Yes, you are right. You would have to activate the item which would bring up the targeting cursor then click on the target. It would be more clicking and more scripting so probably not the best solution to the problem.

I didn't even realise there was a activate item long range. _Knightmare_, do these properties work the same as the unique power properties with regard to tag based scripts?

#9
Quilistan

Quilistan
  • Members
  • 111 messages
ElfinMad



I believe they do function as you asked. I have used this to make a few items that use tag based scripts.

#10
_Knightmare_

_Knightmare_
  • Members
  • 643 messages

ElfinMad wrote...

I didn't even realise there was a activate item long range. _Knightmare_, do these properties work the same as the unique power properties with regard to tag based scripts?


Yes they do work with the TBS. I have a few items that use it and they fire off their tag-based scripts. I've uesd it to target both hostile and firendly NPCs, placeables, ground locations, etc. No PC run up in any case.

Modifié par _Knightmare_, 08 octobre 2010 - 12:25 .


#11
rjshae

rjshae
  • Members
  • 4 491 messages

_Knightmare_ wrote...

Did you try  to use the item props of any of the Cast Spell --> Activate Item (like Activate Item Long Range) instead of using a Unique Power property? I have one which uses the Long Range and I can target pretty much anything that you could see on the screen, even stuff wayyyyy off in the distance (like all the way across an area). PC has never run up to it.


Yes I did, and the wierd thing is this is happening when the PC is not very far away from the target. In fact the PC is less than one indoor grid square from the door, yet it still runs up to the door before activating the item.

#12
BigfootNZ

BigfootNZ
  • Members
  • 131 messages

rjshae wrote...

_Knightmare_ wrote...

Did you try  to use the item props of any of the Cast Spell --> Activate Item (like Activate Item Long Range) instead of using a Unique Power property? I have one which uses the Long Range and I can target pretty much anything that you could see on the screen, even stuff wayyyyy off in the distance (like all the way across an area). PC has never run up to it.


Yes I did, and the wierd thing is this is happening when the PC is not very far away from the target. In fact the PC is less than one indoor grid square from the door, yet it still runs up to the door before activating the item.


It could be because your targeting a Door rather than a Creature?.. not sure and its getting a conflicting set of actions for some odd reason.