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

Members Online

»
0 Active | 18 Guests
Online:

LATEST FORUM THREADS

»
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 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page
subscribe
Author Topic: Moving train
45king
General Member
Since: Aug 18, 2005
Posts: 101
Last: May 23, 2011
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Wednesday, Dec. 3, 2008 08:22 pm
Hi Marshall,

I did that, now am getting this error

http://www.metal-headz.co.uk/error.jpg
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Wednesday, Dec. 3, 2008 09:58 pm
getent only works if you use a unique targetname. but you got it 3 times, so either use different targetnames or use getentarray instead (recommended):

Code:
trains = getentarray("train", "targetname");

for (t = 0; t < trains.size; t++)
{
thread trains[t] do_something();
}

do_something()
{
// self will refer to a train entity
}
Share |
45king
General Member
Since: Aug 18, 2005
Posts: 101
Last: May 23, 2011
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Wednesday, Dec. 3, 2008 10:07 pm
If I use dif targetnames the trains at the back still overtake the ones at the front[banghead]

How would I alter this code? so I could use one targetname to see if that stops the prob.

Code:

main()
{

level thread planes();
}

planes()
{
level.PlaneSpeed = 21;

stuka1 = getent ("stuka1","targetname");
//stuka2 = getent ("stuka2","targetname");
//stuka3 = getent ("stuka3","targetname");

temp = getent (stuka1.target,"targetname");
stuka1.dest = temp.origin;
stuka1.start = stuka1.origin;
stuka1 hide();
//temp = getent (stuka2.target,"targetname");
//stuka2.dest = temp.origin;
//stuka2.start = stuka2.origin;
//stuka2 hide();
//temp = getent (stuka3.target,"targetname");
//stuka3.dest = temp.origin;
//stuka3.start = stuka3.origin;
//stuka3 hide();

wait 2;

while (1)
{
stuka1 thread plane_flyby("stuka_flyby");
//wait .15;
//stuka2 thread plane_flyby("stuka_flyby");
//wait .15;
//stuka3 thread plane_flyby("stuka_flyby");

wait 60;
}
}


plane_flyby(sound)
{
// If you specified a sound to play then play it
if (isdefined (sound))
self playsound (sound);

wait 15;

self show();

self moveto(self.dest, level.PlaneSpeed, 0.1, 0.1);

wait level.PlaneSpeed;

self hide();
self.origin = self.start;
}






edited on Dec. 3, 2008 05:13 pm by 45king
Share |
45king
General Member
Since: Aug 18, 2005
Posts: 101
Last: May 23, 2011
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Wednesday, Dec. 3, 2008 10:27 pm
Am really beginning to think that its not possible.

I can get 10 train models moving at the same speed side by side with np, but as soon as I line them up together to make one train the overtake each other.

[drink][crazy][machine_gun]
Share |
codmp
General Member
Since: Feb 7, 2006
Posts: 905
Last: Aug 1, 2011
[view latest posts]
Level 7
Category: CoD4 Scripting
Posted: Thursday, Dec. 4, 2008 12:50 am
Why not decrease the speed of each train as you move down the line of cars.

For example:

Train 1 has a speed of 10
Train 2 has a speed of 8
Train 3 has a speed of 6
and so on..

To me it sounds like because they are going the same speed they are catching up to each other. Try slowing the speed of the trains and make it a little slower than the train in front of it and see if that works.
Share |
45king
General Member
Since: Aug 18, 2005
Posts: 101
Last: May 23, 2011
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Thursday, Dec. 4, 2008 03:25 am
codmp writes...
Quote:
To me it sounds like because they are going the same speed they are catching up to each other.


[ohwell]
Share |
45king
General Member
Since: Aug 18, 2005
Posts: 101
Last: May 23, 2011
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Thursday, Dec. 4, 2008 03:32 am
Its not the speeds in the script beacuse if there like this

http://www.metal-headz.co.uk/t1.bmp

they all arrive at the script origins at the same time without overtaking each other.

But if I line them up like this

http://www.metal-headz.co.uk/t3.bmp

The back train starts over taking the front trains nearly straght away with the same script.

http://www.metal-headz.co.uk/t4.bmp
Share |
Restricted Access Topic is Locked
Page
Previous Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 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

»