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

Members Online

»
0 Active | 55 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: World at War
Category: CoDWW Scripting
Scripting and coding with Call of Duty: World at War.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Script Compile Error When Trying To Move Ships
{GITS}Cleaner
General Member
Since: May 23, 2006
Posts: 778
Last: Apr 23, 2011
[view latest posts]
Level 7
Category: CoDWW Scripting
Posted: Tuesday, Aug. 4, 2009 03:18 pm
I am only trying to move one ship at the moment, with no sound added, yet.

The script model is called ship1
Added to my mp_gits_harbor.gsc file:

maps\mp\_ships::main();

Added to the zone_source

rawfile,maps/mp/_ships.gsc

Added to raw/maps/mp

_ships.gsc

Code:
main()
{
level thread ships();
}

ships()
{
level.shipSpeed = 60;

ships = getent ("ship1","targetname");

temp = getent (ship1.target,"targetname");
ships.dest = temp.origin;
ship1.start = ship1.origin;
ship1 show();

wait 300;

while (1)
{
ships thread embark();
wait 20;

}
}

embark()
{
//self playloopsound ("m_engines");

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

wait 360;

self.origin = self.start;

}


The error:

Error:
******* Server script compile error *******
Error: uninitialised variable 'ship1': (file 'maps/mp/_ships.gsc', line 12)
temp = getent (ship1.target,"targetname");
*
************************************
Database: Assets Sync Started
Database: Assets Sync Finished
dvar set cl_paused 0
dvar set long_blocking_call 0
dvar set sv_network_warning 0
dvar set cl_network_warning 0
dvar set loc_language 0
dvar set loc_forceEnglish 0
dvar set language english
dvar set com_errorTitle Error
dvar set com_errorMessage Server script compile error
uninitialised variable 'ship1'
temp = getent (ship1.target,"targetname");
(see console for details)

********************
ERROR: Server script compile error
uninitialised variable 'ship1'
temp = getent (ship1.target,"targetname");
(see console for details)
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoDWW Scripting
Posted: Tuesday, Aug. 4, 2009 04:45 pm
Try this:

Code:
temp = getent (ships.target,"targetname");
Share |
{GITS}Cleaner
General Member
Since: May 23, 2006
Posts: 778
Last: Apr 23, 2011
[view latest posts]
Level 7
Category: CoDWW Scripting
Posted: Tuesday, Aug. 4, 2009 05:02 pm
Thanks for the reply Demon, I now have this error:

Error:
******* Server script compile error *******
Error: uninitialised variable 'ship1': (file 'maps/mp/_ships.gsc', line 14)
ship1.start = ship1.origin;

************************************

uninitialised variable 'ship1'
ship1.start = ship1.origin;

The new script:

Code:
main()
{
level thread ships();
}

ships()
{
level.shipSpeed = 60;

ships = getent ("ship1","targetname");

temp = getent (ships.target,"targetname");
ships.dest = temp.origin;
ship1.start = ship1.origin;
ship1 show();

wait 300;

while (1)
{
ships thread embark();
wait 20;

}
}

embark()
{
//self playloopsound ("m_engines");

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

wait 360;

self.origin = self.start;

}


edited on Aug. 4, 2009 01:04 pm by The-Cleaner
Share |
scillman
General Member
Since: Nov 23, 2006
Posts: 360
Last: Sep 1, 2012
[view latest posts]
Level 5
Category: CoDWW Scripting
Posted: Tuesday, Aug. 4, 2009 05:23 pm
You needed to replace the ship1 with ships.
This should work fine ;).

Code:
main()
{
level thread ships();
}

ships()
{
level.shipSpeed = 60;

ships = getent ("ship1","targetname");

temp = getent (ships.target,"targetname");
ships.dest = temp.origin;
ships.start = ships.origin;
ships show();

wait 300;

while (1)
{
ships thread embark();
wait 20;

}
}

