temnix Posted October 23, 2016 Share Posted October 23, 2016 I need to find a way for creatures, NPC I can script, to figure out who the summoner of a summoned creature is, then attack that PC. The natural choice of object for this is LastSummonerOf(), but it turns out to be not so easy. In this case I have two creatures: one is summoned, currently visible, for convenience, but in principle an invisible servant to serve as the in-between, and the other is the NPC to control. I wrote this for the servant: IF True() THEN RESPONSE #100 ActionOverride(LastSummonerOf(),GlobalShout(10)) END And this is for the NPC to be controlled: IF Heard([ANYONE],10) THEN RESPONSE #100 Attack(LastHeardBy()) END As you can see, this makes the PC who summoned the creature holler and sicks the NPC on him when it hears the shout. I could also do it in reverse - make the summoned creature itself shout and direct the attack at LastSummonerOf(LastHeardBy()). Either way, this doesn't work. It only makes the NPC strain as if in constipation - the usual sign of an order that can't be carried out. There was a third way, with a combination of Shout and GiveOrder. I made the servant issue an order to the PC, then shout, and scripted the NPC to go after LastCommandedBy(LastHeardBy()). This left out LastSummonerOf entirely. The result? You can guess. Severe straining. I don't know why I can't point this all to the summoner. The ActionOverride on the PC works, because Edwin strains too; this means he gives the order or shout. Or I can put the shout in Edwin's script directly, then he becomes the target as well. But that method only works with the AI clicked to "on," which I can't require. Anyway, I'm looking for a way to tell an NPC: that is the guy you need! That one! A way that would be more reliable than marking the PC with a custom spell state and then telling the NPC leaf through Nearest, SecondNearest and so on, to TenthNearest, in search of someone in that spell state. That method works, I keep it as the last resort, but it's slow and will fail if there are many creatures around, as sometimes there are in Siege of Dragonspear. The only 100% reliable way of targeting, one that ignores crowds, distractions and changes of distance and visibility, is to set a creature's sight on some definite object: Player1, Protagonist, LastSummonerOf(Myself) and so on. Linkages that are set by the engine itself. In this case, however, I'm trying to add flexibility so that the NPC attacks the PC who casts the spell rather than just, say, Protagonist. Any ideas? Link to comment
Avenger Posted November 3, 2016 Share Posted November 3, 2016 If there is a stagger (constipation), then you have conflicting scripting actions. This could be resolved by 1. changing the order of action blocks 2. setting variables / timers to temporary disable one of the actions (I'm not an expert of combat scripting, and you have to investigate all the scripts of this particular creature, so there is no specific example given) Link to comment
temnix Posted November 7, 2016 Author Share Posted November 7, 2016 No, I've since discovered that a creature strains when it is assigned an action it can't complete. Usually it is given some kind of impossible target, for example, to LastTargetedBy(Myself) after it has spawned. The script needs to be reviewed and reread, but there is no such thing as "conflicting actions." The AI is not human, it's never torn, only confused. Link to comment
Avenger Posted November 7, 2016 Share Posted November 7, 2016 Zero (invalid) targets don't cause stagger, the action simply ends immediately. Repeated actions do cause stagger. The conflict is not within the actions, indeed, but the condition blocks. It is caused by repeating the same or 2 alternating action blocks infinitely. Link to comment
temnix Posted November 11, 2016 Author Share Posted November 11, 2016 Not true. Which part? The one about invalid targets not causing "stagger." *sigh* Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.