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

Members Online

»
0 Active | 90 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 MP Mapping
CoD 2 mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page Next Page
subscribe
Author Topic: When making maps, can ur teammates never die?
sam_fisher3000
General Member
Since: Apr 18, 2007
Posts: 816
Last: Jul 16, 2016
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Monday, Nov. 26, 2007 11:46 pm
LoL, go ahead and ask, I dont mind, I am wondering wut scripting is for anyway too.
Share |
Scratchy
General Member
Since: Feb 10, 2006
Posts: 276
Last: Mar 16, 2009
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Tuesday, Nov. 27, 2007 12:16 am
sam_fisher3000 writes...
Quote:
LoL, go ahead and ask, I dont mind, I am wondering wut scripting is for anyway too.


I understand the script, just the thing has been throwing me off as I look at the stock files too.


I can further clearify what I do know for you...

This script can be applied 2 ways.

1)In your Map GSC

-You can just slap this straight into your Maps GSC. Just make sure you have a Main() function, and call (thread ally_nodamage();) for your ally_nodamage() inside your main() function.

2)In an external file, that is called from withing your Map GSC

-You can make a seperate GSC file and name it what ever you want, and slap this script into there as is. Then in your Maps GSC you just call for the script (map\mp\magicscript::main();) in your Main() function.

As for the script its self...


Code:
main()

//^This is the begining for every script in CODscript^

{
Code:
thread ally_nodamage();

//^This calls the ally_nodamage function in this script^

}

Code:
ally_nodamage()

//^This is where the ally_nodamage function starts^

{
Code:
allyteam =getentarray ("ally", "targetname");

//^This make a new variable (allyteam), that equals all entities with the target name ally^
Code:

for(i=0;i<allyteam.size;i++)

//^unsure what this will do, but its a form of a loop^
Code:

allyteam[i/] thread maps\_utility::magic_bullet_shield();

//^this makes variable allyteam run the script _utility and start at the magic_bullet_shield() function^

}
Share |
sam_fisher3000
General Member
Since: Apr 18, 2007
Posts: 816
Last: Jul 16, 2016
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Tuesday, Nov. 27, 2007 12:56 am
So ur saying that I can make more than one gsc file.

This is my first one

main()
{
maps\_load::main();

level.player takeallweapons();
level.player giveWeapon("m1carbine");
level.player giveWeapon("thompson");
level.player giveWeapon("fraggrenade");
level.player switchToWeapon("thompson");

}



My second one is


main()
{
thread ally_nodamage();
}

