Shield

Script compile error when i press the button(trigger)

15 posts in this topic

Hey,

 

i scripted some shops at begin of my new map, after build files and run cod4 no error was coming, first when i pressed the button , it comes a script compile error at this line trigger waittill ("trigger",player).

 

My script :

main()
{
	thread door();
	thread spawnwave();
	thread shop1();
	thread shop2();
	thread shop3();
}

door()
{
	object = getEnt ("door","targetname");
	wait (14);
	iPrintLnBold ("^1Door is opening");
	object moveZ (200,6);
}

spawnwave()
{
	wave = getEnt ("wave","targetname");
	killtrigger = getEnt ("killwave","targetname");

	killtrigger enablelinkto ();
	killtrigger linkto(wave);

	wait(20);
	wave moveY (-3000,3);
	wave waittill ("movedone");
	wait(2);
	wave moveZ (-1200,3);
}

shop1()
{
	shop = getEnt ("shop1","targetname");
	trig = getEnt ("shop1_trig","targetname");
	trig sethintstring ("Buy whine here!");
	for(;;)
	{
		trig waittill ("trigger",player);
		self suicide();
	}
}

shop2()
{
	stand = getEnt ("stand","targetname");
	trig = getEnt ("stand_trig","targetname");
	trig sethintstring ("Buy a room here!");
	for(;;)
	{
		trig waittill ("trigger",player);
		self suicide();
	}
}

shop3()
{
	weap = getEnt ("shop2","targetname");
	trig = getEnt ("shop2_trig","targetname");
	trig sethintstring ("Buy a weapon here!");
	trig waittill ("trigger",player);
	iPrintLnBold ("Go away, Go away! Something will kill you!");
	wait(2);
	iPrintLnBold ("In:");
	wait(1);
	iPrintLnBold ("5");
	wait(1);
	iPrintLnBold ("4");
	wait(1);
	iPrintLnBold ("3");
	wait(1);
	iPrintLnBold ("2");
	wait(1);
	iPrintLnBold ("1");
	wait(1);
	iPrintLnBold ("The Bomb is exploded!");
} 

Hope for help.

 

 

Edited by AoKMiKeY
Please use the code tag when posting code
0

Share this post


Link to post
Share on other sites

Hey,

 

 

 

