global strafeing and bombing script

Discussion in 'Scripting' started by Bdbodger, Jan 23, 2004.

  1. deadeye arrow Private

    Contributions:
    6
    Nice you could carpet bomb that way i will try it out later.
  2. deadeye arrow Private

    Contributions:
    6
    Ok how about the plane leaving a trail of smoke behind and how do i increase the speed.
  3. deadeye arrow Private

    Contributions:
    6
    Bodger the sound for the plane needs delaying, because the plane spawns starts to fly and the sound is about 2 seconds after it.
  4. Bdbodger ***** squatter

    Contributions:
    144
    Specialties:
    Scripting
    Processing:
    Graphics:
    PREMIUM
    I Donated
    Ok I made a couple of script changes and it works better now when spawning the spline_path nodes . The guns are pointing right now . You won't need to set the sideoffset anymore . I uploaded the new version to the web space .
  5. Bdbodger ***** squatter

    Contributions:
    144
    Specialties:
    Scripting
    Processing:
    Graphics:
    PREMIUM
    I Donated
    set .damage lower for lower health it does leave smoke etc but health is 1000
    and found one more small problem sound keeps going after it is killed . I hide it because the emitters for the fire are glued to it after a couple of secs I delete plane but you hears the whole sound no plane . I will work on it have to go now . thanks .
  6. deadeye arrow Private

    Contributions:
    6
    ///////////////////////////////////////////////////////////////////////////////////////////

    Ok im getting private messages for advice on how to do this.The script below is for mohdm4 im using spearhead for this test.
    ///////////////////////////////////////////////////////////////////////////////////////////

    This script will spawn a plane that will strafe along the road from one end of the map to the other.I have made a pk3 for this test i have not placed it into the main maps/dm folder.
    //////////////////////////////////////////////////////////////////////////////////////////

    download Bodgers strafe.scr from the link at the start of this thread and place the strafe.scr into your glogal folder.
    //////////////////////////////////////////////////////////////////////////////////////////

    If you look at local.org3 in the script you will see local.org3.bomb = 1 by adding that when the plane gets to node3 it will drop a bomb that will explode once it hits the surface.you can add one for every node if you wish. there are lots of options you can use just read the text Bodger has included with his pk3
    //////////////////////////////////////////////////////////////////////////////////////////



    level waittill spawn


    local.org1 = spawn info_splinepath "targetname" "strafe_path" //Always name first one strafe_path
    local.org1.origin = ( 0 5135 1630)
    local.org1.angles = ( 0 270 0 )
    local.org1.set = 1

    local.org2 = spawn info_splinepath "targetname" "node2"
    local.org2.origin = ( 0 3826 1630)
    local.org2.angles = ( 0 270 0)
    local.org2.set = 1

    local.org3 = spawn info_splinepath "targetname" "node3"
    local.org3.origin = ( 0 3354 1630)
    local.org3.angles = ( 0 270 0 )
    local.org3.set = 1
    local.org3.bomb = 1//<-------------------adding this will drop a bomb at node3

    local.org4 = spawn info_splinepath "targetname" "node4"
    local.org4.origin = ( 0 2371 1630)
    local.org4.angles = ( 0 270 0 )
    local.org4.set = 1

    local.org5 = spawn info_splinepath "targetname" "node5"
    local.org5.origin = ( 0 1287 1630)
    local.org5.angles = ( 0 270 0 )
    local.org5.set = 1

    local.org6 = spawn info_splinepath "targetname" "node6"
    local.org6.origin = ( 0 279 1630)
    local.org6.angles = ( 0 270 0 )
    local.org6.set = 1

    local.org7 = spawn info_splinepath "targetname" "node7"
    local.org7.origin = ( 0 -676 1630)
    local.org7.angles = ( 0 270 0 )
    local.org7.set = 1

    local.org8 = spawn info_splinepath "targetname" "node8"
    local.org8.origin = ( 0 -1508 1630)
    local.org8.angles = ( 0 270 0 )
    local.org8.set = 1

    local.org9 = spawn info_splinepath "targetname" "node9"
    local.org9.origin = ( 0 -5000 1630)
    local.org9.angles = ( 0 270 0 )
    local.org9.set = 1


    local.org1.target = local.org2//<-------------- this connects the nodes together for plane path
    local.org2.target = local.org3
    local.org3.target = local.org4
    local.org4.target = local.org5
    local.org5.target = local.org6
    local.org6.target = local.org7
    local.org7.target = local.org8
    local.org8.target = local.org9

    level.script = maps/dm/mohdm4.scr

    level.debug = 1

    exec global/strafe.scr

    wait 4

    while(1)
    {
    exec global/strafe.scr::strafe 1 // makes the plane shoot bullets.
    wait 8 //<------ This is the time between flights set it up to your preference
    }
    end
  7. deadeye arrow Private

    Contributions:
    6
    Bodger the bullets look alot better since you altered the script.
  8. Bdbodger ***** squatter

    Contributions:
    144
    Specialties:
    Scripting
    Processing:
    Graphics:
    PREMIUM
    I Donated
    Yes I think so too . It seems to work better . When I made my tests the planes where at 0 yaw and 180 yaw . so the guns looked ok but in your script the yaw was 270 . I thought my code was able to handle that but it seems not . So I changed the script so that the plane rotates to 0 0 0 the guns are attached and then the plane is rotated back into position . Actually in spearhead the stuka has gun tags but in mohaa it does not and also my script is able to use a script_object as the plane so you can design you own plane if you want . To do all this the guns are attached to script origins that are suppose to orient themselves to the plane in theory anyway . It didn't quite work out that way so the rotation was needed . I also forgot to change the health trigger angles to the plane angles after I spawned it . The rotation made that unnessesary as well . Only problem I can see it that the sound keep going after the plane is suppose to be dead . Actually for the smoke and fire trails the plane is hidden for a few seconds before being deleted so the sound persists . I have tried the stopsound command in the SDK but it does not seem to work . I will find an answer maybe play a null sound or something . Look for an update later .
  9. deadeye arrow Private

    Contributions:
    6
    Maybe you should spawn more animations and explosions while the plane is starting to fall apart just enough to let the plane finish its path so the sound has time to finish. Bodger i have private messaged you i hope you dont mind.
  10. deadeye arrow Private

    Contributions:
    6
    Bodger another problem when the plane gets to the nodes and drops the bomb the plane almost stops then picks up speed again???
  11. deadeye arrow Private

    Contributions:
    6
    Bodger i have placed another set of nodes like this as a test as you can see its org10 upwards with set = 2


    local.org10 = spawn info_splinepath "targetname" "strafe_path"
    local.org10.origin = ( 0 6508 1030)
    local.org10.angles = ( 0 270 0 )
    local.org10.set = 2

    local.org11 = spawn info_splinepath "targetname" "node11"
    local.org11.origin = ( 0 3826 1030)
    local.org11.angles = ( 0 270 0)
    local.org11.set = 2

    local.org12 = spawn info_splinepath "targetname" "node12"
    local.org12.origin = ( 0 3354 1030)
    local.org12.angles = ( 0 270 0 )
    local.org12.set = 2

    etc etc etc


    then the connect paths

    local.org10.target = local.org11
    local.org11.target = local.org12
    local.org12.target = local.org13
    etc etc etc

    then finished it of like this


    exec global/strafe.scr

    wait 4

    while(1)
    {
    exec global/strafe.scr::strafe 2 <--------- is this correct
    wait 20
    }
    end

    the problem is when the plane flys this path, i have left the bombs of this one but it is repeating the first plane movements even though its lower it does the same thing slows down as if it was going to drop a bomb even though i have indicated in the thread no bombs. what i have done is given the second plane the same coordinates as the first but altered the height so the second plane is alot lower than the first plane and set it up so it spawns 15 seconds after the first plane.
  12. Bdbodger ***** squatter

    Contributions:
    144
    Specialties:
    Scripting
    Processing:
    Graphics:
    PREMIUM
    I Donated
    I fixed the sound problem and rotateing the plane before attaching guns is no longer needed either . As far as the plane slowing down that seems to be a problem with info_splinepath nodes I have seen it before it has nothing to do with this script . Just in case because the bomb is spawned and them made notsolid and maybe the plane is effected by that I lowered the position that the bomb spawns at by 64 units . You don't even notice it . Spaceing of the info_splinepath nodes may also play a part .

    exec global/strafe.scr::strafe 2 is correct for spawning plane with set # 2
  13. vkdawg Lance Corporal

    Contributions:
    5
    When you say "one bomb per node" - Please pardon my stupidity, but does that mean a plane can only drop ONE bomb for an entire flight, or does that mean it can drop one for each "path" defined in the splinepath?

    For example, as a plane flew over the Crossroads I would want it to drop more than one bomb per run....

    (I'm sorry, I guess I should read more, but I don't understand what "per node" means.)
  14. Bdbodger ***** squatter

    Contributions:
    144
    Specialties:
    Scripting
    Processing:
    Graphics:
    PREMIUM
    I Donated
    Yes you need to read the docs . If you have 6 nodes in a path with set #1 and the first node is targetname strafe_path and it targets the second node doesn't matter what it's name is as long as it's set number is the same and that nodes targets the next node etc etc to form a path of 6 nodes . You can give any of the nodes a #bomb value

    Key:bomb
    Value:3 // if you set this to 3 the plane will bomb every third time it is spawned if you set it to 2 it will be every 2nd time it is spawned .

    You can give all 6 nodes a bomb value and all 6 will bomb .

    You can use
    Key:#bombstart
    Value:2 //plane will wait until second time spawned to start bombing see #bomb above to see how often it will bomb

    You can use

    Key:#randombomb
    Value:5 // random chance of bombing from 1 to 5

    example 3 nodes-----

    local.org1 = spawn info_splinepath "targetname" "strafe_path"
    local.org1.origin = ( 0 6508 1030)
    local.org1.angles = ( 0 270 0 )
    local.org1.set = 1
    loca.org1.bomb = 2 // every 2 spawns

    local.org2 = spawn info_splinepath "targetname" "node2"
    local.org2.origin = ( 0 3826 1030)
    local.org2.angles = ( 0 270 0)
    local.org2.set = 1
    local.org2.randombomb = 4 // 1 in 4 chance of bomb

    local.org3 = spawn info_splinepath "targetname" "node3"
    local.org3.origin = ( 0 6508 1030)
    local.org3.angles = ( 0 270 0 )
    local.org3.set = 1
    local.org3.bombstart = 3 // wait until 3rd spawn to start bombing
    local.org3.bomb = 1 // start bombing every spawn after bombstart

    $strafe_path.target = $node2
    $node2.target = $node3

    exec global/strafe.scr // must do this once after all nodes are spawned to setup script

    while(1) // start of a loop
    {

    thread global/strafe.scr::strafe 1 // spawn of set 1
    wait 15

    } // bottom of a loop goes back to start
  15. deadeye arrow Private

    Contributions:
    6
    Bodger maybe if the bomb was spawned behind the plane it may not effect the planes speed,as i have noticed the bombs spawn just under the cockpit like you say 64 units away.
  16. Bdbodger ***** squatter

    Contributions:
    144
    Specialties:
    Scripting
    Processing:
    Graphics:
    PREMIUM
    I Donated
    Well like I said I don't think it has to do with the bombs . Try it without bombs and see if it still stutters like you say . I tried it and it is hard to notice where the bomb comes from . The plane has thickness too so it is not exactly 64 units below but 64 units below the planes center . I can add a small delay to the bombing so it seems to come farther back if you think it really needs it . Try this as a test , spawn a plane and give it a targetname . Then do $plane followpath $strafe_path without useing the strafe script and see if it does the same thing that way you will see if it stutters at all at the nodes . I think it will .
  17. vkdawg Lance Corporal

    Contributions:
    5
    Amazing!!

    Bdbodger....

    Amazing script!! I used the sample script that deadeye made for mohdm4, and it's awesome! I have been playing with this the last couple days, but had a couple questions and comments:

    First of all, questions and comments after using deadeye's sample script for mohdm4:

    1] I CAN'T see the guns at all!? Am I doing something wrong? Am I "not" supposed to see the guns? It shoots fine, but all I can see is the bullets - no guns. (Might not be a big deal, but I thought you said it actually mounted guns on the wings?)

    2] When I get shot by the guns, it says, ".:[LSE]:.vkdawg was shot in the" and that's it... obviously it's set up for AA. Is there a Spearhead version, and it is possible to have it say something like ".:[LSE]:.vkdawg was shot down by an airplane"

    3] Is it possible to have it set up when you're killed by a bomb to say something like ".:[LSE]:.vkdawg was blown up by a bomb" instead of ".:[LSE]:.vkdawg blew up"

    General questions:

    Is it possible to have 2 planes fly at the same time? If so, how would I set that up? I'm guessing that's what the "thread global/strafe.scr::strafe #" is for?? I just don't understand how to use that line (and it wasn't in deadeye's example).

    Is it possible to have 2 planes fly at the same time - one of them just dropping bombs, and one of them just shooting?

    Is it possible to have a plane shooting one time, and on the next pass not shoot at all?

    I haven't played with the plane turning and rolling at all yet, but I'm assuming this is done with the Key:angles?

    I have a lot of map scripts that use the splinepath for planes - I'm assuming I can just "copy" the "origins" and "angles" from those splinepaths, and the flight of the plane will look the same using this script??

    Is it possible to add messages!? Like "P47 Approaching - TAKE COVER!"

    Is it possible to add a message if the plane get's shot down? "P47 has been shut down!"

    Is it possible to add "sounds" - Like there's a stock .mp3 that sounds like an air raid horn - is there a way to play that before some of the planes?

    Sorry for all the questions, but I find this very exciting, and I'm looking forward to more testing, and adding this to my modded maps!!

    On some of the maps I run now with modded scripts there's two planes flying at the same time, just different paths - sometimes it just one plane, sometimes it both, etc. - Is there an easy way to do that with these scripts?

    Obviously my big thing is trying to figure out how to fly two planes at once, but I also don't want to fly two planes at once "every time"....

    Thanks....
  18. vkdawg Lance Corporal

    Contributions:
    5
    I don't understand how you can get 2 planes to fly at the same time?? You say you added this (I assume to your mohdm4 script), but how did you get your second plane to fly 15 seconds after the first plane??

    Where did you add all this in your script? Is it possible to have 2 "while loops" at the end? Ack... please explain!?

    I would really like to figure out how to get 2 planes going with different flight paths - sometimes flying at the SAME time, sometimes flying at different times, sometimes shooting, sometimes not shooting.... Is that all possible?
  19. Bdbodger ***** squatter

    Contributions:
    144
    Specialties:
    Scripting
    Processing:
    Graphics:
    PREMIUM
    I Donated
    Guns are hidden

    not that I know of .

    not that I know of

    yes make 2 paths with different set#'s at the first node of one of the paths "$strafe_path" set the guns key to 0 to turn off guns
    set the nodes with the same set# to bomb the nodes with the other set# do not set bomb keys
    yes by changeing the keys with script . $strafe_path with set # 1 is also node 1 (level.strafenode[set #][node #])
    level.strafenode[1][1] so you can have the plane spawn one time normaly then change the key

    exec global/strafe.scr::strafe 1

    level.plane[1] waitmove

    level.strafenode[1][1].guns = 0

    exec global/strafe.scr::strafe 1

    yes angles are ( pitch yaw roll )

    yes just make sure that the first node is name strafe_path

    use the setthread key to run a thread in your level.script at first node or add message just before exec global/strafe.scr::strafe 1
    in your level.script

    level.plane[local.set].dieing = 1 is set when plane is shot down untill after death effects and 20 second delay ,
    use that in level.script

    play the sound just before spawning the plane with
    exec global/strafe.scr::strafe <setnumber>

    depends on when you spawn the planes

    exec global/strafe.scr::strafe <setnumber>

    example:

    exec global/strafe.scr::strafe 1

    wait 15

    exec global/strafe.scr::strafe 1
    exec global/strafe.scr::strafe 2
  20. vkdawg Lance Corporal

    Contributions:
    5
    Bdbodger....

    I'm learning, I'm learning!!

    I'm such a newbie scripter... sorry for repeated questions, and thanks for your patience!!

    Here's the part I don't understand....

    The "First info_splinepath node keys" vs. "All info_splinepath nodes keys"

    The other thing I don't understand is HOW to set each key??

    You said:
    Okay, here's what I don't understand -

    Can you please explain the line:
    level.plane[1] waitmove

    I DO understand the line: level.strafenode[1][1].guns = 0
    BUT, is that the only way to set it? I thought you could set it for each node?
    So then, could I do:
    level.strafenode[1][1].guns = 0
    level.strafenode[1][2].guns = 1
    level.strafenode[1][3].guns = 1
    level.strafenode[1][4].guns = 0

    ?? Would that start out by NOT firing the guns, then fire it for nodes 2 and 3, and then go back to not firing??

    I tried doing it this way:

    local.org1 = spawn info_splinepath "targetname" "strafe_path" //<-Always name first one strafe_path
    local.org1.origin = ( 0 5135 1630)
    local.org1.angles = ( 0 270 0 )
    local.org1.set = 1
    local.org1.guns = 0

    local.org2 = spawn info_splinepath "targetname" "node2"
    local.org2.origin = ( 0 3826 1630)
    local.org2.angles = ( 0 270 0)
    local.org2.set = 1
    local.org2.guns = 0

    local.org3 = spawn info_splinepath "targetname" "node3"
    local.org3.origin = ( 0 3354 1630)
    local.org3.angles = ( 0 270 0 )
    local.org3.set = 1
    local.org3.guns = 0
    local.org3.bomb = 1 //<-Adding this will drop a bomb at node3

    local.org4 = spawn info_splinepath "targetname" "node4"
    local.org4.origin = ( 0 2371 1630)
    local.org4.angles = ( 0 270 0 )
    local.org4.set = 1
    local.org4.guns = 1

    local.org5 = spawn info_splinepath "targetname" "node5"
    local.org5.origin = ( 0 1287 1630)
    local.org5.angles = ( 0 270 0 )
    local.org5.set = 1
    local.org5.guns = 1

    local.org6 = spawn info_splinepath "targetname" "node6"
    local.org6.origin = ( 0 279 1630)
    local.org6.angles = ( 0 270 0 )
    local.org6.set = 1
    local.org6.guns = 0

    BUT, the guns still fired for on ALL nodes??

    Can you explain how to use the different keys, and how you can change their settings?
    Some of the keys start with a "$", some with a "#", and some with nothing (like angles). I don't understand how to set these? (Sorry, I'm a newb, and not a programmer.... just trying to write cool scripts for my maps)

    Will the settings I use in the first node (the "strafe_path") be default for all nodes to follow?

    For example, let's say I wanted to use a different plane model.... how would I do that?
    local.org1 = spawn info_splinepath "targetname" "strafe_path" //<-Always name first one strafe_path
    local.org1.origin = ( 0 5135 1630)
    local.org1.angles = ( 0 270 0 )
    local.org1.mdl = vehicles/fockwulffly.tik
    local.org1.set = 1

    local.org2 = spawn info_splinepath "targetname" "node2"
    local.org2.origin = ( 0 3826 1630)
    local.org2.angles = ( 0 270 0)
    local.org2.set = 1

    etc etc etc
    ??? Is that right (to use a Fockwulf) for all nodes???

    Or would I use:
    level.strafenode[1][1].mdl = vehicles/fockwulffly.tik

    Ack.. I'm confused. Sorry. Getting better though!

    One last question! Is there a way to change the "sound" of the plane? I don't know what's it's using by default - I just know there is other plane sounds you can use...

Share This Page