Plane script doesn't work... :S

Post your scripting questions / solutions here

Moderator: Moderators

Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Plane script doesn't work... :S

Post by Barttje »

Hi all its me again.

If I start the server and going to wait 30 sec for this plane (check script), he shut down the server with the error "Level::AllocEdict: no free edicts" ... :S
i don't know what wrong, can someone help me... :?:

Code: Select all

thread path_c47
...
path_c47:
 wait 30
  while(1)
    {
	spawn script_object "targetname" "pl1" "classname" "info_splinepath" 
	$pl1.origin = ( 0 -4100 1689 ) 
	$pl1.angles = ( 0 90 0 ) 
	$pl1.model = "vehicles/c47fly.tik" 

	spawn script_object "targetname" "pl2" "classname" "info_splinepath" 
	$pl2.origin = ( 0 -3000 1689 ) 
	$pl2.angles = ( 0 90 0 ) 
	$pl2.model = "vehicles/c47fly.tik" 

	spawn script_object "targetname" "pl3" "classname" "info_splinepath" 
	$pl3.origin = ( 0 -1900 1689 ) 
	$pl3.angles = ( 0 90 0 ) 
	$pl3.model = "vehicles/c47fly.tik" 

	spawn script_object "targetname" "pl4" "classname" "info_splinepath" 
	$pl4.origin = ( 0 -800 1689 ) 
	$pl4.angles = ( 0 90 0 ) 
	$pl4.model = "vehicles/c47fly.tik" 

	spawn script_object "targetname" "pl5" "classname" "info_splinepath" 
	$pl5.origin = ( 0 300 1689 ) 
	$pl5.angles = ( 0 90 0 ) 
	$pl5.model = "vehicles/c47fly.tik" 

	spawn script_object "targetname" "pl6" "classname" "info_splinepath" 
	$pl6.origin = ( 0 1400 1689 ) 
	$pl6.angles = ( 0 90 0 ) 
	$pl6.model = "vehicles/c47fly.tik" 

	$pl1.target = $pl2 
	$pl2.target = $pl3 
	$pl3.target = $pl4 
	$pl4.target = $pl5 
	$pl5.target = $pl6 

	spawn script_object "targetname" "bomberpath" "classname" "info_splinepath" "target" $pl1 "origin" "0 -5200 1689" "angles" "0 90 0" "model" "vehicles/c47fly.tik" "$mdl" "vehicles/c47fly.tik" "#set" "1" "speed" ".6"
    }
 wait 30
end
Thanks
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Well when you spawn things in a while(1) loop of couse you are going to get no free edits even if you just do it every 30 seconds eventually you are going to crash . You don't need to keep respawning info_splinepath nodes and you can use spawn info_splinepath if you want as well instead of a script_object and changeing it's classname . Once a splinepath have been spawned it is there for you to use over and over again no point in respawning it for any reason . That thread should have been run once thats all . The part that makes the plane fly is in another part of your script hopefully .
Image
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

I don't get it, can you be more clear?
TriggerHappy
Private
Posts: 6
Joined: Sun May 21, 2006 9:09 pm

Post by TriggerHappy »

Seperate the part of your script that creates the splinepaths and the part that tells the plane to follow them. Once the splinepaths are created, they stay there. Ergo spawning them repeatedly (while loop) will crash the server :)
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

This edict error just means you ran out of entities. You have to remove unused ones.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

So i have to remove the while(1) or something with the info_splinepath (don't get what to change... :S )
Old nickname: Bartjerambo
New nickname: Barttje
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Excuse me, but what's the logic behind spawning the same path over and over again in 30 seconds interval?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

Im jus guessing its sumthing along the lines of this??

Code: Select all

thread path_c47
thread fly_by
...
path_c47:
 //wait 30
  //while(1)
   // {
   spawn script_object "targetname" "pl1" "classname" "info_splinepath"
   $pl1.origin = ( 0 -4100 1689 )
   $pl1.angles = ( 0 90 0 )
   $pl1.model = "vehicles/c47fly.tik"

   spawn script_object "targetname" "pl2" "classname" "info_splinepath"
   $pl2.origin = ( 0 -3000 1689 )
   $pl2.angles = ( 0 90 0 )
   $pl2.model = "vehicles/c47fly.tik"

   spawn script_object "targetname" "pl3" "classname" "info_splinepath"
   $pl3.origin = ( 0 -1900 1689 )
   $pl3.angles = ( 0 90 0 )
   $pl3.model = "vehicles/c47fly.tik"

   spawn script_object "targetname" "pl4" "classname" "info_splinepath"
   $pl4.origin = ( 0 -800 1689 )
   $pl4.angles = ( 0 90 0 )
   $pl4.model = "vehicles/c47fly.tik"

   spawn script_object "targetname" "pl5" "classname" "info_splinepath"
   $pl5.origin = ( 0 300 1689 )
   $pl5.angles = ( 0 90 0 )
   $pl5.model = "vehicles/c47fly.tik"

   spawn script_object "targetname" "pl6" "classname" "info_splinepath"
   $pl6.origin = ( 0 1400 1689 )
   $pl6.angles = ( 0 90 0 )
   $pl6.model = "vehicles/c47fly.tik"

   $pl1.target = $pl2
   $pl2.target = $pl3
   $pl3.target = $pl4
   $pl4.target = $pl5
   $pl5.target = $pl6

end

fly_by:
while(1)
{
  spawn script_object "targetname" "bomberpath" "classname" "info_splinepath" "target" $pl1 "origin" "0 -5200 1689" "angles" "0 90 0" "model" "vehicles/c47fly.tik" "$mdl" "vehicles/c47fly.tik" "#set" "1" "speed" ".6"
    }
 wait 30
end
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

You need to have some understanding of what you are writeing . 1 giveing a info_spliepath a model lets you see the model IN RADIANT !! in game info_splinepath nodes do not draw setting the model IN RADIANT !! is so that you can see what angle the plane is on so when a plane does fly it uses the angles of the info_splinepath as it flys . 2 you are useing the global bomber.scr so a place to start is to read that script at the top is instructions on how to use it . It says to do these things .
Created a info_splinepath

Rotate each individual info_splinepath. The way its rotated will determine what position the plane will be in when it flies through that point in space.

Give the first one a targetname of "bomberpath"

Set this one's $mdl value to be equal to its model value ( this will be the plane that is spawned so you don't need to set the model value)

You can make the planes drop bombs by setting up similar paths using the model "ammo/us_bomb.tik", and the first spline on the path has targetname "bomber".

( this is a separate info_splinepath that starts beside one of the ones on the bombers path and goes down to the grownd where you want the bomb to hit )

Both the "bomber" and the "bomberpath" entities are given the same #set value, to associate them. You can give the bombers a $setthread value to make them run a thread in the level.script upon impact. They automatically do an explosion when they reach the end of their path.

You can make triggers for the bombers with "trigger_multiple"s that have a targetname "bombertrigger" and the same #set number as the bomberpath, or you can do "thread global/bomber.scr::bomb #" where # is the #set number in question.
Once you have your path set up all you need to do when you want the plane to fly is that last thing on the list
thread global/bomber.scr::bomb #" where # is the #set number in question.
That would be the only thing you put in any kind of a loop also after you have spawned your path you have to use

exec global/bomber.scr before you try to make the plane fly you do that only once after you have spawned your path
Image
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

ive followed all what you said, and I read (before) global/bomber.scr but he is still saying the error in console (with a server crash)... :S
Old nickname: Bartjerambo
New nickname: Barttje
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Well something is being spawned to the point that your script is crashing the server it not this then something else . Post a link to your script or if is not too long post your script or all we can do is keep guessing .
Image
Barttje
Sergeant Major
Posts: 111
Joined: Sat Aug 20, 2005 8:52 pm

Post by Barttje »

Here is my map script:
// THE BRIDGE
// ARCHITECTURE: POWZER
// SCRIPTING: POWZER

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "The Crossroads"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "mohdm4"

// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread

level waittill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr

exec global/door_locked.scr::lock
level.script = maps/dm/mohdm4.scr
exec global/ambient.scr mohdm4

thread global/minefield.scr::minefield_setup
thread path_c47
thread fly_by


level waittill spawn

end

//-----------------------------------------------------------------------------


path_c47:
//wait 30
//while(1)
// {
spawn script_object "targetname" "pl1" "classname" "info_splinepath"
$pl1.origin = ( 0 -4100 1689 )
$pl1.angles = ( 0 90 0 )
$pl1.model = "vehicles/c47fly.tik"

spawn script_object "targetname" "pl2" "classname" "info_splinepath"
$pl2.origin = ( 0 -3000 1689 )
$pl2.angles = ( 0 90 0 )
$pl2.model = "vehicles/c47fly.tik"

spawn script_object "targetname" "pl3" "classname" "info_splinepath"
$pl3.origin = ( 0 -1900 1689 )
$pl3.angles = ( 0 90 0 )
$pl3.model = "vehicles/c47fly.tik"

spawn script_object "targetname" "pl4" "classname" "info_splinepath"
$pl4.origin = ( 0 -800 1689 )
$pl4.angles = ( 0 90 0 )
$pl4.model = "vehicles/c47fly.tik"

spawn script_object "targetname" "pl5" "classname" "info_splinepath"
$pl5.origin = ( 0 300 1689 )
$pl5.angles = ( 0 90 0 )
$pl5.model = "vehicles/c47fly.tik"

spawn script_object "targetname" "pl6" "classname" "info_splinepath"
$pl6.origin = ( 0 1400 1689 )
$pl6.angles = ( 0 90 0 )
$pl6.model = "vehicles/c47fly.tik"

$pl1.target = $pl2
$pl2.target = $pl3
$pl3.target = $pl4
$pl4.target = $pl5
$pl5.target = $pl6

end

fly_by:
while(1)
{
spawn script_object "targetname" "bomberpath" "classname" "info_splinepath" "target" $pl1 "origin" "0 -5200 1689" "angles" "0 90 0" "model" "vehicles/c47fly.tik" "$mdl" "vehicles/c47fly.tik" "#set" "1" "speed" ".6"
}
wait 30
end

//-----------------------------------------------------------------------------

roundbasedthread:

// Can specify different scoreboard messages for round based games here.

level waitTill prespawn

level waittill spawn

// set the parameters for this round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = kills // set to axis, allies, kills, or draw

level waittill roundstart

end
made with notepad



.
Old nickname: Bartjerambo
New nickname: Barttje
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Well if you don't listen to what we post then there is no hope for you the answer is written in the posts already posted you don't even have a line to make the plane start flying and did not exec the global/bomber.scr after doing the path . Can't you see that the fly_by thread is in a while loop and is spawning over and over again . Do you know what spawing is ? did you see the command I posted that you need to do to get the plane to fly . Come on reread the posts one at a time we are not going to do it for you try to understand what we are saying .
Image
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

This is from the bomber.scr, It gives full instructions on how it works.
You can make triggers for the bombers with "trigger_multiple"s that have a targetname "bombertrigger" and the same #set
number as the bomberpath, or you can do "thread global/bomber.scr::bomb #" where # is the #set number in question.
But you need to exec it in a thread set by a trigger.
exec global/bomber.scr//<--------
wait 5
thread global/bomber.scr::bomb 1//will bomb set 1
wait 30
iprintlnbold "'Planes Bombing bla bla"
thread global/bomber.scr::bomb 2
Read this post, It should help :wink:

/forum/viewtopic.php?t=10150&highlight=plane+fly
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

You don't need to use a trigger but you can . Put the line from your fly thread into the same thread as the rest of that path and don't loop it . Spawn your path first then do as green beret said .
Image
Post Reply