NPCs & AI Packages

Post » Sat Dec 03, 2011 7:40 am

I'm currently making a mod that adds 13 companions into the game. The idea is to simulate a squad of USMC Soldiers consisting of a Squad Leader (SL) and 3 Fire Teams (FT) of 4 Fire Team Member (FTM).

Now what I wanna do is make the NPCs follow one another.
i.e. In Fire Team 1-3,
Fire Team Leader (FTL) < FTM 1 < FTM 2 < FTM 3

I want them the FTM to follow the FTL where ever they move, and that if the FTL is in combat they would join the fight and scatter/find cover and once the battle is over they regroup and follow the Fire Team leader as per normal. Keeping in mind that my mod would be based on the http://www.fallout3nexus.com/downloads/file.php?id=2399 (SCC)

What I have in mind is this, I want to use SCC to recruit ONLY the FTL. Thus with the AI Package, the FTM would follow and act as a squad. What I have done is set the FTL to "Guard the area" and the rest of the FTM to follow and engage enemies accordingly.

I am aware that this can be done using the AI Packages. This is what I have done.

FOLLOW PACKAGE
I used the follow package and it was successful as NPCs move around in a trail HOWEVER, when the FT Leader engages the enemy all the squad members does is run around doing nothing.

ESCORT PACKAGE
Squad Members don't even follow

IN SHORT:
1) How do I make NPCs follow one another in a trial
2) Engage the enemy that is engaging the NPC he/she is following
3) Take cover, etc, while engaging.
(Optional)
User avatar
Chantel Hopkin
 
Posts: 3533
Joined: Sun Dec 03, 2006 9:41 am

Post » Fri Dec 02, 2011 8:13 pm

FYI - To any one who wants to post in this topic -

This question was posed by this user in two other forums and had been resolved.
User avatar
+++CAZZY
 
Posts: 3403
Joined: Wed Sep 13, 2006 1:04 pm

Post » Fri Dec 02, 2011 9:50 pm

FYI - To any one who wants to post in this topic -

This question was posed by this user in two other forums and had been resolved.

Oh yes, thanks for that. I've even uploaded the mod :)
http://fallout3nexus.com/downloads/file.php?id=12207
User avatar
Charlie Ramsden
 
Posts: 3434
Joined: Fri Jun 15, 2007 7:53 pm

Post » Sat Dec 03, 2011 6:54 am

Quick question:
How do I make the NPCs follow their leader's stance? Weather he's sneaking, not sneaking or weapons drawn/holstered.
Where do I go to edit this?

Package Type
Follow

Pretend in Combat Behavior
The actor will draw his weapon and follow the leader. The actor will also follow the sneak state of the leader when within a distance of fCombatFollowSneakFollowRadius( default: 512.0 ), so if the leader begins sneaking, the follower will too.

Continue During Combat Behavior
The actor will go into combat with the targets, but will always try to stay within the follow radius of the leader. The same sneak following behavior as in Pretend in Combat occurs

Notes
The follow radius is the package radius * fCombatFollowRadiusMult( default: 3.0 ) or fCombatFollowRadiusMin( default: 512.0 ), whichever is higher

So how do I make it such that they will always follow stances? Please help!
User avatar
Justin
 
Posts: 3409
Joined: Sun Sep 23, 2007 12:32 am

Post » Fri Dec 02, 2011 9:24 pm

Update:
Bearing in mind that I'm using TalkieToaster's Companions Share and Recruit Mod,
It seems that sometimes follow sneak works and sometimes it doesnt work. It normally stops working after I "wait" in-game.

What I did is recruit the Fire Team Leader (FTL) as a friend, and get him to follow me. When I move, the FTL moves towards me, and the Fireteam Members (FTM) follows the FTL etc. So it works that way. When I just reload a save game and enter sneak mode, the whole Fireteam follows (bearing in mind that each NPC follows the NPC he/she is designated to follow). But when I wait, it seems that somehow the script or whatever is broken and tje FTMembers cease following the stance/sneak. Only the FTLeader is sneaking. However, the FTMembers still do trail each other, only that now, they would no longer enter sneak mode.

I don't know what's wrong or what's going on. I dont think its the load order. Perhaps there should be a check script i must enter somewhere?

P.S. is there a way to teleport the NPC towards its target shud the NPC is beyond the radius of 500? Like what SCC does.
__________________________________________________________________________________

EDIT: It seems that this is a pretty serious problem. The script seems to break after events.

e.g.
#1) FTmembers stop following FTLeader after Combat
#2) FTmembers are "activated" thus, when FTLeader sneaks they sneaks too
#3) All the more making it an important aspect to have the NPCs teleport to its target
#4) Some kind of "check" to be implemented (i.e. Am i following the leader? If not in combat and not engaged in coversation, follow the leader)

I'm not good at scripting, can someone please teach me how to go aobut doing this? And I really think there's a need to have a "check" for the NPCs if they are following their "leader" or not in the script. Could someone pls help out?
User avatar
Lizzie
 
Posts: 3476
Joined: Sun Nov 19, 2006 5:51 am

Post » Fri Dec 02, 2011 10:48 pm

Quick question:
How do I make the NPCs follow their leader's stance? Weather he's sneaking, not sneaking or weapons drawn/holstered.
Where do I go to edit this?

Package Type
Follow

Pretend in Combat Behavior
The actor will draw his weapon and follow the leader. The actor will also follow the sneak state of the leader when within a distance of fCombatFollowSneakFollowRadius( default: 512.0 ), so if the leader begins sneaking, the follower will too.