embark()
{
//self playloopsound ("m_engines");

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

wait 360;

self.origin = self.start;

}
Share |
scillman
General Member
Since: Nov 23, 2006
Posts: 360
Last: Sep 1, 2012
[view latest posts]
Level 5
Category: CoDWW Scripting
Posted: Tuesday, Aug. 4, 2009 05:46 pm
Sorry for the double post but I think this might work better!

It will get all the ships with targetname: ship. And it will move all the ships to their target, wich needs to be done in Radiant.

Code:
main()
{
  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].dest = ships[i].target; // The ship's his target (needs to be bounded in Radiant!)
    ships[i].start = ships[i].origin; // The ship's original origin

    ships[i] Show(); // Show the ship
    wait 300;

    while(1)
    {
      ships[i] moveTo(ships[i].dest, 60, 0.1, 0.1); // Move the ship to it's target

      wait 360;

      ships[i].origin = ships[i].start; // The ship will be placed on it's original orgin

      wait 20;
    }
  }
}
Share |
{GITS}Cleaner
General Member
Since: May 23, 2006
Posts: 778
Last: Apr 23, 2011
[view latest posts]
Level 7
Category: CoDWW Scripting
Posted: Thursday, Aug. 6, 2009 02:14 pm
The ships don't move for some reason, and can I give them all the targetname of ship instead of ship1 ship2 etc:?

This code is working with no errors, and the ship moves:



Code:
main()
{
level thread ships();
}

ships()
{
level.shipSpeed = 60;

ship1 = getent ("ship1","targetname");

temp = getent (ship1.target,"targetname");
ship1.dest = temp.origin;
ship1.start = ship1.origin;
ship1 show();

wait 30;

while (1)
{
ship1 thread embark();
wait 20;

}
}

embark()
{
//self playloopsound ("m_engines");

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

wait 180;

self.origin = self.start;

}
Share |
scillman
General Member
Since: Nov 23, 2006
Posts: 360
Last: Sep 1, 2012
[view latest posts]
Level 5
Category: CoDWW Scripting
Posted: Thursday, Aug. 6, 2009 05:36 pm
1. Open up Radiant.
2. Place some ships (script_model not misc_model)
3. Select all the ships, press 'N' and give them all "targetname" "ship"
4. Place script_origin's on the places were each ship needs to move to.
5. Select the ship then select his script_origin and press 'W' to connect them (You'll see it in Radiant!). Do this for all ships!
6. This is the the total gsc file for the mp_mymapname_ships.gsc:
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 360;
    
    self.origin = self.start;
    
    wait 20;
  }
}


7. Now it should work, let's try it out ;)!

edited on Aug. 6, 2009 01:37 pm by scillman
Share |
{GITS}Cleaner
General Member
Since: May 23, 2006
Posts: 778
Last: Apr 23, 2011
[view latest posts]
Level 7
Category: CoDWW Scripting
Posted: Thursday, Aug. 6, 2009 07:42 pm
Thanks again for the reply scillman[wink]

I don't have time now, but I'll try this in the morning.
You said save it as mp_mymapname_ships.gsc
Which folder should I save this in please, raw/maps/mp?
The file that I've been using was saved as _ship.gsc in the raw/maps/mp

Thanks again [wink]

edited on Aug. 6, 2009 03:48 pm by The-Cleaner
Share |
scillman
General Member
Since: Nov 23, 2006
Posts: 360
Last: Sep 1, 2012
[view latest posts]
Level 5
Category: CoDWW Scripting
Posted: Friday, Aug. 7, 2009 09:04 am
Well you can place it in _ships.gsc to ;)
Share |
{GITS}Cleaner
General Member
Since: May 23, 2006
Posts: 778
Last: Apr 23, 2011
[view latest posts]
Level 7
Category: CoDWW Scripting
Posted: Friday, Aug. 7, 2009 09:13 am
I put it in raw/maps/mp using the file name you gave me, and works great [wink]

But the ships get half way across the map then disapear and spawn in their original position again, is it this setting I need to change?

self moveTo( self.dest, 60, 0.1, 0.1 );

And I changed this from:

wait 360;

to:

wait 360;

So the ships start to move after 30 seconds.


Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty: World at War : CoDWW 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

»