Jump to content


Photo

I need advice on a tricky boomerang with ActionOverride


  • Please log in to reply
5 replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 18 November 2016 - 04:08 PM

I have a love triangle of creatures. One is a party member with a special ability to command an NPC. Another is a blue-circle NPC. The third creature is an enemy attacking the party member. The problem: what command should the party member cry to the NPC so that the NPC distracts the enemy and leads it away from the party member?

 

Let's first look at this last bit, how the NPC can get the enemy to stop its current attack and focus on itself instead. The NPC can issue an ActionOverride to LastAttackerOf(the party member) to Attack a new target. This command will have approximately this form in the script of the NPC:

 

ActionOverride(LastAtttackerOf(the party member),Attack(the NPC))

 

There are two non-obvious objects here. One question is how to get the party member inside the first pair of parentheses, i.e. how to select the LastAttackerOf who to manipulate? I can tell you the answer to that one: I use shouts, global shouts actually, and the party member issues the original command by shouting a number, let's say 15. There is a further mechanism for getting the party member to shout, but never mind that, let's say we got him to shout 15. Then the code for the NPC will be

 

IF

 

Heard([ANYONE],15)

 

THEN

 

RESPONSE #100

 

ActionOverride(LastAttackerOf(LastHeardBy(),Attack(the NPC))

 

I'm reasonably certain that this will work - it is only a slightly more complicated form of the communication system I use already. We have found the enemy. But we have yet to find a way to tell the enemy who to attack. And this is what I need help with from script-savvy people. You see, at this point the action of the script, having passed through a couple of places, returns to the author of the ActionOverride. But its identity is by now effaced: we can't use Myself, because inside an ActionOverride Myself refers to the controlled creature. So how do we make the NPC known to the enemy?

 

I have an idea to make the NPC shout another number and then go with

 

ActionOverride(LastAttackerOf(LastHeardBy(),Attack(LastHeardBy()))

 

But I would have to differentiate the two shouts somehow, and I can't do it in the middle of the action. Perhaps I can use GiveOrder or Trigger instead? But I'm not familiar with those.


Edited by temnix, 18 November 2016 - 04:15 PM.


#2 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 18 November 2016 - 08:44 PM

Just guessing, but have you tried making objects summon a dummy with specific DV, and then call then with LastSummonerOf("dummy")?


Retired from modding.


#3 temnix

temnix
  • Member
  • 983 posts

Posted 19 November 2016 - 02:41 PM

I haven't tried anything with DV yet. I will soon, but I think your suggestion has merit. If I don't come up with anything I can keep within the script itself, I'll try it.



#4 temnix

temnix
  • Member
  • 983 posts

Posted 19 November 2016 - 03:31 PM

P.S. I'm trying to put this in the script and I get an error:

 

SendTrigger(LastAttackerOf(LastHeardBy(),155))

 

What's wrong with it? The compiler says "Expected I:TriggerNum but found 155)". Seems as if I should drop that parenthesis, but no, they are in the correct amount. So why doesn't it like 155? I can put any number in the SendTrigger and GiveOrder actions, can't I?



#5 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 19 November 2016 - 05:02 PM

In correct amount, but not in correct place. Should be

 

SendTrigger(LastAttackerOf(LastHeardBy()),155)

Retired from modding.


#6 temnix

temnix
  • Member
  • 983 posts

Posted 20 November 2016 - 08:22 AM

Ahh. Boku Ayu indeed.