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

Members Online

»
0 Active | 100 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 subscribe
Author Topic: moving brushes error
mk3y20
General Member
Since: Mar 1, 2010
Posts: 4
Last: Mar 6, 2010
[view latest posts]
Level 0
Category: CoD2 MP Mapping
Posted: Monday, Mar. 1, 2010 09:06 am
i want a script that moves some brushes up and down this is the code:

Code:

main()
{
  thread start();
}

start()
{
   for(;;)
   thread move();
}


move()

{
   //wait 1;
   obj = getentarray("obj","targetname");
   time = 4;
   height = 44;
   obj movez (height, time);
   //obj playsound();
   wait 100;
   obj movez ((height) * -1, time);
   //obj playsound();
}

the error i get is :
array is not an entity

I think i get his error because my "obj" is a multibrushes entity
but i dont know what i've to do....

Share |
playername
Preferred Member
Since: Aug 24, 2006
Posts: 821
Last: Apr 15, 2011
[view latest posts]
Level 7
Forum Moderator
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Monday, Mar. 1, 2010 01:58 pm
Hello mk3y20 and welcome to MODSonline!

There are a few things that needs to be fixed.
First, you can get rid of the function "start()" If you are trying to get it to loop multiple times, just call "move()" at the bottom of the actual function to loop back.

Second, you are using "getEntArray()" on just one entity. You would use only "getEnt()" instead. If you have more than one entity/object you are trying to move, please tell us so we can help you out with moving more than one object.

Here, try this script:
Code:
move()
{
	//wait 1;
	obj = getEnt("obj", "targetname"); // Get a SINGLE object with the "targetname" of "obj"
	height = 44; // Move 44 units
	time = 4; // Move to height in 4 seconds

	obj movz(height, time); // Move object "height" units up in "time" seconds.

	wait 100; // Wait 100 seconds, or 1min and 40 seconds

	obj movez((height)*-1, time); // Move object "height" units down in "time" seconds.

	obj waittill("movedone"); // Wait until the object has completed it's move.

	// Repeat everything again by calling "move()" again.
	thread move();
}


Hope this helps!
nullFew tips for coding.
1. Keep the script as short as possible.
2. Don't comment every line. Only comment portions where they may be needed to point something out.
3. Don't over complicate the script, keep it organized and easy to read.

These help you find simple errors and makes it easy to make changes.
Share |
mk3y20
General Member
Since: Mar 1, 2010
Posts: 4
Last: Mar 6, 2010
[view latest posts]
Level 0
Category: CoD2 MP Mapping
Posted: Monday, Mar. 1, 2010 02:57 pm
thank u very much for the welcome and for the script that is good, but i wanna move multiple brushes so it doesnt work...
Share |
cskiller86
General Member
Since: Nov 23, 2009
Posts: 528
Last: Oct 25, 2011
[view latest posts]
Level 6
Category: CoD2 MP Mapping
Posted: Monday, Mar. 1, 2010 04:23 pm
Maybe you should describe what you want to do. I'm guessing the brushes are elevators, since you move them up and down (although the height is kind of small).
Do you want them to move at the same time or independently ? How will they be triggered ?

Anyway, you could try this:
Code:
main()
{
   obj = getentarray("obj","targetname");
   for(i=0; i<obj.size; i++)   
       obj[i] thread move();
}

move()
{
while (1)
   {
   time = 4;
   height = 44;
   self movez (height, time);
   wait 100;
   self movez ((height) * -1, time);
   }
}


The brushes will move independently, but start at the same time, since they are triggered when the map starts.
Share |
mk3y20
General Member
Since: Mar 1, 2010
Posts: 4
Last: Mar 6, 2010
[view latest posts]
Level 0
Category: CoD2 MP Mapping
Posted: Monday, Mar. 1, 2010 07:48 pm
thank you very much, the script works:
Code:

main()

{
   obj = getentarray("obj","targetname");
   for(i=0; i<obj.size; i++)   
   obj[i] thread start();
}

start()

{
   x = randomint(20); //get a random number
   wait(x); //wait the random number
   thread move(); //start move
}

move()

{
   obj = getentarray("obj","targetname"); //get entity
   time = 4;
   height = 44;
   self movez ((height) * -1, time); // move z axis -44 inch in 4 sec 
   wait 100; //wait 100 sec                            
   self movez (height, time); // move z 44 inch in 4 sec
   self waittill("movedone");  //wait the entity have finished move
   thread move(); //restart move()
}



i have just added a random number to wait for the bush start moving

edited on Mar. 1, 2010 03:14 pm by mk3y20
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

»