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

Members Online

»
0 Active | 22 Guests
Online:

LATEST FORUM THREADS

»
run artillery on maps
CoD+UO Map + Mod Releases
Call of DutyŽ: WWII
CoD WW2 General

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 SP Mapping
Call of Duty 2 single player mapping, scripting and everything single player.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: What is wrong with this .gsc??!
ivan_cro
General Member
Since: Jul 21, 2008
Posts: 463
Last: Oct 27, 2010
[view latest posts]
Level 5
Category: CoD2 SP Mapping
Posted: Monday, Nov. 23, 2009 11:45 am
Ok. This freaking problem is bugging me like for days...This is my .gsc. As I cant proceed with tiger, beacuse there was no answer on my previous topic, I did something with sherman. Now sherman is shooting. I have set up:

SHERMAN -> TARGETNAME - SHERMAN
SCRIPT_ORIGIN -> TARGETNAME - TANK_SHOOT

(The origin where the tank will shoot to)

Now! Everything should work properly beacuse everything is set properly. Something is wrong in tank_shoot() part.
This is my .gsc which was exchanged version, the one that techno2sl give me, this is a shorter version:

Code:
#include maps\_utility;


main()
{
	setExpFog(0.00015, 0.15, 0.14, 0.13, 0);
	setCullDist (4500);

	maps\_flak88::main("xmodel/german_artillery_flak88_nm");
	maps\_tiger::main("xmodel/vehicle_tiger_woodland_brush");
	maps\_sherman::main("xmodel/vehicle_american_sherman");
	maps\_load::main();
	maps\_mortarteam::main();
	maps\sptestmap_fx::main();
	ambientPlay("ambient_sptestmap");

	//thread firesound();
	thread tank_shoot();

	level.player takeallweapons();
	level.player giveWeapon("colt");

	level.player takeallweapons();
	level.player giveWeapon ("m1garand");
	level.player giveWeapon ("thompson");
	level.player giveWeapon ("fraggrenade");
	level.player switchToWeapon ("m1garand");

	maps\_vehicle::scripted_spawn(1);

	// Playername: Multiple tank script
	// Alright, so, since we have more than one entity with the script_noteworthy of "vehicle" we use "getEntArray()"
	level.vehicle = getEntArray("vehicle", "script_noteworthy");

	// Now, level.vehicle is not an "array" of all of the entities, or tanks.
	// What I am going to do is "loop" through all of the tanks to start their paths.
	for(i=0;i<level.vehicle.size;i++)
	{
		vehicle = level.vehicle[i];
		
		path = getvehiclenode(vehicle.target, "targetname");

		vehicle attachPath(path);

		wait .5;

		vehicle startPath();

		vehicle waittill("reached_end_node");
		vehicle notify ("unload");
	}
}

tank_shoot()
{

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

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

sherman setTurretTargetEnt ("tank_shoot","targetname");
//i also tryed this with coordinates, not working

sherman waittill ("reached_end_node");

wait(3);

sherman FireTurret();

}

