Author |
Topic: Script Compile Error When Trying To Move Ships |
scillman |
|
General Member Since: Nov 23, 2006 Posts: 360 Last: Sep 1, 2012 [view latest posts] |
|
|
|
{GITS}Cleaner |
General Member Since: May 23, 2006 Posts: 778 Last: Apr 23, 2011 [view latest posts] |
|
|
|
scillman |
|
General Member Since: Nov 23, 2006 Posts: 360 Last: Sep 1, 2012 [view latest posts] |
|
|
|
DeekCiti |
|
General Member Since: Mar 13, 2008 Posts: 1293 Last: Jul 9, 2016 [view latest posts] |
|
|
Category: CoDWW Scripting Posted: Friday, Aug. 7, 2009 05:46 pm |
|
The problem is your wait times. Since there are multiple scripts in this post, I have no idea which one you are using at the moment. But it sounds to me that, the object never gets to finish moving before you tell the script to loop again and move the object all over again. Sounds like a simple fix.
In the original script, you have a Speed which represents, how long the object takes, to get to its destination.
So in this case:
level.shipSpeed = 60; //Time it takes Ship to move full move
Here is an example of a Plane Flyover, the same Idea but with some comments so you know what does what. Use it as an example.
Code: main()
{
level thread planes();
}
planes()
{
level.PlaneSpeed = 10.5; //Time it takes Plane to move full move
ac130 = getent ("ac130_flyby","targetname");
temp = getent (ac130.target,"targetname");
ac130.dest = temp.origin;
ac130.start = ac130.origin;
ac130 hide();
wait (360); //Time Before FIRST Flyover
while (1)
{
ac130 thread plane_flyby("ac130_flyover"); //Sound alias
wait (1000); //Time before script loops again at playing sound
}
}
plane_flyby(sound)
{
if (isdefined (sound))
self playsound (sound);
wait (6); //Time after sound plays to move plane
self show();
self moveto(self.dest, level.PlaneSpeed, 0.1, 0.1);
wait level.PlaneSpeed;
self hide();
self.origin = self.start;
}
|
|
|
|
scillman |
|
General Member Since: Nov 23, 2006 Posts: 360 Last: Sep 1, 2012 [view latest posts] |
|
|
|
DeekCiti |
|
General Member Since: Mar 13, 2008 Posts: 1293 Last: Jul 9, 2016 [view latest posts] |
|
|
|
{GITS}Cleaner |
General Member Since: May 23, 2006 Posts: 778 Last: Apr 23, 2011 [view latest posts] |
|
|
Category: CoDWW Scripting Posted: Saturday, Aug. 8, 2009 08:34 am |
|
How would I add the self waittil("movedone"); to this script?
This is what I have at the moment:
Code: main()
{
level thread ships();
}
ships()
{
ships = getEntArray( "ship", "targetname" ); // Will get all the ships with ship as targetname
for(i = 0; i < ships.size; i++) // Run the following on all the entities with ship as targetname
{
ships[i] thread ship();
}
}
ship()
{
self endon( "disconnect" );
// I've done it this way so it will be correct in the game!
self.dest = (getEnt( self.target, "targetname" )).origin; // The ship's target origin
self.start = self.origin; // The ship's original origin
//wait 20; // Gave an error for some reason?!
while(1)
{
//self playLoopSound( "m_engines" );
self moveTo( self.dest, 60, 0.1, 0.1 );
wait 30;
self.origin = self.start;
wait 20;
}
}
Would it be possible for you to post the script your using to move the ships in your harbor? |
|
|
|
scillman |
|
General Member Since: Nov 23, 2006 Posts: 360 Last: Sep 1, 2012 [view latest posts] |
|
|
|
{GITS}Cleaner |
General Member Since: May 23, 2006 Posts: 778 Last: Apr 23, 2011 [view latest posts] |
|
|
|
{GITS}Cleaner |
General Member Since: May 23, 2006 Posts: 778 Last: Apr 23, 2011 [view latest posts] |
|
|
Category: CoDWW Scripting Posted: Saturday, Aug. 8, 2009 01:08 pm |
|
This is the script now, works great the ships now go all the way to the script_orign.
I tried to remove the part you said, but got an error, what should it be with the part you said remove?
Code: main()
{
level thread ships();
}
ships()
{
ships = getEntArray( "ship", "targetname" ); // Will get all the ships with ship as targetname
for(i = 0; i < ships.size; i++) // Run the following on all the entities with ship as targetname
{
ships[i] thread ship();
}
}
ship()
{
self endon( "disconnect" );
// I've done it this way so it will be correct in the game!
self.dest = (getEnt( self.target, "targetname" )).origin; // The ship's target origin
self.start = self.origin; // The ship's original origin
//wait 20; // Gave an error for some reason?!
while(1)
{
//self playLoopSound( "m_engines" );
self moveTo( self.dest, 60, 0.1, 0.1 );
self waittill( "movedone" );
self.origin = self.start;
wait 20;
}
} |
|
|
|