Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 105 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: How do I spawn 100 actors?
dktekno
General Member
Since: May 29, 2005
Posts: 149
Last: Feb 15, 2008
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Monday, Jul. 9, 2007 03:40 pm
COD2 can only handle 32 players at a time, and I get an error telling me I have too many actors if all my actors have unique targetnames.

The 33rd actor causes trouble.

So I got this idea:

After a while in combat, 16 of my own men have died in combat. When they have died, I want to spawn (in the script/gsc file only) a new actor.

This actor should get a weapon, and behave just like any other actor, but it should have its very own unique targetname.

The reason I don't want to use the common type of respawn when somebody dies, is because I want 32 allies in action at once, and when 16 of them have died, I want to insert 16 german in the trenches as my troops reach the german trenches.

So how do I spawn an actor through scripting only? And is it enough that one of my soldiers have just died, or do I have to delete some of them, to make room for new soldiers?

Is there any way for me to get 100 unique, individual soldiers with 100 individual "tasks" they all have to do, with 100 unique paths?

I can accept to have only 32 players at a time, but throughout the whole game, I want more than 100 soldiers. Unique individuals. Not just someone following their "ancestors" paths as they replace their ancestors (respawned actors).

I don't want respawn. I want one unique individual to die and then a new unique individual to spawn in his place, but with his very own task and path.
Share |
eganwotv
Deactivated Account
Since: May 28, 2007
Posts: 961
Last: Oct 31, 2010
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Monday, Jul. 9, 2007 03:54 pm
The best idea would to NOT script, I would do as follow.
1. Make the AI Enemy Character and give it a path to do etc.
2. Give it a targetname, stay with me here this should work.
3. Make a trigger brush, multiple, to spawn the character.
4. As for the Allied Soldier to die and the German to spawn make his health around 5 so he is guranteed death.

Thats how I would do it, but you could do scripting to, but it would take a littler bit longer, plus I've never done it.
Share |
Yorkshire-Rifles
General Member
Since: Mar 16, 2005
Posts: 272
Last: Apr 19, 2008
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Monday, Jul. 9, 2007 04:54 pm
Yes you can have 100 different AI doing 100 different things.
But you can only have 32 in-game at once.
So you need to kill them off.

Check out the "doom" thread in _utility.gsc for that, or just do a radiusdamage at the actor's origin.

For floodspawning through script check out this thread

For respawning to a friendly chain (friendly_wave) check out this thread

and for a simple script spawn use the doSpawn function.

e.g.
Code:
bob1 = getent("actors_name", "targetname/or script_noteworthy");
bob1 dospawn();

//or for a group

cleanback1 = getentarray ("the_actors", "script_noteworthy");
		for (i=0;i<cleanback1.size;i++)
		{
			if(isalive(cleanback1[i]))
			{
				cleanback1[i] dospawn();
				
			}
		}



Best to use script_noteworthy on AI spawners as this allows them to use more functions - like the doom thread.

e.g.
Code:
bob1 doom();

//or for a group

cleanback1 = getentarray ("the_actors", "script_noteworthy");
		for (i=0;i<cleanback1.size;i++)
		{
			if(isalive(cleanback1[i]))
			{
				cleanback1[i] doom();
				
			}
		}


Obviously you need triggers to get the 100 AI to spawn or doom at different times, and you'll have to co-ordinate it so that there are never more than 32 in-game at once.
Share |
dktekno
General Member
Since: May 29, 2005
Posts: 149
Last: Feb 15, 2008
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Monday, Jul. 9, 2007 06:44 pm
I can't see how I, in your code, can tell which actor it is gonna be. I Where in the code do you state wether it should be a german, british, american or russian? And which weapon to have?

You use the getent to get the actor's name, but this requires me to already have that actor ingame. I want to spawn a completely new soldier.

This is what I want:

I have 32 british soldiers.

1 get killed by a script (dodamage() function).

Now I want to spawn a german, with k98.
And I want to specify if he has a white coat (winter), is a normandy-soldier, or is dressed with a desert uniform.


edited on Jul. 9, 2007 02:47 pm by dktekno
Share |
Yorkshire-Rifles
General Member
Since: Mar 16, 2005
Posts: 272
Last: Apr 19, 2008
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Monday, Jul. 9, 2007 09:54 pm
Oh, I see.

Best not to select actor type via script - it is probably possible but seems like just making trouble for the sake of it.

Stick all your actors in the map in Radiant and check the spawner box for those that you don't want to start with. Then you can spawn them with script or an attaching trigger.

32 AI is the max - but even then the engine prefers less. If you are using forcespawners (forcespawners give the game a chance to delete AI if there are too many respawns) it will delete them long before the game has 32 active AI, just to keep the numbers down so the engine doesn't get too busy.

Try starting with less friendly AI - remember you need space for the badguys too.
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»