/*firesound()
{
	firesound = getent("bigfire","targetname"); 
	firesound PlayLoopSound("bigfire");
}*\


This is what error says:

Code:
******* script runtime error *******
undefined is not an entity: (file 'maps/sptestmap.gsc', line 60)
sherman setTurretTargetEnt ("tank_shoot","targetname"); *
called from:
(file 'maps/sptestmap.gsc', line 17)
 thread tank_shoot();
        *
started from:
(file 'maps/sptestmap.gsc', line 3)
main()
*
************************************
Error during initialization:
script runtime error
(see console for details)
(file 'maps/sptestmap.gsc', line 3)


This is the problem:


undefined is not an entity: (file 'maps/sptestmap.gsc', line 60)
sherman setTurretTargetEnt ("tank_shoot","targetname");



WHY?! What is the problem? I have set up every targetname, I did everything as I should.

Thank you!

IvanFilip [banghead] [duh]
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: CoD2 SP Mapping
Posted: Monday, Nov. 23, 2009 01:13 pm
Take off the quote marks around tank_shoot, and leave out "targetname" as the 2nd argument in setTurretTargetEnt( , ) is an offset.

So, have this:

Code:
sherman setTurretTargetEnt ( tank_shoot );
Share |
ivan_cro
General Member
Since: Jul 21, 2008
Posts: 463
Last: Oct 27, 2010
[view latest posts]
Level 5
Category: CoD2 SP Mapping
Posted: Monday, Nov. 23, 2009 01:46 pm
IT works! thank YOU!! :DDDD [biggrin] [biggrin] THX!!

ivanfilip

p.s. u got steam account, if i may add you on? i got mw2 :D
Share |
ivan_cro
General Member
Since: Jul 21, 2008
Posts: 463
Last: Oct 27, 2010
[view latest posts]
Level 5
Category: CoD2 SP Mapping
Posted: Monday, Nov. 23, 2009 01:50 pm
Or not... I set /* and *\ on that part of code, i was experimenting, and i forgot to remove them to try out your new code , thats why i thought its working, but it didnt shoot.

now i removed them and its not working, again the same error.

ivanfilip
Share |
ivan_cro
General Member
Since: Jul 21, 2008
Posts: 463
Last: Oct 27, 2010
[view latest posts]
Level 5
Category: CoD2 SP Mapping
Posted: Tuesday, Nov. 24, 2009 01:38 am
HELP??? anyone??? [banghead] [banghead]
Share |
jeannotvb
General Member
Since: Dec 8, 2007
Posts: 620
Last: Feb 1, 2010
[view latest posts]
Level 6
Im a fan of MODSonair
Category: CoD2 SP Mapping
Posted: Tuesday, Nov. 24, 2009 03:40 am
That script is way too long for simply spawning a tank and letting it shoot - it can be much easier.

For spawning the tank you should use a trigger within Radiant.
You must tell the script to wait until the tank has spawned then define it and tell it to shoot at something.
If you tell the tank to shoot at something when you haven't properly defined it you will get "undefined is not an entity".

I use this in CoD4 which tells the game to wait until vehicle has spawned if it was not defined properly:

Code:

if( !isDefined( level.t72 ) )
{
	level.t72 = maps\_vehicle::waittill_vehiclespawn( "t72" );
	level notify( "t72_has_spawned" );
}


You can remove the notify if you want, replace level.t72 with the name of your tank and replace t72 in line 3 with the targetname of your tank.
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 SP Mapping
Posted: Tuesday, Nov. 24, 2009 06:42 am
DemonSeed hit it right on the nail. setTurretTargetEnt() uses an entity directly. If you wanted to do it the other way, you would have to do it like this:
setTurretTargetEnt(getEnt("tank_shoot", "targetname"));
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 |
ivan_cro
General Member
Since: Jul 21, 2008
Posts: 463
Last: Oct 27, 2010
[view latest posts]
Level 5
Category: CoD2 SP Mapping
Posted: Tuesday, Nov. 24, 2009 10:08 am
it is NOT WORKING! [banghead]

i tryyyed this but nooo: sherman setTurretTargetEnt(getEnt("tank_shoot", "targetname"));

chesus christ
Share |
ivan_cro
General Member
Since: Jul 21, 2008
Posts: 463
Last: Oct 27, 2010
[view latest posts]
Level 5
Category: CoD2 SP Mapping
Posted: Tuesday, Nov. 24, 2009 10:14 am
oh srry guys..
i actually was so nervous i didnt saw jeannots post..

:)
Share |
ivan_cro
General Member
Since: Jul 21, 2008
Posts: 463
Last: Oct 27, 2010
[view latest posts]
Level 5
Category: CoD2 SP Mapping
Posted: Tuesday, Nov. 24, 2009 10:21 am
BAD SYNTAX???

******* script compile error *******
bad syntax: (file 'maps/sptestmap.gsc', line 70)
if( !isDefined( level.sherman ) )
*

omg what the hell is happening with my map...chesus
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 SP 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

»