Page 1 of 2
Allies in Single Player
Posted: Mon Jan 30, 2006 5:48 am
by Broadus
I've been trying to make a mod where allies will follow the player from the beginning of the single-player stock maps of Allied Assault, Spearhead and Breakthrough to the end. This involves custom-placing allies in levels using scripts. However, I'm having some problems:
1. Custom-placed allies in Allied Assault will not follow the player, even in levels where the player is given pre-placed allies to follow him (like on mission 5 level 2 of Allied Assault). On some levels (even levels with allies), assigning a custom-placed ally a friendtype crashed the game. Problem Number 1 never occurs in Breakthrough.
2. Invisible brushes block AI from moving through them, which stops custom-placed allies from following the player from the beginning of the level to the end. This eliminates a lot of potential with the mod so that I can't give the player a squad like two fighting allies and a medic, as I would have to place maybe twelve or fifteen allies on one level just to ensure the player is constantly followed by the entire squad, while it usually takes four or five to ensure just one guy follows the player the entire level. This would often make pointless lag. This problem is in Breakthrough and is more than likely in Allied Assault and Spearhead as well.
This problem was somehow eliminated by an ally that was pushed through one of these invisible brushes by a truck. The ally could then move through the brush all he wanted, but another nearby ally still couldn't move through the invisible brush.
Problem Number 2 is less important than Problem Number 1 for Allied Assault, because these barriers mean nothing if allies won't even follow the player. However, for Breakthrough, they pose an annoying problem, as Breakthrough never gave me Problem Number 1.
NOTE: The majority of the posts on this page can be ignored, as they're answers to problems that have since been solved.
Posted: Mon Jan 30, 2006 4:17 pm
by jv_map
Just to be sure... you want to spawn additional friendlies in existing single player maps, right?
I can answer the coordinate thing

when playing merely type 'coord' in the console and it'll tell you your coords and the direction you're looking in.
Posted: Mon Jan 30, 2006 9:41 pm
by Broadus
BLANK
Posted: Tue Jan 31, 2006 9:35 am
by lizardkid
There's two different ways to spawn things, but my personal favorite (because it's so concise and takes very little memory and is easy to read) is this. note it can be either in console or script. this is just the 1st ranger battalion private model.. you can look more up in Radiant by creating one and checking it's properties.
Code: Select all
spawn models/human/1st-ranger_private.tik
just spawns a basic ranger with an m1. to add properties (such as origin, gun, accuracy, etc) just put the key then the value in quotes.
there's another, more complex way that's possibly more clear when reading code but it's not what i personally prefer and you cant do it from console, so i dont use it.
on a side note, you sound like you'd enjoy call of duty, since medal of honor was always about insane 1v100 action and cod was always about teamplay and your squad with fighting all over.
Posted: Wed Feb 01, 2006 3:46 am
by Broadus
BLANK
Posted: Thu Feb 02, 2006 4:27 am
by lizardkid
alright, to get NPC's to follow a player you need to use a script that 2015 included, called friendly.scr.
i'm assuming you're just editing scripts and not spawning these guys in runtime. for this i believe you need to name your friendlies $friendly1 $friendly2 $friendly3 and so on. that requires a key/value of
"$targetname" "friendly1"
at the top of your script type
and after you've spawned your guys, for each one put these lines.
Code: Select all
$friendly1 thread global/friendly.scr::friendlythink
$friendly1.friendtype = 1
and they should follow whenever possible, but beware that there are lots of places NPC's cant go, where there are no pathnodes (unlikely, but there are areas) they will just get stuck and look at you. however you can't really know these areas until your men get stuck.
Posted: Mon Feb 13, 2006 5:19 am
by Broadus
BLANK
The Farm
Posted: Mon Feb 13, 2006 9:14 am
by tltrude
There is a hidden singlplayer map in MOHAA named "The Farm". You can play it by typing "map m4L0" in the console (small L). The .map for it is in the MOHAATools folder and can be studied, modified, or copied in the editor.
You can download a coop mod for the Omaha map. Its very old and may be hard to play.
http://www.mohmatch.com/mods/omaha_coop.zip
Posted: Mon Feb 13, 2006 7:24 pm
by Broadus
BLANK
Posted: Mon Feb 13, 2006 9:15 pm
by Broadus
BLANK
SDK
Posted: Tue Feb 14, 2006 12:32 am
by tltrude
I only mentioned that map because you siad you wanted to see how a singleplayer map looks in the editor. There are invisable brushes that block AI. I don't know if the SH/BT SDK editor has an example map for singleplayer or not.
Posted: Tue Feb 14, 2006 10:36 pm
by Broadus
BLANK
Posted: Thu Feb 16, 2006 12:22 am
by Broadus
I've decided to clean everything up so I can state my problems clearly:
1. Custom-placed allies in Allied Assault will not follow the player, even in levels where the player gets allies that follow him. On some levels (even levels with allies), assigning a custom-placed ally a friendtype crashed the game. Problem Number 1 never occurs in Breakthrough.
2. Invisible brushes block AI from moving through them, which stops custom-placed allies from following the player from the beginning of the level to the end. This eliminates a lot of potential with the mod so that I can't give the player a squad like two fighting allies and a medic, as I would have to place maybe twelve or fifteen allies on one level just to ensure the player is constantly followed by the entire squad, while it usually takes four or five to ensure just one guy follows the player the entire level. This would often make pointless lag. This problem is in Breakthrough and is more than likely in Allied Assault and Spearhead as well.
This problem was somehow eliminated by an ally that was pushed through one of these invisible brushes by a truck. The ally could then move through the brush all he wanted, but another nearby ally still couldn't move through the invisible brush.
Problem Number 2 is less important than Problem Number 1 for Allied Assault, because these barriers mean nothing if allies won't even follow the player. However, for Breakthrough, they pose an annoying problem, as Breakthrough never gave me Problem Number 1.
Posted: Thu Feb 16, 2006 8:39 am
by bdbodger
If you use the level design menu you can see ingame where there are pathnodes that allow ai to move . I there are not enough pathnodes there maybe some area that the ai can't move through . The global/friendly.scr depends on haveing pathnodes with the targetname friendlynode and those node haveing set numbers that get higher as they go through the level . The ai must have the targetname friendly and an fnum key set to a number from 1 to 10 that is different for each friendly . When the global/friendly.scr is run it makes an array from the ai with the targetname friendly and they become level.friendly1 for the ai with fnum 1 level.friendly2 for the ai with fnum 2 etc etc . When you want to turn on the friendly AI, do "level.friendly# thread global/friendly.scr::friendlythink"
. Afterwards you can set his friendtype like this: level.friendly#.friendtype = 1 . You really need to know how the friendly system works before you can add new friendlies just adding ai is not enough . If you have a level that has friendlies in it you maybe able to add more but there are things you have to do . You can look for the text part of the bsp file to see what the fnum of the friendlies already in the game have and spawn more with the targetname friendly at the top of the script before the global/friendly.scr is run . That is one way . You can spawn them on the script at a certain point and execute the global/friendly.scr again that may work . You have to set the friendtype to set what type of behavior they will use . As I said before the friendlynodes that to be there as well . Sure you can do it without useing the global/friendly.scr but you need a good knowledge of scripting and the pathnodes .
Posted: Thu Feb 16, 2006 8:48 am
by bdbodger
Well I see he edited his posts to make them blank not really a wise thing to do .