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

Members Online

»
0 Active | 66 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: stupid script :|
NotDeadYet
General Member
Since: Jan 5, 2009
Posts: 52
Last: Jul 28, 2009
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, Feb. 3, 2009 11:22 pm
ERROR:
unexpected end of file found

CODE:
Code:
main()
{
   thread elevator_start();
}

elevator_start()
{
   elevator = getentarray("elevator","targetname");

   while(1)
   {
      elevator movex(1000,15,2,2);
      elevator waittill("movedone");
      wait(5.0);
      elevator movex(-1000,15,2,2);
      elevator waittill("movedone");
   {
   
}


im really tired and dont have time to mess with this. help plz
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Wednesday, Feb. 4, 2009 06:48 am
The second to last bracket is a {, when you need a } to close it.
Share |
ChusGMh
General Member
Since: Oct 7, 2008
Posts: 65
Last: Oct 4, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Wednesday, Feb. 4, 2009 02:46 pm
Hmm just use my script and no more problem [crazy]


main()
{
thread elevator();
}

elevator()
{
elevator=getent("elevator","targetname");
trig=getent("trig_elevator","targetname");
while(1)
{
trig waittill ("trigger");
elevator movez (-250,7,1.9,1.9);
elevator waittill ("movedone");
wait(1);
elevator movez (250,7,1.9,5);
elevator waittill ("movedone");
}
}


If u have some problem post me [wave]
Share |
NotDeadYet
General Member
Since: Jan 5, 2009
Posts: 52
Last: Jul 28, 2009
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Wednesday, Feb. 4, 2009 10:56 pm
this isnt an elevator, i just named it an elevator for lack of words.
Share |
StrYdeR
General Member
Since: May 11, 2004
Posts: 11672
Last: Apr 20, 2024
[view latest posts]
Level 10
Admin
Forum Moderator
Im a HOST of MODSonair
Category: CoD2 Scripting
Posted: Thursday, Feb. 5, 2009 01:06 am
clanhelio is correct, you have a { instead of a }

you are also using the command 'getentarray' but not building the array

while it may work - it is sloppy coding and should either build the array or be changed to 'getent'

[angryalien]
Share |
NotDeadYet
General Member
Since: Jan 5, 2009
Posts: 52
Last: Jul 28, 2009
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Thursday, Feb. 5, 2009 01:26 am
that was one part of code i narrowed error down 2. i do have multiple objects and instantiating an array is required.

:P :P :P
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Thursday, Feb. 5, 2009 08:17 am
If you are using an array then you will need to loop through each element using a for loop to kick of a thread for each one.

ie.
Code:
elevator_start()
{
   elevator = getentarray("elevator","targetname");
   
   for(i=0; i < elevator.size; i++)
   {
      elevator[i] thread doStuff();
   }
}

doStuff()
{
   // Put your current while loop here
   // refer to the entity as 'self' instead of 'elevator'
   // or you can go elevator = self at the start of this function

}
Share |
NotDeadYet
General Member
Since: Jan 5, 2009
Posts: 52
Last: Jul 28, 2009
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Thursday, Feb. 5, 2009 10:05 pm
yea, i added that yesterday, but got an error, this fixes it though. thanks for reading my mind :)
Share |
Garthogg
General Member
Since: Jan 29, 2008
Posts: 21
Last: Feb 6, 2009
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Friday, Feb. 6, 2009 09:16 pm
Anyway:

http://www.modsonline.com/Tutorials-read-121.html

Quote:
Now, you are looking at this and saying “If I use getentarray() and only have 1 entity with the “targetname” of “xyz” – will it still work?”
The answer is YES…but if you use getent() and have several entities with the “targetname” of “xyz” the script will crash.
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

»