Hello, this is where I'll be showing and uploading my custom single player maps for Call of Duty 2. So far I have made "Frost" my first map.

Post news Report RSS Requesting Assistance! [SOLVED]

Need some help with vehicles and AI. Hopefully you guys know more about this than I do!

Posted by on

Hello fellow modders and mappers alike, I've come up against a problem in my map "Stonne" and I can't continue working on it until this has been resolved. The problem involves having AI and vehicles. :(

The getEnt() function does not work for AI that are spawned and riding on the tanks. This is a problem because that means I can't make AI move through my script if I haven't yet defined them. Another maybe related problem is the dismount of the tank. If you look at the video of my map Moddb.com , you can see what I mean (1:05 in the video). I've placed pathnodes all around the dismount area and the AI doesn't budge! They appear to get stuck inside the tank once it stops and they don't move after that.

shot0055

shot0056

So I ask: is there a CoD2 function or a way to get entities riding on tanks in script? The Key/Values for the AI have script_vehicleride, script_noteworthy, targetname, and the basic ones. Any help is much appreciated!

Post comment Comments
MCh2207Cz
MCh2207Cz - - 2,073 comments

i checked how toujane handles their AI dismounted at the beginning of the mission - script_noteworthy is used in toujane.
check if your d3dbsp has g_connectpaths 1. and also check what your console says after paths are connected. it might be possible that the engine deleted your path nodes around the tank because they were inside the tank's collision brush.
developer 1 might help with identifying the problem too because console lists much more detail when developer is turned to "1".

btw how did you setup your panzer2 ride? usually something like this is used:
level.kubel = getent("kubel", "script_noteworthy");
path = getvehiclenode ("vehicle_start_path", "script_noteworthy");
level.kubel attachPath(path);
wait .5;
level.kubel startPath();
level.kubel waittill("reached_end_node");
level.kubel notify ("unload");

Reply Good karma Bad karma+5 votes
djole22lt
djole22lt - - 300 comments

Maybe Panzer II wasn't supposed to have soldiers sitting on it. But on the other hand, during the ride, they had proper anims and they were correctly attached on it.

I've made a tank ride for my Nuenen mission, and I can give you the tank ride script from it if you want. It's for CoDUO, but with some modifications it should work for CoD2.

Also, there are many keys/values to define entities, it's not just only targetname, but also script_noteworthy and groupname. The last one might be useful.

Reply Good karma Bad karma+4 votes
SPi-99
SPi-99 - - 781 comments

I doublicated the tiger script of carrying soldiers and made it work for panzerii. It seems to work okay with crusader sitting anims so we kept it. However, dismount is something even I didn't manage to do properly in my Corner Shop alpha.

Reply Good karma Bad karma+4 votes
rr016 Author
rr016 - - 124 comments

No luck so far. I've posted my testmap of how the tank rides and dismounts, perhaps you can see what I'm doing wrong here :/

Moddb.com

Reply Good karma+3 votes
MCh2207Cz
MCh2207Cz - - 2,073 comments

i think i got it. i added this to line 90:
tank notify ("unload");
and also i modified the MAP file. from my tests it turned out that the AI gets stuck if it has nothing to do (no goal). so i added friendlychain and exposed enemies and it seems to be working.
Moddb.com
Download: Mediafire.com

Reply Good karma Bad karma+4 votes
rr016 Author
rr016 - - 124 comments

Thank you so much! I thought the AI would move to the nodes without making it their goal. Ah, friendlychain, I'm still trying to grasp what is connected to what and how it works but I'll manage. Also, the line tank notify ("unload"); does nothing; I // it out in the GSC and the dismount worked fine. Well that solves one problem, but what about using getEnt() on the AI riding the tank? I was originally planning to make certain AI go to specific nodes through getEnt() and getNode() but they simply don't work.

Reply Good karma+2 votes
rr016 Author
rr016 - - 124 comments

Another thing, why did you spawn the AI before the tank spawns? Does friendlychain not work in that setup? One more thing, when I press fire up close to AI they don't say anything like they normally do. I think this is part of the getEnt() problem.

Reply Good karma+2 votes
MCh2207Cz
MCh2207Cz - - 2,073 comments

ok, after further investigation i found out the true reason why panzer2 has problems unloading AI.
cod2 developers actually didn't fully finished the panzer2 model. it is missing angular definitions for the AI sitting on the tank. basically all AI exits the tank in a forward (default) direction and they sometimes get stuck. if the AI has a goal then it doesn't happen that often but it still sometimes happens. that's also the reason why there is no _tankai_panzer2 script.

now the question is if it can be corrected. the answer is yes - but the model must be edited.

Reply Good karma Bad karma+3 votes
rr016 Author
rr016 - - 124 comments

When I started planning this project, I didn't think riding panzer2 would be this difficult to achieve. I'm not sure what you mean by editing the model. Maybe I should just stick with crusader or tiger tanks, This is getting out of hand?

Reply Good karma+2 votes
MCh2207Cz
MCh2207Cz - - 2,073 comments

give me some time. i am doing tests to see if i got it fully fixed.

Reply Good karma Bad karma+3 votes
MCh2207Cz
MCh2207Cz - - 2,073 comments

yes!
i used your original testmap with the modified panzer2 model+AIscript and it works.
thanks to that i also found out few bugs on my custom tank models that i will correct.
let me finish it off and i will post a download there.

P.S. and yes the notify ("unload") function seems to do nothing at all for tanks :)

