[sp] scripting error

Have questions about CoD/UO mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

[sp] scripting error

Post by creator » November 20th, 2006, 12:25 am

i made a script with in it:
level weapons, stuka, parachute
everything works fine untill stuka ends at end node..
then it says:

Code: Select all

compile error potential infinity loop
plane waittill ("movedone");

Code: Select all

main()
{
maps\_load::main(); 

level.player takeallweapons();
	level.player giveWeapon("sten");
	level.player giveWeapon("colt");
	level.player giveWeapon("fraggrenade");
	level.player switchToWeapon("sten");

thread parachute();
thread plane();
}

parachute()
{
level.player allowProne (false);
level.player allowCrouch (false);

start = level.player.origin;

startheight = start[2];

level.player.origin = level.player.origin + (0,0,0);

parachute = spawn ("script_model",(0,0,0));
parachute setmodel ("xmodel/parachute_animrig");

parachute.origin = level.player.origin;

level.player linkto (parachute,"TAG_player",(0,0,0),(0,0,0));
parachute show();

while (1)
{
wait 0.05;

direction = (0,0,-9);
parachute.origin=parachute.origin+direction;

start = level.player.origin;
end = start + (0,0,-64);

hitcharacters = 1;
results=[];results=bulletTrace(start,end,hitcharacters,level.player);

if (results["fraction"]!=1)
{
level.player.origin = results["position"];
level.player unlink();

level.player allowProne (true);
level.player allowCrouch (true);

break;
}
}
parachute hide();
}

plane() 
{ 
plane = getent ("plane_drop","targetname");
end = getent ("plane_drop_end","targetname");
speed = 6;
while (1) 
{ 
plane moveto(end.origin, speed);
plane waittill ("movedone");
plane delete();
	}
}
i have no idea whats wrong

creator.
Cod 1 Mapper&Modder&Moddeler

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » November 20th, 2006, 4:36 pm

Code: Select all

plane()
{
plane = getent ("plane_drop","targetname");
end = getent ("plane_drop_end","targetname");
speed = 6;
while (1)
{
plane moveto(end.origin, speed);
plane waittill ("movedone");
plane delete();
   }
}
Read in english...

Find entities plane & end, set speed to 6.
Create infinite loop, move the plane to end location at speed.
When plane has moved, delete the plane.
Move the plane to end origin...
etc..
...


Basically, after you delete the plane, you are then telling the plane to move to a location and wait, but the plane was already deleted and there fore the script is killed.

Try this...

Code: Select all

plane()
{
plane = getent ("plane_drop","targetname");
end = getent ("plane_drop_end","targetname");
speed = 6;

plane moveto(end.origin, speed);
plane waittill ("movedone");
plane delete();
}
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » November 20th, 2006, 6:43 pm

remove while(1) and only 1 or 2 } at end?
Cod 1 Mapper&Modder&Moddeler

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » November 20th, 2006, 10:14 pm

Erm can't u just try it? If there's 1 open { then you only need 1 } to close it.
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » November 20th, 2006, 10:50 pm

k just tried worked, could not before had some cod problems {again-.-}
Cod 1 Mapper&Modder&Moddeler

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest