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

Members Online

»
0 Active | 4 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

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 subscribe
Author Topic: Snow problem
Lithium123
General Member
Since: May 29, 2007
Posts: 72
Last: Apr 6, 2010
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Saturday, Oct. 13, 2007 04:33 am
I'm trying to add snow to my mp map, and when I compile my map and go to run it, I get an error saying that there is bad syntax. the bad syntax supposedly is : "for(i = 0; i < players.size; i++)" . What is wrong here?
Share |
94sniper
General Member
Since: Jun 15, 2007
Posts: 907
Last: Jun 22, 2009
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Saturday, Oct. 13, 2007 04:50 am
for(i = 0; i < players.size; i++)

pretty sure the part highlighted is the problem. I just picked that up somewhere.
Share |
macklebee
General Member
Since: Dec 6, 2006
Posts: 104
Last: Aug 24, 2008
[view latest posts]
Level 4
Category: CoD2 MP Mapping
Posted: Saturday, Oct. 13, 2007 06:18 am
@94sniper
[confused]

@lithium123

please post your script here so we can see what could be causing the problem...

what's directly above that line in your script?

typically the array/for loop is written like this:

Code:
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{


make sure the semicolon is behind the getentarray line and (don't know for sure that this will cause the problem) that the brace '{' is behind the for-loop.

edited on Oct. 13, 2007 02:23 am by macklebee
Share |
TexasRebel
General Member
Since: May 1, 2006
Posts: 373
Last: Aug 20, 2013
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Saturday, Oct. 13, 2007 06:24 am
you just reposted what he wrote for his FOR loop ( not shouting, just trying to differentiate between the two fors).

Lithium have you defined what players is, or did you just throw the for loop into your script?

Also could you post your entire code for me to view and the error where it says the line it would be on or near. In coding sometimes it says one line, but it could be a line above or below that is causing the error, especially with semi-colons.


In a for loop:

i = 0 declares a variable

i < players.size tells how long it will loop around,i.e. so long as i is less than players.size

i++ increments by 1 each time it loops to the start. i=0 at beginning . . . after first run through i = 1.
Share |
Lithium123
General Member
Since: May 29, 2007
Posts: 72
Last: Apr 6, 2010
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Saturday, Oct. 13, 2007 07:08 pm
Rasta's script from the tutorial:

Code:
//Script by rasta, please credit if used 
main() 
{ 
level thread rasta_cod2_rain(); 
} 

rasta_cod2_rain() 

{ 
zufall = RandomInt(100); 

while(1) { 


players = getentarray("player", "classname"); 

if(players.size > 0) 
{ 

max_nodes = 20; 
max_nodes_per_player = max_nodes/players.size; 


for(ii=0;ii

for(i = 0; i < players.size; i++) 
{ 

player = players[i]; 

if(isAlive(player)) { 

x= 350-randomfloat(700); 
y= 350-randomfloat(700); 

pos = player.origin +(x,y,200) ; 
trace = bulletTrace(pos,pos +(0,0,-250), true, undefined); 

if(trace["fraction"] != 1) playfx(level.rasta_cod2_rain,trace["position"]); 
wait 0.05; 

} 
} 
} 
} 

wait 0.05; 
} 
}
Share |
TexasRebel
General Member
Since: May 1, 2006
Posts: 373
Last: Aug 20, 2013
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Saturday, Oct. 13, 2007 07:39 pm
max_nodes = 20;
max_nodes_per_player = max_nodes/players.size;


for(ii=0;ii <----- This is the Error, it is not a complete for loop

for(i = 0; i < players.size; i++)
{



im not really sure what the loop is suppose to look like.
It could be

for(ii=0; ii < max_nodes_per_player;ii++)

not sure if this is what was meant there.
Share |
Lithium123
General Member
Since: May 29, 2007
Posts: 72
Last: Apr 6, 2010
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Saturday, Oct. 13, 2007 11:11 pm
well, I tried "for(ii=0; ii < max_nodes_per_player;ii++)", but that didn't work.
Share |
TexasRebel
General Member
Since: May 1, 2006
Posts: 373
Last: Aug 20, 2013
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Sunday, Oct. 14, 2007 04:39 am
try pming rasta about this, or i do believe there was an updated version posted somewhere on the forums, maybe in a topic someone else created. Its basically the rain script, just using snow.
Share |
Mystic
General Member
Since: Apr 10, 2004
Posts: 6147
Last: Apr 15, 2018
[view latest posts]
Level 10
Forum Moderator
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Wednesday, Oct. 17, 2007 06:29 pm
Hi guys. Sorry too keep you waiting. I'm pretty sure foyleman updated the tut for me with all the added bug fixes in the tutorial. This is caused by not copying the script correctly or copying it from a source which doesn't use the [c ode] boxes. Give me a min and ill take a look.

Edit. Ok guys check out this tutorial. http://www.modsonline.com/Tutorials-read-338.html
Everything should be working in there as i asked a buddy to run the script as its written (as im not currently on a computer with cod) and it appears to work fine.

edited on Oct. 17, 2007 02:32 pm by Rasta
Share |
Lithium123
General Member
Since: May 29, 2007
Posts: 72
Last: Apr 6, 2010
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Wednesday, Oct. 17, 2007 11:07 pm
sweet, problem fixed. thanks
Share |
Restricted Access Topic is Locked 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

»