Continue During Combat Behavior
The actor will go into combat with the targets, but will always try to stay within the follow radius of the leader. The same sneak following behavior as in Pretend in Combat occurs

Notes
The follow radius is the package radius * fCombatFollowRadiusMult( default: 3.0 ) or fCombatFollowRadiusMin( default: 512.0 ), whichever is higher

So how do I make it such that they will always follow stances? Please help!


if they are running the follow package, they should be sneaking when whoever they are following is sneaking. Unclick the box 'Continue when PC near' in the follow packages. You don't need it and it may be causing problems - i've never used it for anything.
User avatar
Peetay
 
Posts: 3303
Joined: Sun Jul 22, 2007 10:33 am

Post » Sat Dec 03, 2011 6:39 am

Just some insight.

The 'Continue while PC near' flag is used in the case of a package for a store clerk. The package tells the clerk to stand in the store and be 'selling' things all day long. Lets say it ends at 6pm. You would check it on this package. If the player enters the store at 5:58pm and stays till over 6, if the flag was not checked, the clerk would simply walk away and leave the store. This way, the game wont reevaluate their package, thus changing it (telling them to go home and sleep or something, instead of run the store) until the player has left the shop. So you never want to use this flag unless its something that should continue until the player leaves the area.
User avatar
RaeAnne
 
Posts: 3427
Joined: Sat Jun 24, 2006 6:40 pm

Post » Sat Dec 03, 2011 2:13 am

No luck with the "sneak together" and "continue following after combat" same problem persists.
I've unchecked the "Continue when PC Near flag" and checked the "Pretend in combat" but still, they'd sometimes stop following after combat.
and cease to sneak together after i "wait" for an hour or two ingame.

I tried to "emulate" some scripts from Companions Share and Recruit Mod but I can't read programming language :(
User avatar
Nitol Ahmed
 
Posts: 3321
Joined: Thu May 03, 2007 7:35 am

Post » Fri Dec 02, 2011 9:30 pm

I took this code out from SCC and this are the codes that I want. Is this code COMPLETE?
And I have another bloody problem. I can't create scripts.
EDIT: I can now make scripts using "fose_launcher.exe -editor"

scn 000USMCScriptref npcref dummyref selfshort wassneakingshort weaponoutBEGIN onaddset npc to getcontainernpc.setignorefriendlyhits 999;===========;Mimic Player;===========if(npc.getinfaction 00USMC == 1)	if(player.issneaking==1 && wassneaking == 0)		npc.setforcesneak 1		set wassneaking to 1		printtoconsole "Started Sneaking"	elseif(player.issneaking==0 && wassneaking == 1)		npc.setforcesneak 0		set wassneaking to 0		printtoconsole "Stopped Sneaking"	endif	if(player.isweaponout==1 && weaponout==0)		npc.setalert 1		set weaponout to 1		printtoconsole "Weapon Out"	elseif(player.isweaponout==0 && weaponout == 1)		npc.setalert 0		set weaponout to 0		printtoconsole "Weapon Away"	endifendif;===============;End Mimic Player;===============;=======;Teleport;=======if(self.GetDistance player>5000)	self.moveto player	printtoconsole "SCC: %n too far. Moving to player." selfendif;===========;End Teleport;===========end


EDIT 2: Doesn't seem to be working :(
I am aware that the system that SCC or CSR uses is very complicated. For example dialogue boxes items will add "tokens" into the NPCs inventory. These tokens are bound to a script. (e.g. follow script, wait script, etc)

But I don't think my mod needs to be that complicated, all I think (though I'm not sure which is why i really need expert advice) I need is to have the NPC run a script 24/7 which tells him to "teleport to player" and "Mimic Player".
User avatar
Catharine Krupinski
 
Posts: 3377
Joined: Sun Aug 12, 2007 3:39 pm

Post » Fri Dec 02, 2011 8:35 pm

GUYS, DON'T TROUBLE YOURSELF.
The problem regarding the sneak and weapons up/holstered solved.

What I did:
#1) Use this CORRECTED code
scn 000USMCScriptref npcref dummyref selfshort wassneakingshort weaponoutshort responsshort assisshort aggresshort confshort removalshort alertedbegin GameModeset npc to getcontainernpc.setignorefriendlyhits 999npc.AddtoFaction 00USMC 1npc.setfactionrank PlayerFaction 1;===========;Mimic Player;===========if(npc.getinfaction 00USMC == 1)	if(player.issneaking==1 && wassneaking == 0)		npc.setforcesneak 1		set wassneaking to 1		printtoconsole "Started Sneaking"	elseif(player.issneaking==0 && wassneaking == 1)		npc.setforcesneak 0		set wassneaking to 0		printtoconsole "Stopped Sneaking"	endif	if(player.isweaponout==1 && weaponout==0)		npc.setalert 1		set weaponout to 1		printtoconsole "Weapon Out"	elseif(player.isweaponout==0 && weaponout == 1)		npc.setalert 0		set weaponout to 0		printtoconsole "Weapon Away"	endifendif;===============;End Mimic Player;===============;=======;Teleport;=======if(self.GetDistance player>5000)	self.moveto player	printtoconsole "SCC: %n too far. Moving to player." selfendif;===========;End Teleport;===========end

#2) Add this script to each NPC

#3) Created an "armor" item have script above attached to it. Then give each NPC this "armor item"


Issues:
1) When I crouch/holster ALL 17 NPCs will Crouch/holster (LOL)
2) Only problem left is that NPCs sometimes stop following you after combat.

I'm gonna release this as v1.2
User avatar
Jah Allen
 
Posts: 3444
Joined: Wed Jan 24, 2007 2:09 am


Return to Fallout 3

cron