Jump to content

Companion Ambush


cfh85

Recommended Posts

Is there any mods that allow you to set the position of your NPC's and force them to wait until your call to attack?

 

Also, what orders do people consider essential for companions?

What orders would you like to see that other mods don't have?

Edited by cfh85
Link to comment
Share on other sites

Don't think there is. It's quite a complex thing to do on a dynamic level. Not impossible though. Still there's a lot of things to consider.

 

I guess first thing is placement. You could take the simple option, walking with the companion to the hiding place and tell him to wait. Or, you could develop a system for pointing at a hiding spot. I have a method for that, if you're interested.

 

Then, there's the issue of when and who to attack. The companion will obviously need to be made completely defensive for the duration of the ambush. If the companion isn't normally aggressive to the intended target, the player will have to pick the target out for them. You could use a target spell, but that kind of ruins the stealthy feel to the ambush - another pointer would probably work. It could lock on to a target for the companion to attack with a simple button press.

 

Intense scripting, but it sounds fun. 8)

Edited by WarRatsG
Link to comment
Share on other sites

what I've set so far is that you would have to walk the NPC into place ready for the ambush. When you talk to any companion regarding an ambush you get a lesser power - ambush cry. This checks for companions set to ambush in the current cell and 8 surrounding and changes their packages to follow the PC. This then would engage the NPCs in combat with anyone the PC is fighting. I was going to have a lesser power to select a target of the ambush but, I felt that you could potentially kill NPCs without ever actually getting in any danger.

Also, the way it is set now (if it works) is simple and reasonably realistic. If a companion is too far away when you do your ambush cry they can't hear you and you'd have to go fetch them after.

 

I may try and create a more complicated ambush cry that would allocate tasks to specific companions based on their class. So healers would concentrate on healing and fortifying, archers taking out other archers first, then mages.... and so on etc. This would probably be a pretty intense script, so I wouldn't really want it running on scripteffectupdate unless there is a way to slow down the update to every 10/15 seconds.

 

I'm gonna start on this now and see what I can come up with.

 

I'd love to see your method for pointing their wait positions out. That would be a massive improvement

Link to comment
Share on other sites

You could just set up a timer in the ScriptEffectUpdate block that makes Return calls until it hits 15 seconds, where the normal code runs and the timer resets. Just move the ScriptEffectFinish block above it and make the last call in that block Return so that the Update block won't terminate the Finish block, but the Finish block will terminate the Update block.

 

 

I used the "pointer" as a means of short-range teleportation; as in you teleport towards whatever you are looking at. It works pretty well. That said, I can't take full credit for the idea, I received the idea from SkylineR390 when I was but a rookie ;)

 

If you have a working knowledge of trigonometry, you can take the basic principle and adapt it to your own needs. The following script is the teleport spell from my own mod:

 

 

 

float Num
float AngX
float AngZ
float W
float X
float Y
float Z
float pX
float pY
float pZ

Begin ScriptEffectStart

If GetIsReference Player == 0
	Return
Elseif Player.IsSwimming
	PlaySound SPLAlterationFail
	Message "I can't teleport while swimming."
	Return
Endif

Let AngX := (Player.GetAngle X) * -1
Let AngZ := (Player.GetAngle Z) * -1 + 90
Let pX := Player.GetPos X
Let pY := Player.GetPos Y
Let pZ := (Player.GetPos Z) + 120
Let Num := 0

While Player.GetLOS ndvmpTelporterRef
	Let Num += 1
	Let W := 50 * Num * Cos AngX
	Let X := pX + W * Cos AngZ
	Let Y := pY + W * Sin AngZ
	Let Z := pZ + (50 * Num * Sin AngX)
	ndvmpteleporterRef.SetPos X X
	ndvmpteleporterRef.SetPos Y Y
	ndvmpteleporterRef.SetPos Z Z
	If Num > 26.5
		Break
	endif
Loop

If Num <= 3	
	PlaySound SPLAlterationFail
	Message "I need more room."
	Return
Elseif Num > 26.5
	Let Num := 26.5
Endif
Let Num -= 1.5
Let W := 50 * Num * Cos AngX
Let X := pX + W * Cos AngZ
Let Y := pY + W * Sin AngZ
Let Z := pZ + (50 * Num * Sin AngX)
Let Z -= 50	
PlaySound SPLFrostCast
Player.SetPos X X
Player.SetPos Y Y
Player.SetPos Z Z
Endif

End

 

 

 

As you can see, the process is simply to move a marker away from the player until it goes out of sight, i.e. it hits a wall and passes through. At this point, the marker is moved back ever so slightly so that the player doesn't clip through the wall too and the player is moved to it.

 

The marker must be a persistent reference. The way to ensure that the marker is visible as far as LOS goes yet unnoticeable to the player is to set it's scale to something insanely small. This marker can be scripted to hide itself when not in use, like so...

 

 

 

float PosZ
ref Self

Begin GameMode

If Self == 0
	Set Self to GetSelf
Endif

If Player.GetLOS Self
	Set PosZ to GetPos Z - 1000
	SetPos Z PosZ	
Endif

End

 

 

 

Obviously with a pointer, it would help the player to have a visible marker as well, like a beam of light or something, so that the player knows exactly where the "invisible" marker is.

 

There are a few things that need altered to work for your mod. For example you will need to constantly put the marker back of the ground so that the companion can run to it, then turning that pointer into a "selector" for picking out targets. But I get the feeling you are smart enough and creative enough to pull it off ;)

Link to comment
Share on other sites

If you have a working knowledge of trigonometry, you can take the basic principle and adapt it to your own needs. The following script is the teleport spell from my own mod:

Sadly I picked up the nickname Trigger in school because my ability in maths far exceeded everyone else!

Finally that ability will be put to good use :whistling:

 

I'll see what I can come up with. (shame this isn't skyrim, the vanilla version is able to do this)

 

Thanks for all your help so far

 

Edit. Looking at it I'm thinking use 3 refs. PC has line of site of top on, top on has LOS of middle one which is set 200 directly below (I'm sure I read 130 is about 6 foot) and the middle not have LOS with the bottom which is 10 below. Have top ref cast a spell on middle ref as a way of seeing the markers during scripteffectupdate. The idea of this is that I should be able to place NPC's on ledges above my position, near the edge if I want.

I think with your script it should be a very simple mod to get it trial version

Edited by cfh85
Link to comment
Share on other sites

Sadly I picked up the nickname Trigger in school because my ability in maths far exceeded everyone else!

Finally that ability will be put to good use :whistling:

 

Just think back to all those times people have said "When will we ever use this?" Every time I hear it I laugh, seen as I've used several mathematical techniques that the majority claim are "pointless" and "useless".

 

Edit. Looking at it I'm thinking use 3 refs. PC has line of site of top on, top on has LOS of middle one which is set 200 directly below (I'm sure I read 130 is about 6 foot) and the middle not have LOS with the bottom which is 10 below. Have top ref cast a spell on middle ref as a way of seeing the markers during scripteffectupdate. The idea of this is that I should be able to place NPC's on ledges above my position, near the edge if I want.

I think with your script it should be a very simple mod to get it trial version

 

Clever, but activators have no LOS. Calling GetLOS on an activator causes a crash I think. With that in mind, I have thought of something a little more elegant: an activator that follows the player's LOS, as normal, but instead of 2 more markers beneath it, there is an invisible, silent actor with no AI, locked X and Y co-ordinates and no fall timer. The actor can be placed at the activator and will simply utilize natural game mechanics to fall straight down onto the ground. At that point, you will have your ground co-ordinates.

To add those traits in, here are some ideas...

 

For invisibility, adjusting the scale is a good idea. But you can also make the actor transparent with SetActorAlpha 0, or Saa 0.

For silence, you can block the Greeting topic by making them an unplayable race. SetDestroyed 1 blocks all other interactions. SetGhost blocks combat in all forms; spells may pass through him, but I'm not sure.

Locked co-ordinates are impossible, but you can always just constantly reset them with SetPos X and SetPos Y. Or, you could use SetVelocity X Y Z to cancel out any lateral movement and even speed up the fall. Note that I've never used it to make something move very fast, and I have a feeling that overdoing it may cause Havok to pull our little friend through the floor. Matching or slightly exceeding the speed of the spell would probably be enough.

You can use ResetFallDamageTimer to make sure that the actor never takes fall damage and accidently dies.

You can use Ref.IsOnGround to check when they have finally hit the deck.

 

I think you're right about using spells as the visible marker. They wouldn't suffer the MoveTo bug like a static or activator. If the companion teleports to the ground marker, you may need to give him time to complete his fall.

 

 

If it's ok with you, I may use this concept for myself at some point when you are done with it. I may use it to modify the original teleport spell for a start, but I have a feeling that I will need it again at some point. ;)

Edited by WarRatsG
Link to comment
Share on other sites

There is a similar command mod already out there that you could potentially do this with. It's called Minionz.

 

What you could do is walk over to a point where you want your companion to start the ambush, and tell them to guard the point. If you want them to wait until you command to attack, you could make them wait at the spot, be passive, and then use the minion command key (which you set when the mod is first used) and left click the target. This will make the companion attack the target.

 

There's also other commands as well. It's a pretty neat mod actually.

Edited by lonewolf_kai
Link to comment
Share on other sites

There is a similar command mod already out there that you could potentially do this with. It's called Minionz.

 

What you could do is walk over to a point where you want your companion to start the ambush, and tell them to guard the point. If you want them to wait until you command to attack, you could make them wait at the spot, be passive, and then use the minion command key (which you set when the mod is first used) and left click the target. This will make the companion attack the target.

 

There's also other commands as well. It's a pretty neat mod actually.

 

All the ambush commands are done. Some are pretty useful.

I have a 'ambush healer' who scans the cell for NPC's in the companion faction, then compares their health, the one with the lowest health % is either healed of has a fortify spell cast on them (depending on health being above or below a threshold)

I also have 'ambush ranged leader' who selects a target for the ranged attackers, scanning the NPC's for one attacking a friendly, looks for one that prefers ranged and selects the closest.

You can only have one healer, and one ranged leader, but you can have as many ranged attackers (you need to have a ranged leader first) and regular attackers as you want.

They will all wait and hide (set to sneak, but how hidden depends on where you ask them to wait) until you give the command (an ability that sets them all to ambush at the same time)

 

These are fairly simple things to set up. The improvement I'm working on, with WarRatsG's help is to be able to remotely set their wait positions. At the moment you have to walk them to where you want them to wait and then give them the ambush command.

I wont be having any plain select target commands as I don't want my mod to be used to allow you to win fights without being involved. The ambush command sets the companions to follow player, so they will only start combat if you're in combat. the ranged attackers select targets based on whether an NPC is in combat with a friendly.

 

I'm trying to think of new commands and new uses for companions to set my mod apart from others. Although the long term aim is for this to be used in my main project, like most of the other features of my main project, this will be released as a stand alone (for testing/development)

Link to comment
Share on other sites

Hmm, sounds interesting. I'll keep a watchful eye on this thread.

 

I can see some potential mod conflicts with a few popular mods, such as SDR. For example, changing any of the sneak functions including changing the actor alpha's can cause several problems with SDR. SDR already does that. If you can either exclude that or make an option to exclude that particular function, you can get around that particular conflict.

Edited by lonewolf_kai
Link to comment
Share on other sites

I wont be having any plain select target commands as I don't want my mod to be used to allow you to win fights without being involved. The ambush command sets the companions to follow player, so they will only start combat if you're in combat. the ranged attackers select targets based on whether an NPC is in combat with a friendly.

 

Fair enough, you don't want to make anything overpowered. But consider this - some people may actually want to be a commander of some kind. They may enjoy feeling like a tactician, coordinating their mercs through tough fights to make sure they all come out alive. Kind of like an RTS with the option of jumping in and leading from the front.

 

As for making the mod stand out, everyone loves RPG elements. I've been planning to add followers into future updates of my own mod, but with a twist. My solution was to create some kind of EXP system, possibly with branching abilities. It would add a sense of attachment to any and all followers involved, a sense of achievement for creating an elite army, and most importantly a memorable experience for doing something different to the norm.

 

For example, changing any of the sneak functions including changing the actor alpha's can cause several problems with SDR. SDR already does that. If you can either exclude that or make an option to exclude that particular function, you can get around that particular conflict.

 

I suggested it to make only one actor invisible, who doesn't really exist as far as the player is concerned. He's just the fall guy :teehee:

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...