ally_nodamage()
{
allyteam =getentarray ("ally", "targetname");
for(i=0;i allyteam thread maps\_utility::magic_bullet_shield();
}


However, doesnt these two files have the same name or else it wouldnt work? U cant have the same name or else one will replace the other. So well, ur saying that I make another gsc file and apply "(map\mp\magicscript::main();) in your Main() function". I will have to apply it at the beginning right? Then the rest is something else right? I hope I am right.


Share |
TexasRebel
General Member
Since: May 1, 2006
Posts: 373
Last: Aug 20, 2013
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Tuesday, Nov. 27, 2007 12:57 am
for(i=0;i
the first part of the for loop declares a new variable i and sets it to 0. The second part is a logic comparsion, if i is less than the size of allyteam, then execute the loop. The last part increments i by 1.

Say ally team is 5.

then first time through it would execute the code after the for loop, then at the end i=i+1, so i would now hold the value of 1. It would keep performing this until i
Hope this helps if not I can write ya what my intro c++ class book said a year ago.
Share |
sam_fisher3000
General Member
Since: Apr 18, 2007
Posts: 816
Last: Jul 16, 2016
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Tuesday, Nov. 27, 2007 01:02 am
Lol, it's confusing. Anyway, thanx for helping. All right, TexasRebel I need more clarification. I need to know more. I dont get the variable i or wutever. The team ally is 5, I dont get that either. So I hope that u guys can clearly explain wut they are. Also, I mentioned above about the 2 diferent scripts, do I put them together or seperate them? Plz help. If I put them together, how do I do it? Plz help. I am hoping I can get this map done and I will uploaded it and everyone can play. Thanx again in advance.
Share |
Scratchy
General Member
Since: Feb 10, 2006
Posts: 276
Last: Mar 16, 2009
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Tuesday, Nov. 27, 2007 02:09 am
sam_fisher3000 writes...
Quote:
So ur saying that I can make more than one gsc file.

This is my first one

main()
{
maps\_load::main();

level.player takeallweapons();
level.player giveWeapon("m1carbine");
level.player giveWeapon("thompson");
level.player giveWeapon("fraggrenade");
level.player switchToWeapon("thompson");

}



My second one is


main()
{
thread ally_nodamage();
}

ally_nodamage()
{
allyteam =getentarray ("ally", "targetname");
for(i=0;i allyteam thread maps\_utility::magic_bullet_shield();
}


However, doesnt these two files have the same name or else it wouldnt work? U cant have the same name or else one will replace the other. So well, ur saying that I make another gsc file and apply "(map\mp\magicscript::main();) in your Main() function". I will have to apply it at the beginning right? Then the rest is something else right? I hope I am right.




Ok look. You have your Maps GSC, which is named after your map, and is runned when your map is runned. You make another GSC (call it watever you want to) and then call it from your Maps GSC. So here i what it should look like...

main()
{
maps\_load::main();
maps\mp\magic::main();

level.player takeallweapons();
level.player giveWeapon("m1carbine");
level.player giveWeapon("thompson");
level.player giveWeapon("fraggrenade");
level.player switchToWeapon("thompson");

}

^^This one is named after your map^^

Now you have a second GSC file named magic and in it is this...

main()
{
thread ally_nodamage();
}

ally_nodamage()
{
allyteam =getentarray ("ally", "targetname");
for(i=0;i allyteam thread maps\_utility::magic_bullet_shield();
}

And make sure you have your actors with the targetname ally

edited on Nov. 26, 2007 09:10 pm by Scratchy
Share |
TexasRebel
General Member
Since: May 1, 2006
Posts: 373
Last: Aug 20, 2013
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Tuesday, Nov. 27, 2007 02:59 am
i was just trying to give an example of how the for loop works. i is just a dummy variable or counter in this case for the FOR loop.

allyteam.size will be as large as the number of entities you give with the name ally.


Code:

main()   
{
maps\_load::main();

level.player takeallweapons();
level.player giveWeapon("m1carbine");
level.player giveWeapon("thompson");
level.player giveWeapon("fraggrenade");
level.player switchToWeapon("thompson");
thread ally_nodamage();   //  executes ally_nodamage() function 
}

ally_nodamage()   // function created by user to keep AI alive
{
//creates new variable and makes it an array to hold entities with     the name ally.
allyteam =getentarray ("ally", "targetname"); 
for(i=0;i<allyteam.size, i++)
{
allyteam thread maps\_utility::magic_bullet_shield();
}
}



that can all be in just one gsc file. Not really sure how to explain it, everything everyone has said should work.

edited on Nov. 26, 2007 10:00 pm by |TM|TexasRebel
Share |
94sniper
General Member
Since: Jun 15, 2007
Posts: 907
Last: Jun 22, 2009
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Tuesday, Nov. 27, 2007 03:26 am
.KiLL3R. writes...
Quote:

u cant hack on SP [lol]


with infinite health yeah you can. change the weapon files to your wants. there are lots of ways to hack on sp

By the Way: Haxr = hacker
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD2 MP Mapping
Posted: Tuesday, Nov. 27, 2007 06:31 am
hacking the computer [crazy] anyways...

Code:
allyteam =getentarray ("ally", "targetname");
for(i=0;i<allyteam.size;i++)
allyteam[i] thread maps\_utility::magic_bullet_shield();


FOR can also be used just to loop 3 times and so on

Code:
for(i=0;i<3;i++)
{
self.health++;
wait 1; //loops once a second for 3 times
}


stuff like break; and continue; are useful
break; breaks the loop xD
continue; makes it go to the next loop
those things can also be used with while()

Code:
while(1)
{
if(self.health > 100)
{
wait 0.1;
continue;
}

if(self.sessionstate != "playing")
break;

self.health++;
wait 0.1;
}
Share |
Scratchy
General Member
Since: Feb 10, 2006
Posts: 276
Last: Mar 16, 2009
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Tuesday, Nov. 27, 2007 11:07 am
I see now. Your using the counter to access every entity in the array, and then apply the script to it. Ive been doing this in my programming class, but its in another language so it was hard make the "translation"

Im also gonna guess that using "++" will increament the variable by 1? Instead of writing out i=i+1 you just add the double plus signs?

And while we are still on the subject (been looking at stock scripts with confused eyes). While(1) just runs the loop nonstop, or until break or continue?

Originally Posted by 94Sniper
Quote:
with infinite health yeah you can. change the weapon files to your wants. there are lots of ways to hack on sp

By the Way: Haxr = hacker


Haxors are Whackzors

edited on Nov. 27, 2007 06:10 am by Scratchy
Share |
Restricted Access Topic is Locked
Page
Previous Page Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 MP Mapping

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

»