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 My alternative plan [SOLVED]

I propose a alternative solution to the AI riding tanks defining issue.

Posted by on

Hello and welcome back, I have some good news and some bad news. Let's start with the good news:

Following the getEnt() and AI defining issue, I did some research and even looked closely at the Toujane map to notice that the AI aren't even defined! So I had to come up with a back-up plan and I did, my alternative plan was this: when player dismounts tank, make his screen black so he can't see the old AI get deleted and being replaced by newly spawned AI. I was inspired by 3st0nian's "Prussia" custom SP map when I noticed he used the same black screen trick to simulate and ambush on a convoy. I have a step - by - step guide to how this works:

layout

This means I no longer have to define the AI riding on the tank and the player won't even notice they got replaced. It seemed like the perfect solution until I reached a problem: they're spawners.

This brings me to the bad news: I've hit another problem with AI. I want to spawn a new commander during the black screen and make him go to the player when he wakes up. To do this I used the getNode() and setGoalNode() functions to tell the newly spawned and defined AI where to go (AI moves from node-to-node). I gave my node a targetname, told the AI set that as his goal and... he ignores it. The AI goes to another node in the map and doesn't go to the one I set it's goal to. I just don't get it...


I've also realized that once all enemies are dead on the map then the AI goes to the goal node, which makes me even more confused. So I ask you all again for some help and some guidance because as you see scripting is starting to piss me off. Thank you, and here is some of my code during the player unconscious part: (Gunther is the AI I want to move to the node, ignore Huber for now)

player_shellShock()
{
	level.player shellshock("duhoc_boatexplosion", 12);
	wait(1.5);
	level.player allowCrouch(false);
	level.player allowStand(false);
	wait(1);

	introblack = newHudElem();
	introblack.x = 0;
	introblack.y = 0;
	introblack.horzAlign = "fullscreen";
	introblack.vertAlign = "fullscreen";
	introblack.foreground = true;
	introblack setShader("black", 640, 480);
	level.player freezeControls(true);

	wait(0.5);
	allies = getaiarray("allies");
	for(i=0; i<allies.size; i++)
		allies[i]delete();

	gunther1 = getent("gunther", "script_noteworthy");
	huber1 = getent("huber", "script_noteworthy");
	gunther2 = gunther1 dospawn();
	huber2 = huber1 dospawn();
	gunther2 setgoalnode(getnode("gunther_gets_player", "targetname"));

	wait(4);
	introblack destroy();
	level.player freezeControls(false);
	level.player allowCrouch(true);
	level.player allowStand(true);
}
Comments
djole22lt
djole22lt

About the spawner problem, there is a function that makes them spawn even when the player sees the spawn point - stalingradspawn();

So you define all new AI spawners with a common targetname, something like newally, and in the script put this to make them spawn:

newally = getentarray("newally", "targetname");
for(i=0;i<newally.size;i++)
{
newally[i] stalingradspawn();
}

As for the gunther problem, I think you should replace all gunther2 lines with gunther1.

Reply Good karma Bad karma+2 votes
Spi-Hamentsios10
Spi-Hamentsios10

Yes, stalingradspawn(); is a good hint djole22lt gave you. It will work fine the way you directed it in this article. Just make sure your AIs will listen to the functions from that point on.

Reply Good karma Bad karma+3 votes
Spi-Hamentsios10
Spi-Hamentsios10

PEOPLE we worked on it today me and rr016 and I found a way to make it work for him. Problem solved! :D

Reply Good karma Bad karma+3 votes
rr016 Author
rr016

Indded, [SOLVED] it is. Expect news update soon...

Reply Good karma+4 votes
rr016 Author
rr016

Ok so now AI can spawn without caulk walls to hide from player, but the AI still ignore my command to move to a node! My rewritten script:

gunther = getent("gunther", "script_noteworthy");
huber = getent("huber", "script_noteworthy");
gunther = gunther stalingradspawn();
huber = huber stalingradspawn();
gunther setgoalnode(getnode("gunther_gets_player", "targetname"));

Reply Good karma+4 votes
djole22lt
djole22lt

Well, make sure that the node has NOT_CHAIN selected in the entity window.

I know that forgetting to do this made these kind of errors when I did maps.

Reply Good karma Bad karma+2 votes
Guest
Guest

This comment is currently awaiting admin approval, join now to view.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Report Profile
Icon
Call of Duty 2
Creator
rr016
Contact
Send Message
Release date
Mod watch
Follow
News
Tags
cod2
Browse
News
New
Post news
Report
Report
Share
Related Games
Call of Duty 2
Call of Duty 2 First Person Shooter