Please use the ["code"] (with out the " ) Tag for adding code to a thread.

0

Share this post


Link to post
Share on other sites

Hey,

 

 

As for the issue can you run developer 2 and give me a console log so I can see whats going on?

0

Share this post


Link to post
Share on other sites

BTW

for(i=5; i>0; i--)

iPrintLnBold(i);

Will print 5 to 0, much more efficient.

0

Share this post


Link to post
Share on other sites

Maybe you shouldn't try to suicide the level entity.

 

level thread shop1();
...
self suicide();
main()
{
    thread door();
    thread spawnwave();
    thread shop1();
    thread shop2();
    thread shop3();
}
 
door()
{
    object = getEnt("door", "targetname");
 
    wait 14;
 
    iPrintLnBold("^1Door is opening");
    object moveZ(200, 6);
}
 
spawnwave()
{
    wave = getEnt("wave", "targetname");
    killtrigger = getEnt("killwave", "targetname");
 
    killtrigger enablelinkto();
    killtrigger linkto(wave);
 
    wait 20;
 
    wave moveY(-3000, 3);
    wave waittill("movedone");
 
    wait 2;
 
    wave moveZ(-1200, 3);
}
 
shop1()
{
    shop = getEnt("shop1","targetname");
    trig = getEnt("shop1_trig","targetname");
    trig sethintstring("Buy whine here!");
 
    for (;;)
    {
        trig waittill("trigger", player);
        player suicide();
    }
}
 
shop2()
{
    stand = getEnt("stand","targetname");
    trig = getEnt("stand_trig","targetname");
    trig sethintstring("Buy a room here!");
 
    for (;;)
    {
        trig waittill("trigger", player);
        player suicide();
    }
}
 
shop3()
{
    weap = getEnt("shop2","targetname");
    trig = getEnt("shop2_trig","targetname");
    trig sethintstring("Buy a weapon here!");
    trig waittill("trigger", player);
 
    iPrintLnBold("Go away, Go away! Something will kill you!");
    wait 2;
 
    iPrintLnBold("In:");
    wait 1;
 
    for (i = 5; i >= 1; i--)
    {
        iPrintLnBold(i);
        wait 1;
    }
 
    iPrintLnBold("The Bomb is exploded!");
}
2

Share this post


Link to post
Share on other sites

My script now :

main()
{
	thread door();
	thread spawnwave();
	level thread shop1();
	level thread shop2();
	level thread shop3();
}

door()
{
	object = getEnt ("door","targetname");
	wait (14);
	iPrintLnBold ("^1Door is opening");
	object moveZ (200,6);
}

spawnwave()
{
	wave = getEnt ("wave","targetname");
	killtrigger = getEnt ("killwave","targetname");

	killtrigger enablelinkto ();
	killtrigger linkto(wave);

	wait(20);
	wave moveY (-3000,3);
	wave waittill ("movedone");
	wait(2);
	wave moveZ (-1200,3);
}

shop1()
{
	shop = getEnt ("shop1","targetname");
	trig = getEnt ("shop1_trig","targetname");
	trig sethintstring ("Buy whine here!");
	for(;;)
	{
		trig waittill ("trigger",player);
		self suicide();
	}
}

shop2()
{
	stand = getEnt ("stand","targetname");
	trig = getEnt ("stand_trig","targetname");
	trig sethintstring ("Buy a room here!");
	for(;;)
	{
		trig waittill ("trigger",player);
		self suicide();
	}
}

shop3()
{
	weap = getEnt ("shop2","targetname");
	trig = getEnt ("shop2_trig","targetname");
	trig sethintstring ("Buy a weapon here!");
	trig waittill ("trigger",player);
	iPrintLnBold ("Go away, Go away! Something will kill you!");
	wait(2);
	for(i=5; i>0; i--)
	iPrintLnBold(i);
	wait(1);
	iPrintLnBold ("The Bomb is exploded!");
}

 and when i press now f nothing works, and no error

Edited by AoKMiKeY
Works fine
0

Share this post


Link to post
Share on other sites

when i use code there are error after error with bad syntax and when i put level before shopthere is errror too

0

Share this post


Link to post
Share on other sites

Please use bbcodes and disable smilies in your post when posting code, thanks.

0

Share this post


Link to post
Share on other sites

when i use code there are error after error with bad syntax and when i put level before shopthere is errror too

Please run developer 2 and then send me the logs or post them in a pastebin. If you want help that is the quickest way.

0

Share this post


Link to post
Share on other sites

Maybe you shouldn't try to suicide the level entity.

 

Try to read :sir:

0

Share this post


Link to post
Share on other sites

i cant follow you there...
 
i got it  thanks to all,
 
i change the self suicid, to player suicide .
 
But other problem...
 
how to script a bomb ( like c4, or tnt, which explode after the variable?) it must pack in this files : shop3()

{
    weap = getEnt ("shop2","targetname");
    trig = getEnt ("shop2_trig","targetname");
    trig sethintstring ("Buy a weapon here!");
    trig waittill ("trigger",player);
    iPrintLnBold ("Go away, Go away! Something will kill you!");
    wait(2);
    for(i=5; i>0; i--)
    iPrintLnBold(i);
    wait(1);
    iPrintLnBold ("The Bomb is exploded!");
}

 

and a syntax error but i dont know what there is false :

 

main()
{
thread door();
thread spawnwave();
thread shop1();
thread shop2();
thread shop3();
thread trap1();
thread trap2();
thread press();
thread tele();


}

door()
{
object = getEnt ("door","targetname");
wait (14);
iPrintLnBold ("^1Door is opening");
object moveZ (200,6);
}

spawnwave()
{
wave = getEnt ("wave","targetname");
killtrigger = getEnt ("killwave","targetname");

killtrigger enablelinkto ();
killtrigger linkto(wave);

wait(20);
wave moveY (-2800,3);
wave waittill ("movedone");
wait(2);
wave moveZ (-1200,3);
}

shop1()
{
trig = getEnt ("shop1_trig","targetname");
trig sethintstring ("Buy whine here!");
for(; ;)
{
trig waittill ("trigger",player);
wait(5);
player suicide();
}
}

shop2()
{
trig = getEnt ("stand_trig","targetname");
trig sethintstring ("Buy a room here!");
for(; ;)
{
trig waittill ("trigger",player);
wait(5);
player suicide();
}
}

shop3()
{
trig = getEnt ("shop2_trig","targetname");
trig sethintstring ("Buy a weapon here!");
trig waittill ("trigger",player);
iPrintLnBold ("Go away, Go away! Something will kill you!");
wait(2);
for(i=5; i>0; i--)
iPrintLnBold(i);
wait(1);
iPrintLnBold ("The Bomb is exploded!");
}

trap1()
{
object = getEnt ("trap1","targetname");
object2 = getEnt ("floor1","targetname");
trigger = getEnt ("trap1_trig","targetname");
trigger waittill ("trigger",player);
object moveZ (-300,4);
object2 moveZ (-300,4);
object waittill ("movedone");
object2 waittill ("movedone");
wait(2);
wait(2);
object moveZ (300,4);
object2 moveZ (300,4);
}

trap2()
{
object = getEnt ("trap2","targetname");
object1= getEnt ("floor2","targetname");
trigger = getEnt ("trap2_trig","targetname");
//killtrigger = getEnt ("kill_trap2","targetname");

//killtrigger enablelinkto ();
//killtrigger linkto (object, object1);
trigger waittill ("trigger",player);
object moveZ (295,3);
object1 moveZ (301,3);
object waittill ("movedone");
object1 waittill ("movedone");
wait(2);
wait(2);
object moveZ (-295,3);
object1 moveZ (-301,3);
}

press()
{
object = getEnt ("ope","targetname");
trigger = getEnt ("tele","targetname");
trigger sethintstring ("Press f to come in secret");
trigger waittill ("trigger",player)
wait(2);
object moveZ (-300,3);
wait(1);
iPrintLnBold ("Haha, you will fall in the dead!");
}

tele()
{
trigger = getEnt ("telesec","targetname");
object = getEnt ("telesec_go","targetname");
for(; ;)
{
trigger waittill ("trigger",player);
iPrintLnBold ("Joke :D");
player setOrigin (object.origin);
}
}

 

the link of errror : http://prntscr.com/7pwl68

 

how i can disable smileys ?

 

0

Share this post


Link to post
Share on other sites

i cant follow you there...

 

i got it  thanks to all,

 

i change the self suicid, to player suicide .

 

But other problem...

 

how to script a bomb ( like c4, or tnt, which explode after the variable?) it must pack in this files : shop3()

{

    weap = getEnt ("shop2","targetname");

    trig = getEnt ("shop2_trig","targetname");

    trig sethintstring ("Buy a weapon here!");

    trig waittill ("trigger",player);

    iPrintLnBold ("Go away, Go away! Something will kill you!");

    wait(2);

    for(i=5; i>0; i--)

    iPrintLnBold(i);

    wait(1);

    iPrintLnBold ("The Bomb is exploded!");

}

 

and a syntax error but i dont know what there is false :

 

main()

{

thread door();

thread spawnwave();

thread shop1();

thread shop2();

thread shop3();

thread trap1();

thread trap2();

thread press();

thread tele();

}

door()

{

object = getEnt ("door","targetname");

wait (14);

iPrintLnBold ("^1Door is opening");

object moveZ (200,6);

}

spawnwave()

{

wave = getEnt ("wave","targetname");

killtrigger = getEnt ("killwave","targetname");

killtrigger enablelinkto ();

killtrigger linkto(wave);

wait(20);

wave moveY (-2800,3);

wave waittill ("movedone");

wait(2);

wave moveZ (-1200,3);

}

shop1()

{

trig = getEnt ("shop1_trig","targetname");

trig sethintstring ("Buy whine here!");

for(; ;)

{

trig waittill ("trigger",player);

wait(5);

player suicide();

}

}

shop2()

{

trig = getEnt ("stand_trig","targetname");

trig sethintstring ("Buy a room here!");

for(; ;)

{

trig waittill ("trigger",player);

wait(5);

player suicide();

}

}

shop3()

{

trig = getEnt ("shop2_trig","targetname");

trig sethintstring ("Buy a weapon here!");

trig waittill ("trigger",player);

iPrintLnBold ("Go away, Go away! Something will kill you!");

wait(2);

for(i=5; i>0; i--)

iPrintLnBold(i);

wait(1);

iPrintLnBold ("The Bomb is exploded!");

}

trap1()

{

object = getEnt ("trap1","targetname");

object2 = getEnt ("floor1","targetname");

trigger = getEnt ("trap1_trig","targetname");

trigger waittill ("trigger",player);

object moveZ (-300,4);

object2 moveZ (-300,4);

object waittill ("movedone");

object2 waittill ("movedone");

wait(2);

wait(2);

object moveZ (300,4);

object2 moveZ (300,4);

}

trap2()

{

object = getEnt ("trap2","targetname");

object1= getEnt ("floor2","targetname");

trigger = getEnt ("trap2_trig","targetname");

//killtrigger = getEnt ("kill_trap2","targetname");

//killtrigger enablelinkto ();

//killtrigger linkto (object, object1);

trigger waittill ("trigger",player);

object moveZ (295,3);

object1 moveZ (301,3);

object waittill ("movedone");

object1 waittill ("movedone");

wait(2);

wait(2);

object moveZ (-295,3);

object1 moveZ (-301,3);

}

press()

{

object = getEnt ("ope","targetname");

trigger = getEnt ("tele","targetname");

trigger sethintstring ("Press f to come in secret");

trigger waittill ("trigger",player)

wait(2);

object moveZ (-300,3);

wait(1);

iPrintLnBold ("Haha, you will fall in the dead!");

}

tele()

{

trigger = getEnt ("telesec","targetname");

object = getEnt ("telesec_go","targetname");

for(; ;)

{

trigger waittill ("trigger",player);

iPrintLnBold ("Joke :D");

player setOrigin (object.origin);

}

}

 

the link of errror : http://prntscr.com/7pwl68

 

how i can disable smileys ?

Seriously?

 

Look at whatever line 79 is and see if anything's wrong.

 

Probably your for loop, wtf is going on there? You need brackets and an indent.

0

Share this post


Link to post
Share on other sites

why im serious xd.. im a beginner... and without any tut how i can script a exploding bomb i cant learn it... i looked at this file now 15 minutes and nothing is there wrong,....

0

Share this post


Link to post
Share on other sites

why im serious xd.. im a beginner... and without any tut how i can script a exploding bomb i cant learn it... i looked at this file now 15 minutes and nothing is there wrong,....

https://www.google.co.uk/search?sourceid=chrome-psyapi2&ion=1&espv=2&ie=UTF-8&q=cod4%20gsc%20scripting%20tutorial&oq=cod4%20gsc%20scripting&aqs=chrome.0.0j69i57.4774j0j7

 

Plenty of tutorials.

 

If you read around the topic you will easily find out how to do things like that.

 

I'm not going to spoon feed you, when I was learning I spent hours looking over random things people posted online. Some were helpful, some were not.

0

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now