Spawning Paths, and Standing Still

Post your scripting questions / solutions here

Moderator: Moderators

jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

You can only spawn pathnodes before level waittill prespawn, and only if a .pth file does not yet exist, or if the pathnode layout hasn't changed since the previous .pth file was made. In any other case spawning a pathnode will immediately crash the game.

A pathnode is not a waypoint, pathnodes are used to build a navigation network.
Image
Broadus
Captain
Posts: 235
Joined: Mon Jan 30, 2006 5:35 am

Post by Broadus »

Well, if scripting a path into a stock single player map immediately crashes the game, then we're all the way back to square one with this topic, I'm afraid. How do I make a path for AI that I place in stock maps that the AI can follow in a friendtype 0 fashion? As in, they move proportionate to the player, rather than just going straight to where they want to go irrelevant of the player.
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

seems to me all you'd need to do it cut out the original .pth file for the map, run this so it builds your pathnodes with it, and place the new .pth file with your package. it should replace the old one and everything should be cool.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Broadus
Captain
Posts: 235
Joined: Mon Jan 30, 2006 5:35 am

Post by Broadus »

Hey, it worked! Fancy! Thanks!

I do still wander how, on m5l1a and m5l1b, they made all allies on the levels follow very complicated paths. The paths support craploads of guys at once, and the paths will have parts that seperate from the main path and then go inside houses and stuff, but the AI won't go on those seperate paths if the player doesn't go on them. How does that work out?
Seriously, an AI only has to be placed to follow the paths. They don't have to "runto" or anything.
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

They're either patrol or runner types, or alarm (though I don't think there are any alarms in m5). The enemies that is. The friendlies just follow the player...
Image
Broadus
Captain
Posts: 235
Joined: Mon Jan 30, 2006 5:35 am

Post by Broadus »

What are you talking about, man? They don't follow the player. They follow paths automatically, no matter what friendtype they are (though, if they're friendtype 1, they'll follow the paths for a few seconds but realize they should follow the player).
On m1l1, the friendtype 0 allies are told to run on specific paths, and any newly placed allies won't do anything unless told to run those same paths.
On m5l1a and m5l1b, any ally that is placed will follow the paths without being told to do so. These paths are interesting, but hard to stick a definition on. I can't figure out how to do them.
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Hmm well probably you're more into it than me... haven't looked in m5's scripts (or any stock map scripts) in too much detail... thought the friendlies were just simple friendtype 0's..

Still AIs won't follow a path unless told to.. either by a moveto command from script or by being a type runner, patrol or alarm. I'm pretty sure about that :?
Image
Broadus
Captain
Posts: 235
Joined: Mon Jan 30, 2006 5:35 am

Post by Broadus »

They are friendtype 0s. But it doesn't matter what type they are, because they'll still want to go on the paths, but like I've already said, friendtype 1s will change their minds and follow the player like they're supposed to.
Simply placing the ally actually does nothing, I just discovered. Spawning an ally (in a constant respawning fashion, rather than just placing the ally) will make them want to follow the paths.
However, they are NOT told to go on the paths. Even the stock AI, as far as I'm aware, aren't told to actually run on the paths, though I'll have to look into it again. They would have to be told to do something, since on both m5l1a and m5l1b, the allies will sit still in the beginning, then decide to move on the paths.
However, I do repeat, don't try to twist my words, the respawning AI are in no way directly told to go on the paths. I would know, seeing as how I put them there in the first place. Remember my Friendly Faces demo? Just load up m5l1a and you'll see for yourself that all of the friendlies that spawn will automatically follow the weird m5l1a paths.
I've tried it out in m5l1b, and it's the same-exact thing. They didn't mention this awesome method of following paths in the friendly.scr, at least not in the beginning description.
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

it's entirely possible that they have nav paths. which aren't used much in MOH, because of it's excellent pathfinding system.

nav paths are just links of pathnodes that arent scripted in. they're good for things like this.

Code: Select all

x < goal
a a a a a a a a a
----------------- a
^ wall              a < pathnodes
\/                    a
----------------- a
a_a_a_a_a_a_a < nav path

o < ai
so the AI doesnt stop halfway and recalculate his path and try to go the other way and get stuck in the middle, he's commited to the nav path.

thats why you check "not used for navigation" or something like that in MOHRad, so your scripted paths arent followed by generic AI.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Broadus
Captain
Posts: 235
Joined: Mon Jan 30, 2006 5:35 am

Post by Broadus »

