Jump to content

how do I make an npc assault the player?


Untouchable1

Recommended Posts

I'm creating a level in which archer bandits need to be able to detect the player character up on a ledge and decide to let loose with arrows on him upon being seen. The only problem is, when I run the level, even though the PC is under full light they still can't detect me until I'm not sneaking within 30 feet of them on the ground floor. I need to find a way for them to either detect the player's presence when they enter the area or be able to direct them to fire on him when entering a certain area, or when within range (of the bow).

 

Here's a pic I took in the CS showing the situation...

 

http://i34.photobucket.com/albums/d143/Ste...Sim1/csscan.jpg

 

This is my first foray into the CS and I've already learned a whole lot. The only thing I can't seem to figure out is very case specific things like this...

 

Thanks. :)

Link to comment
Share on other sites

I'm creating a level in which archer bandits need to be able to detect the player character up on a ledge and decide to let loose with arrows on him upon being seen. The only problem is, when I run the level, even though the PC is under full light they still can't detect me until I'm not sneaking within 30 feet of them on the ground floor. I need to find a way for them to either detect the player's presence when they enter the area or be able to direct them to fire on him when entering a certain area, or when within range (of the bow).

 

Here's a pic I took in the CS showing the situation...

 

http://i34.photobucket.com/albums/d143/Ste...Sim1/csscan.jpg

 

This is my first foray into the CS and I've already learned a whole lot. The only thing I can't seem to figure out is very case specific things like this...

 

Thanks. :)

I believe you should increase they're sneak. Enemies with high sneak are ale to detect people more efficiently. i hope i helped :)

Link to comment
Share on other sites

In this situation, you're probably best off doing a bit of scripting to force the situation how you want it to happen, rather than having the AI try and do it naturally. However doing this is a bit complicated, and requires detecting when the player enters a certain radius of a persistant reference (like an xmarker), and having the NPCs involved specifically scripted to attack the player (startcombat player) when the player enters that radius and isn't sneaking.

 

You may also have to adjust the combat style of those NPCs to allow for more long distant attacks, unless you want them to try rushing the player.

Link to comment
Share on other sites

You'd also want to be careful to not give them close combat weapons, less they jump off to their death when you near them.

 

No they are going to be shooting up the cliff at the player.

 

In this situation, you're probably best off doing a bit of scripting to force the situation how you want it to happen, rather than having the AI try and do it naturally. However doing this is a bit complicated, and requires detecting when the player enters a certain radius of a persistant reference (like an xmarker), and having the NPCs involved specifically scripted to attack the player (startcombat player) when the player enters that radius and isn't sneaking.

 

You may also have to adjust the combat style of those NPCs to allow for more long distant attacks, unless you want them to try rushing the player.

 

I was hoping it would not come to heavy scripting, but I guess there's no way around it. I'm gonna try to figure out how to get that x marker radius thing going and try to nail down the logic of the script to be used. Only bad thing is, I'm gonna get too far without heavily researching the scripting language. The official help site doesn't do a whole lot about that.

 

Right I've been trying to find a way to make them wanna shoot farther. I set their arrow max and optimal distance twice as far but to no avail. And some other settings I forgot that are on the same window, but that didn't help either.

 

 

 

I guess it's just a matter of hardcore learning and figuring everything out...

Link to comment
Share on other sites

I was hoping it would not come to heavy scripting, but I guess there's no way around it.

Wouldn't call it heavy scripting, it's about middle of the road really. The tough part is really just figuring out how to call the various events. Are the bandits being used generic default ones, or are they clones of of the default, or new ones? Are the bandits placed within the scene in the CS as a 1 time thing, or are they created from a leveled list or otherwise spawned?

 

As for figuring out the distances, and where to place a marker... Using a clones light, placed in world, with "casts shadows" checked will let you get a feel for distances and radiuses. You can change the radius on that light, and see how far that radius extends in the CS. Then you can position a marker exactly where the light is, and use that radius as a trigger for combat. Just be sure to remove the light from the cell before playing, and that you don't edit any of the normal lights.

Link to comment
Share on other sites

I was hoping it would not come to heavy scripting, but I guess there's no way around it.

Wouldn't call it heavy scripting, it's about middle of the road really. The tough part is really just figuring out how to call the various events. Are the bandits being used generic default ones, or are they clones of of the default, or new ones? Are the bandits placed within the scene in the CS as a 1 time thing, or are they created from a leveled list or otherwise spawned?

 

As for figuring out the distances, and where to place a marker... Using a clones light, placed in world, with "casts shadows" checked will let you get a feel for distances and radiuses. You can change the radius on that light, and see how far that radius extends in the CS. Then you can position a marker exactly where the light is, and use that radius as a trigger for combat. Just be sure to remove the light from the cell before playing, and that you don't edit any of the normal lights.

 

 

I'm making new bandits and I changed their arrow range and whatnot to twice the distance. Nothing working to try and make it naturally happen. I can't really get a good grasp on the scripting language anywhere. All I need is kind of an "IF Player within X radius of This Marker, THEN These NPCs attack Player" But I don't know how to do that! :(

Link to comment
Share on other sites

How 'bout something like this for a script on the marker:

 

scriptname yourscript

ref self

begin gamemode
if player.getdistance self <= x;instead of x put the radius you want
YourBanditRef1.startcombat player
YourBanditRef2.startcombat player
YourBanditRef3.startcombat player
endif
end

 

There's that, or, to get rid of the whole gamemode thing (which I believe can slow down the game a little), you could take a triggerzone in the activator portion of the world objects category, edit it, change its editorID, put a script like this on it:

 

scriptname youractivatorscript

begin ontrigger player
YourBanditRef1.startcombat player
YourBanditRef2.startcombat player
YourBanditRef3.startcombat player
end

 

After that, save it as a new form and put it in the render window. You can then change its size and place it as you wish. Hope I helped.

Link to comment
Share on other sites

  • 2 weeks later...
How 'bout something like this for a script on the marker:

 

scriptname yourscript

ref self

begin gamemode
if player.getdistance self <= x;instead of x put the radius you want
YourBanditRef1.startcombat player
YourBanditRef2.startcombat player
YourBanditRef3.startcombat player
endif
end

 

There's that, or, to get rid of the whole gamemode thing (which I believe can slow down the game a little), you could take a triggerzone in the activator portion of the world objects category, edit it, change its editorID, put a script like this on it:

 

scriptname youractivatorscript

begin ontrigger player
YourBanditRef1.startcombat player
YourBanditRef2.startcombat player
YourBanditRef3.startcombat player
end

 

After that, save it as a new form and put it in the render window. You can then change its size and place it as you wish. Hope I helped.

 

 

Awesome. Thanks a lot, I'll try that out.. ./

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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