Aller au contenu

Photo

use item over and over


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

#1
acomputerdood

acomputerdood
  • Members
  • 219 messages
i did have another question, and it's not strictly related to nwnx_func's ActionUseItemOnObject() so i made a new thread:
i have an item i'm using, and in the OnActivateItem script, i have it do something, just like normal.  but i then want it to do it again the next round, too, over and over.  i've got something kind of working as follows:
 if(sItemTag == "myitem"){
DoSomething();
AssignCommand(oPC, DelayCommand(6.0, ActionUseItemOnObject(oItem, oOther)));
}

this mostly works how i want it to, but i feel it's a hack.  is there a better way to do it?  some of the problems i have with it are:

- it doesn't have a little "pending action icon in the queue" thing.  you just stand there with no queued up actions until 6 seconds go by and you use the item again.  not a big deal.  i could live with that unless somebody has a better idea.
- but i can't "cancel" the action.  if i start running around, i'll still stop and activate the item after 6 seconds, just like i told it to.  which then causes another delaycommand, etc.  using the "drive" keys (wasd), seems to keep the action from being given, but clicking to move won't stop it.  i think this is slightly related to the first issue, that there's no queue of actions to cancel.

i think something like "DetermineCombatRound" is what i'd like, but i'm under the impression that's only for NPCs.


any ideas?  thanks!

#2
henesua

henesua
  • Members
  • 3 883 messages
Actions typically are queued up in a chain so I do not believe that you need the delay action in there.

So remove the delay and I think you are good to go. You should only get one action every 6 seconds since PCs can only act on one action per round, but immediately assigning the action will load up the queue.

#3
acomputerdood

acomputerdood
  • Members
  • 219 messages
great scott why didn't i think of that! you're absolutely right and it works perfectly.

#4
henesua

henesua
  • Members
  • 3 883 messages
don't kick yourself on this one. i had to script cutscenes before i realized precisely how this works as well.