That's not how the paths work in Mission 5, or it would hardly seem that way. From my thorough experience with the maps, these special paths are used so that the allies can be Friendtype 0, but rather than going in one direction, they can split off the path to follow the player (or lead him, if it's set like that) into buildings, or wherever they need to go that isn't on a main path.
They won't always split off the path. If the player goes a completely different direction from the path split, the AI won't bother with the split. Generic AI will follow these weird paths, as long as they're spawned with special respawning scripts, rather than just placed.
The AI will still stop along these paths like normal Friendtype 0s and are affected by mins/maxs.
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Broadus wrote:Generic AI will follow these weird paths, as long as they're spawned with special respawning scripts, rather than just placed.
I knew it :P the AI only follows the paths because they are told to by the 'special respawning scripts'. Maybe you could tell us what special respawning scripts?
Broadus wrote:However, I do repeat, don't try to twist my words, the respawning AI are in no way directly told to go on the paths.
What makes you think I'd like to twist your words? :? ... seriously, chill, no reason to get all upset :shock:

Sorry I mixed up friendtype 0 and friendtype 1 earlier. I meant friendtype 1.

Now I kind of lost the overview in this topic :? , actually, what is your question/problem?

PS lizard info_pathnodes are not meant to be used for sending an AI to a destination... just use script_origins for that... info_pathnodes are only to be used to make a navigation network. Adding useless nodes to the network significantly increases cpu load and memory used for pathfinding.
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

then what is hte flag that says something like "DO_NOT_NAVIGATE" mean? what would be the point of a pathnode that cant be considered for navigation..?

not contradicting you just wondering why they would put that in.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Broadus
Captain
Posts: 235
Joined: Mon Jan 30, 2006 5:35 am

Post by Broadus »

This topic was actually answered a long time ago, 'cause you guys rock and helped me out. Anyway, here's the exact script as used on m5l1b. I cut out six of the other fodder guys, because they're similar to massally1. If you switch massally1 to friendtype 1, he will, for a few seconds, follow the paths, until he begins to act like a friendtype 1.
spawn_a_guy local.model local.origin local.gun:
local.guy = spawn local.model origin local.origin gun local.gun
local.guy.accuracy = 25
local.guy.mindist = 0
local.guy.maxdist = 1500
local.guy.health = 100
local.guy.sight = 1500
local.guy.noticescale = 0
local.guy.waittime = 0.1
local.guy thread global/friendly.scr::friendlythink
local.guy.friendtype = 0
local.guy.ammo_grenade = 99
local.guy type_attack "cover"
local.guy type_idle "cover"
local.guy.hearing = 0
local.guy.enemysharerange = 1
local.guy.mins = 10
local.guy.maxs = 20
local.guy thread fighttanks
local.guy thread foddername
local.guy dontdropweapons
local.guy.nodrophealth = 1
end local.guy

massally1:
for(local.i = 1; local.i <= 1; local.i++)
{
thread respawning_guy "human/2nd-ranger_private.tik" ( -275.50 -6758.00 279.44 ) "bazooka"
}
end

respawning_guy local.model local.origin local.gun:
while(1)
{
local.guy = waitthread spawn_a_guy local.model local.origin local.gun
while(isAlive local.guy)
{
waitframe
}
wait 2.0
wait (randomfloat 2.0)
}
end
As you can see, there is nothing saying, "Go here, go there, go anywhere, go there with a fox, in a box, full of chicken pox". Not a thing.
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Yes, there is, the call to global/friendly.scr::friendlythink does it :)
Image
Broadus
Captain
Posts: 235
Joined: Mon Jan 30, 2006 5:35 am

Post by Broadus »

Oh. Okey dokey! Good to know.

I was mistaken when I said this topic was answered. I am unable to get AI to move to the SECOND part of the path. Here's what what my script looks like:
leftstreetpathmake:
local.coords = "3651.63 5544.51 168.98"::"3609.02 5647.98 204.38"::"3539.66 5796.75 168.13"::"3318.97 5792.74 168.13"::"3156.06 5790.82 168.13"
local.lastPath = spawn info_pathnode "origin" local.coords[1] "targetname" "leftstreetpath"
for(local.i = 2; local.i <= local.coords.length; local.i++)
{
local.newPath = spawn info_pathnode "origin" local.coords[local.i] "targetname" ("leftstreetpath" + local.i)
local.lastPath.target = local.newPath.targetname
local.lastPath = local.newPath
}
end
They'll move to the first point, but not the second. Actually, on Spearhead, they'll move to the first point. For some reason, on Allied Assault, I have to repeatedly shoot my allies so that they'll want to move to the first point.
Anyway, once they get to the first point, they won't go to the second one. I'd assume I did something wrong in the script.
Image
Post Reply