Author |
Topic: moving stuff script help. |
magdoom |
General Member Since: May 4, 2006 Posts: 172 Last: Nov 8, 2006 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Friday, Aug. 4, 2006 04:13 am |
|
I get the "bad syntax error when I use this script..
I place it in the maps\mp\ folder.
the gsc is:
Code:
main()
{
maps\mp\newmap::main();
maps\mp\movingplatform;
maps\mp\_load::main();
setExpFog(0.0001, 0.55, 0.6, 0.55, 0);
// setCullFog(0, 16500, 0.55, 0.6, 0.55, 0);
ambientPlay("ambient_france");
game["allies"] = "american";
game["axis"] = "german";
game["attackers"] = "allies";
game["defenders"] = "axis";
game["american_soldiertype"] = "normandy";
game["german_soldiertype"] = "normandy";
setCvar("r_glowbloomintensity0", ".25");
setCvar("r_glowbloomintensity1", ".25");
setcvar("r_glowskybleedintensity0",".3");
}
. I do believe i called upon it correctly.
Now the script to move the platform is::
Code:
main()
{
thread platform();
}
platform()
{
platform = getent ("platform","targetname");
trig = getent ("platform_trigger","targetname");
while(1);
{
trig waittill ("trigger");
platform movez (-612, 10, 4, 4);
platform waittill ("movedone");
trig waittill ("trigger");
platform movez (612, 10, 4, 4);
platform waittill ("movedone");
}
}
-edit- sry.. did a double-paste
please note. I'm still new at this scripting thing. so go ez on me :P
Thanks,
-Mag-DooM
edited on Aug. 4, 2006 12:17 am by magdoom
edited on Aug. 4, 2006 12:17 am by magdoom |
|
|
|
veef |
General Member Since: Apr 25, 2006 Posts: 1258 Last: Aug 29, 2006 [view latest posts] |
|
|
|
magdoom |
General Member Since: May 4, 2006 Posts: 172 Last: Nov 8, 2006 [view latest posts] |
|
|
|
sentchy |
General Member Since: May 6, 2006 Posts: 212 Last: Oct 31, 2006 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Friday, Aug. 4, 2006 12:19 pm |
|
Question: Do you have two GSC files and what are their names? As veef suggested if you have two GSC files and want to call a function in the second GSC from the main GSC file, there is a certain syntax to follow. This is basically the name of the GSC and its location without the GSC, followed by double colon and then the name of the function in the second GSC.
In your example if the second GSC file is located in the maps\mp folder with the name "platform.gsc', then the correct way to call a function main in this second GSC would be: "maps\mp\platform::main();". If the name of the second GSC is doplatforms.gsc and it is located only in the maps directory, then the call would be "maps\doplatforms:main();".
Alternatively just place everything in your primary GSC file. The changes I made is basically copy both code samples you gave together, changed the function name of main in the second to handleplatforms and place the call to handleplatforms at the end of the main routine of the map just to make sure all standard code is started up first which I consider safer when dealing with moving objects:
Code: main()
{
maps\mp\newmap::main();
// maps\mp\movingplatform; We call this at the end of main
maps\mp\_load::main();
setExpFog(0.0001, 0.55, 0.6, 0.55, 0);
// setCullFog(0, 16500, 0.55, 0.6, 0.55, 0);
ambientPlay("ambient_france");
game["allies"] = "american";
game["axis"] = "german";
game["attackers"] = "allies";
game["defenders"] = "axis";
game["american_soldiertype"] = "normandy";
game["german_soldiertype"] = "normandy";
setCvar("r_glowbloomintensity0", ".25");
setCvar("r_glowbloomintensity1", ".25");
setcvar("r_glowskybleedintensity0",".3");
// Kick off the threads for handling moving platforms. Use a threaded call so you can add more lines after this safely.
thread handleplatforms();
}
handleplatforms()
{
thread platform();
}
platform()
{
platform = getent ("platform","targetname");
trig = getent ("platform_trigger","targetname");
while(1);
{
trig waittill ("trigger");
platform movez (-612, 10, 4, 4);
platform waittill ("movedone");
trig waittill ("trigger");
platform movez (612, 10, 4, 4);
platform waittill ("movedone");
}
}
edited on Aug. 4, 2006 08:20 am by sentchy |
|
|
|
The_Caretaker |
General Member Since: Jun 8, 2004 Posts: 11625 Last: Jul 7, 2009 [view latest posts] |
|
|
|
magdoom |
General Member Since: May 4, 2006 Posts: 172 Last: Nov 8, 2006 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Friday, Aug. 4, 2006 10:14 pm |
|
Ok, the line
maps\mp\newmap::main()
isnt doing anything. It was a mistake on a line, but i have tried running the map with it, but without the one to call the movingplatform.gsc file, and it worked perfectly, so this isnt causing the problem. I will, however, remove this line.
When i hold shift and bring down the console, it tells me this::
*****************
Bad Syntax
******************
From my experience with this error, its telling me that i have input an invalid function, or character into the script, but I have not found anything like it while looking over my scripts.
Other than that, the console tells me the warnings it always tells me when loading or disconnecting from my hosted server.
Maybe ill try rewriting the script?
Thanks for all the help. I hope we can get this solved. ;) |
|
|
|
magdoom |
General Member Since: May 4, 2006 Posts: 172 Last: Nov 8, 2006 [view latest posts] |
|
|
Category: CoD2 MP Mapping Posted: Saturday, Aug. 5, 2006 12:23 am |
|
I've solved the "Bad Syntax" error. I had a repeating block not stated correctly or something like that. (my bro helped a lil)
Now im having problems with making my platform wait to be triggered.
In my map, i have a script brushmodel with
key/value
targetname/platform
and I have 2 triggers with:
targetname/platform_trigger
target/platform
This is my new script::
Code: main()
{
thread platform();
}
platform()
{
platform = getent ("platform","targetname");
trig = getentarray ("platform_trigger","targetname");
while(1) //last time i had a ; right after while(1).
{
trig waittill ("trigger");
platform waittill ("trig");
platform movez (-612, 10, 4, 4);
platform waittill ("movedone");
trig waittill ("trigger");
platform waittill ("trig");
platform movez (612, 10, 4, 4);
platform waittill ("movedone");
}; //I needed the ; right here.
}
For some reason, this script wont wait for the trigger...
With the setup its at right now, it doesnt move.
with this setup
Code: main()
{
thread platform();
}
platform()
{
platform = getent ("platform","targetname");
trig = getentarray ("platform_trigger","targetname");
while(1)
{
trig waittill ("trigger");
platform movez (-612, 10, 4, 4);
platform waittill ("movedone");
trig waittill ("trigger");
platform movez (612, 10, 4, 4);
platform waittill ("movedone");
};
}
It just goes on continuously up and down...
Any ideas?
-How can I make the script wait for the trigger to be activated ingame?
edited on Aug. 4, 2006 08:25 pm by magdoom |
|
|
|
sentchy |
General Member Since: May 6, 2006 Posts: 212 Last: Oct 31, 2006 [view latest posts] |
|
|
|
magdoom |
General Member Since: May 4, 2006 Posts: 172 Last: Nov 8, 2006 [view latest posts] |
|
|
|