Reply Good karma Bad karma+3 votes
MCh2207Cz
MCh2207Cz - - 2,073 comments

panzer2 fully fixed: Moddb.com
download: Mediafire.com
place the updated xmodel files into your map's IWD and use _tankai_panzer2.gsc in your map's GSC - for ex. maps\_tankai_panzer2::main("xmodel/vehicle_panzer_ii");

Reply Good karma Bad karma+3 votes
rr016 Author
rr016 - - 124 comments

Thank you so much Mch, AI now doesn't clip through the tank! This is however, slightly inconvenient that to test Stonne I'll have to make an IWD each time that replaces the xmodels. But whatever, I am so thankful that you used your time to help me.

Well that is one problem taken care of, now I need to know how to getEnt() the riding AIs...

Reply Good karma+2 votes
MCh2207Cz
MCh2207Cz - - 2,073 comments

for testing purposes you can put just the xmodels into IWD under "main". this way it will function like a mod.

as for getEnt() i wont be able to help there. that's scripting stuff and i am not good in this area sadly...

Reply Good karma Bad karma+2 votes
rr016 Author
rr016 - - 124 comments

Well I tried decompiling toujane.d3dbsp using the one djole22lt found here: Moddb.com but radiant won't read the .MAP file. getEnt("___", "script_noteworthy") doesn't work so I'm thinking now what to do...

Reply Good karma+1 vote
djole22lt
djole22lt - - 300 comments

I assume the error is "Out of memory", and that the decompiled map file's size is about 100MB.

I've successfully decompiled decoytrenches.d3dbsp and opened it's .map file (which was 20MB).

It seems that Radiant has issues opening too large files.

Reply Good karma Bad karma+2 votes
djole22lt
djole22lt - - 300 comments

Also, here's a code that can help you identify if getent function works or not:

entity1 = getent("entity1", "script_noteworthy");
iprintln("entity1 coordinates:" + entity1.origin);

Key is usually targetname, script_noteworthy or groupname.
You can change value to whatever.

Also make sure entity's classname begins with script_ or trigger_, and not misc_!

When you test this code in-game, you should get entity's origin info typed above the compass. Copy that coordinates somewhere, and check if there's an entity in your .map file at those coordinates.

Here's a modified version of the code, that should give you origins of all entities with the same key/value combination:

entity1 = getentarray("entity1", "script_noteworthy");
for(i=0;i<entity1.size;i++)
{
iprintln("entity1 coordinates:" + entity1[i].origin);
}

Reply Good karma Bad karma+2 votes
rr016 Author
rr016 - - 124 comments

I HAVE FOUND AN ALTERNATIVE WAY AROUND THIS PROBLEM. Article post soon...

Reply Good karma+2 votes
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: