Help with tutorial

Discussion in 'Unknown Enemy' started by ronaldace, Jun 22, 2003.

  1. Eder Mr. Standoff

    Message Count:
    3,337
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Sao Paulo, Brazil
    I'm one or two hours east of the eastern timezone myself.
  2. Iceblade Rear Admiral

    Message Count:
    1,866
    Likes Received:
    3
    Trophy Points:
    26,985
    Gender:
    Male
    Well it is 22:06 in the Eastern timezone
  3. Quarto Unknown Enemy

    Message Count:
    11,146
    Likes Received:
    29
    Trophy Points:
    69,385
    Location:
    Poland
    Not at 11 in the morning, no :p. I was merely not online yet.

    The problem with this mission - frankly, I'm very surprised that it didn't crash - is that you've got all three navpoints using the same actionsphere. The line:

    navdata: 1, 5000;

    The second number is the diameter, so it can be identical for all navpoints. The first number is the actionsphere. The first navpoint should be 1, and the rest should increase sequentially from there.
  4. Iceblade Rear Admiral

    Message Count:
    1,866
    Likes Received:
    3
    Trophy Points:
    26,985
    Gender:
    Male
    Sorry. I thought it was 4 or 5 where you lived a short time ago.

    That helps alot. But at nav one it isn't locking onto the next navpoint. I am barely able to get to nav 2 but at nav 2 it locks onto nav 1. Below is an updated code. Ronald, this should help with your problem. Thank you very much again Quarto, but I still have that other problem with the objectives.

    mission s0;

    #include wcp, consts, pilots, utils;
    #strings targetid;
    #SetOutputPath("$wcso$\mission\");

    object Nav1(Navpoint)
    x:0;
    y:0;
    z:0;
    main: M_Nav1;
    navdata: 1, 5000;
    end;

    object Nav2(Navpoint)
    x:10000;
    y:10000;
    z:10000;
    main: M_Nav2;
    targstr: targetid["Nav_2"];
    navdata: 2, 10000;
    end;

    object Player(Player)
    obj: panthrbl;
    x: 0;
    y: 100;
    z: 0;
    main: M_Player;
    pilot: PILOT_Casey1;
    targstr: targetid["Alpha 1"];
    end;

    object Midway(Capship)
    obj: Midway;
    x: -100;
    y: -245;
    z: 0;
    main: M_Midway;
    pilot: PILOT_TCS_Midway;
    direction: 0, 0, 0;
    targstr: targetid["Midway"];
    end;

    function M_Player;
    begin
    SF_SetObjectFlag (OF_alignment,ALIGN_Confed);
    SF_ActivateSelf(0);
    SF_PlayerSwitchToCam(CamID_cockpit, Player);
    while(1) do
    AI_WaitSeconds(1);
    end;

    function M_Midway;
    begin
    SF_SetObjectFlag (OF_alignment,ALIGN_Confed);
    SF_BindToActionSphere(1); // this means the first nav point
    AI_WaitUntilActive;
    while(1) do begin
    AI_WaitSeconds(1);
    end;
    end;


    function M_Nav1;
    var
    setup = true;
    begin
    while(1) do begin
    if (NAV_WithinSphere(Player)) then begin
    NAV_ActivateSelf;
    if (setup) then begin
    SF_ActivateObject(Midway,0);
    setup := false;
    end;
    while(NAV_WithinSphere(Player)) do begin
    NAV_SetPlayerNav(2);
    AI_WaitSeconds(1);
    end;
    NAV_DeactivateSelf;
    end;
    AI_WaitSeconds(1);
    end;
    end;


    function M_Nav2;
    var
    setup = true;
    begin
    while(1) do begin
    if (NAV_WithinSphere(Player)) then begin
    NAV_ActivateSelf;
    setup := false;
    end;
    NAV_SetPlayerNav(1);
    while(NAV_WithinSphere(Player)) do begin
    AI_WaitSeconds(1);
    end;
    NAV_DeactivateSelf;
    end;
    AI_WaitSeconds(1);
    end;

    function MAIN;
    begin
    MS_RunSpaceFlight(0);
    end;
  5. Quarto Unknown Enemy

    Message Count:
    11,146
    Likes Received:
    29
    Trophy Points:
    69,385
    Location:
    Poland
    I don't see a problem in the code you post here... you've got two navpoints, and the player travels back and forth between them. If you add a third navpoint, you can get the player to go there, too :p.
  6. Iceblade Rear Admiral

    Message Count:
    1,866
    Likes Received:
    3
    Trophy Points:
    26,985
    Gender:
    Male
    For some odd reason in the mission the nav computer goes back and forth from nav1 to nav2 at a fast rate. It works fine getting back.

    Well I see what I can do with it tomorrow.
  7. ronaldace Spaceman

    Message Count:
    23
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Spain
    Allright! :D this is my code which seems to work perfectly!! yeeeaaahhh!!!! :p

    --------------------
    // Mision 2
    mission s1;
    #SetOutputPath("$wcso$\mission\");
    #include wcp, consts, pilots;
    #strings targetid;
    #AddToSearchPath ("$wcso$\language");

    var aliensalive = 5;

    function MAIN;
    begin
    MS_RunSpaceflight(0);
    end;

    object Alpha1(Player)
    obj: panthrbl;
    x: 250;
    y: 500;
    z: 0;
    main: M_Alpha1;
    //death: D_Alpha;
    pilot: PILOT_Casey1;
    end;

    function M_Alpha1;
    begin
    SF_SetObjectFlag (OF_alignment,ALIGN_Confed); //sets the player to confed alligment
    SF_ActivateSelf(0);
    SF_PlayerSwitchToCam(CamID_cockpit, Alpha1);//Switch to player cockpit
    while(1) do begin
    AI_WaitSeconds(1);

    end;
    end;

    object Midway(Capship)
    obj: Midway;
    x: 300;
    y: -100;
    z: 200;
    main: M_Midway;
    pilot: PILOT_TCS_Midway;
    direction: 0, 0, 0;
    targstr: targetid["Midway"];
    end;

    function M_Midway;
    begin
    SF_SetObjectFlag (OF_alignment,ALIGN_Confed); //sets the player to confed alligment
    //SF_ActivateSelf(0);
    AI_WaitUntilActive;
    //SF_PlayerSwitchToCam(CamID_cockpit, Alpha1);//Switch to player cockpit
    SF_BindToActionSphere(1);
    while(1) do begin
    AI_WaitSeconds(1);

    end;
    end;

    object Nav1(Navpoint)
    x:0;
    y:0;
    z:0;
    main: M_Nav1;
    navdata: 1, 1000;
    end;

    function M_Nav1;
    var
    setup = true;
    begin
    while(1) do begin
    if (NAV_WithinSphere(Alpha1)) then begin

    NAV_ActivateSelf;

    if (setup) then begin

    //**CODE TO BE PERFORMED ON FIRST ONLY TIME IN NAV**
    SF_ActivateObject(Midway, 0);

    setup := false;
    end;

    NAV_SetPlayerNav(2);

    while(NAV_WithinSphere(Alpha1)) do begin
    AI_WaitSeconds(1);
    end;

    NAV_DeactivateSelf;
    end;
    AI_WaitSeconds(1);
    end;
    end;

    // NAV 2

    function F_Spawn(shipid, count, x, y, z);
    var ox,
    oy,
    oz;
    //
    // this function spawns "count" ships of type "shipID"
    // at coordinates near the ox, oy, oz
    //

    begin

    while(count > 0) do begin
    ox := x + SYS_Random(2000) + 1000;
    oy := y + SYS_Random(200) + 100;
    oz := z + SYS_Random(2000) + 1000;

    NAV_CreateShip(shipId, PILOT_Alien1, 0, @M_Spawn, @D_Spawn, ox, oy, oz);
    count := count - 1;
    end;
    end;

    function M_Spawn;
    begin
    SF_SetObjectFlag (OF_alignment,ALIGN_Alien); //sets the player to confed alligment
    SF_ActivateSelf(0);
    //SF_PlayerSwitchToCam(CamID_cockpit, Alpha1);//Switch to player cockpit
    while(1) do begin
    AI_WaitSeconds(1);

    end;
    end;

    function D_Spawn;
    begin
    aliensalive := aliensalive - 1;
    end;

    function M_WaitUntilDead;
    begin
    while(aliensalive > 0) do begin
    AI_WaitSeconds(1);
    end;
    end;

    object Nav2(Navpoint)
    x:50000;
    y:50000;
    z:0;
    main: M_Nav2;
    navdata: 2, 5000;
    end;

    function M_Nav2;
    var
    setup = true;
    begin
    while(1) do begin
    if (NAV_WithinSphere(Alpha1)) then begin
    NAV_ActivateSelf;

    if (setup) then begin

    //**CODE TO BE PERFORMED ON FIRST ONLY TIME IN NAV**
    F_Spawn(2, 5, 49000, 51000, 100);
    M_WaitUntilDead;
    SF_SetMissionSuccess;
    AI_WaitSeconds(5);
    SF_Exit;

    setup := false;
    end;

    NAV_SetPlayerNav(1);

    while(NAV_WithinSphere(Alpha1)) do begin
    AI_WaitSeconds(1);
    end;

    NAV_DeactivateSelf;
    end;
    AI_WaitSeconds(1);
    end;
    end;
    -------------------------------------------------

    Lemme know if there is anything which could be fixed (thought the mission works well).

    Hey! If u need a hand at Standoff or UE2 and I can help, let me know! ;)

    Oh! and the problem I had with the Midway was that I placed the "SF_ActivateObject(Midway, 0);" line in the Midway's main function instead of the Nav point's one.

    THANX A LOT FOR ALL THE HELP!
  8. Quarto Unknown Enemy

    Message Count:
    11,146
    Likes Received:
    29
    Trophy Points:
    69,385
    Location:
    Poland
    Well, that looks like a start :p. Now you should try to make a real mission - that is, make it necessary for the player to return to his carrier afterwards, and so on. Objectives are also worth trying, but first you should probably learn to make series files (since, in a sim mission, you won't be able to check out the objectives screen or the nav map). Apparently, in the distant past, I even wrote a tutorial for series files, which you can find on Killerwave's website.
  9. ronaldace Spaceman

    Message Count:
    23
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Spain
    Tutorial? Geez... u could make a book with all that! :D

    I'm checking it out now. Thanx 4 d link!
  10. Starkey Avenging Rooster

    Message Count:
    2,148
    Likes Received:
    0
    Trophy Points:
    36,885
    Location:
    Belo Horizonte, Brazil

    Ronaldace and Iceblade, you could give the Standoff´s team a hand, Eder has been asking for help with mission coding. If you have some spare time, contact him.
  11. ronaldace Spaceman

    Message Count:
    23
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Spain
    Cool! just sent him an email. :p

    By the way, what exe editor do you recommend, for making my own version of the SO exe file?

    IGNORE THIS, just got Hex Edit.. :D
  12. ronaldace Spaceman

    Message Count:
    23
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Spain
    Allright. Been trying to make my own SO exe file but found something strange:

    In the UE exe, the save folder is located in 0D 34E0, just as KillerWave tutorial says, but the same folder in my SO exe is located in 0D 3C38. Is this normal or is there anything strange here?
  13. Eder Mr. Standoff

    Message Count:
    3,337
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Sao Paulo, Brazil
    That's probably normal, since UE's exe has been modified from the original. I wouldn't worry about it.:)
  14. Iceblade Rear Admiral

    Message Count:
    1,866
    Likes Received:
    3
    Trophy Points:
    26,985
    Gender:
    Male
    Need Assistance, still!

    Check the thread labeled "Need help withan ending"
  15. ronaldace Spaceman

    Message Count:
    23
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Spain
    Can't find that thread, Iceblade
  16. Starkey Avenging Rooster

    Message Count:
    2,148
    Likes Received:
    0
    Trophy Points:
    36,885
    Location:
    Belo Horizonte, Brazil
  17. Quarto Unknown Enemy

    Message Count:
    11,146
    Likes Received:
    29
    Trophy Points:
    69,385
    Location:
    Poland
    It's not impossible that I put the wrong address in the tutorial, though it seems doubtful to me ;). It probably doesn't matter too much, anyway - the tutorial should give you enough info to find everything even if one or two addresses are wrong.

    (as for the hex editor, mostly I use an ancient DOS-era program called XTree Gold, but recently I also started using some hex-editing program from the internet)
  18. ronaldace Spaceman

    Message Count:
    23
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Spain
    No, it doesn't seem like your addresses are wrong, because the ones in your web are the sames as the WCUE file. But as Eder said, WCUE uses a modified EXE, so that must be the cause.

    Now, I've been trying to code the following mission:

    First I show up at Nav 1 with the Midway and a wingman. then I go to Nav 2. Drop the Midway there and go to Nav 3. Face some Morays, return to Nav 2, grab the Midway and go again to Nav 1.

    My problem is that the Midway doesn't show when I return to Nav 1. Here's the Midway's main function:

    function M_Midway;
    begin
    SF_SetObjectFlag (OF_alignment,ALIGN_Confed); //sets the player to confed alligment
    AI_WaitUntilActive;
    SF_BindToActionSphere(0);
    AI_SetAutopilotData(-150, -150, -40);
    while(1) do begin
    if( (nav2done) AND (nav3done = false) ) then begin
    SF_BindToActionSphere(2);
    AI_SetAutopilotData(0, 0, 0);
    end;
    if( (nav3done) AND (return = false) ) then begin //If I return to Nav 2 after going to Nav 3
    AI_SetAutopilotData(-150, -150, -40);
    end;
    if(return) then begin //If I return to Nav 1 after killing the Morays and picking up Midway at Nav 2
    SF_BindToActionSphere(0);
    end;
    AI_WaitSeconds(1);
    end;
    end;

    I suspect that the problem has to do with not being able to use "SF_BindToActionSphere(?);" several times or something related to that, am I right?
  19. Iceblade Rear Admiral

    Message Count:
    1,866
    Likes Received:
    3
    Trophy Points:
    26,985
    Gender:
    Male
    SF_BindToActionSphere(0);
    Essientially you are telling the program to bind the Midway to nav0 which doesn't exist. If you are saying that it doesn't need to bind to any sphere, then leave this out because to me it seems pointless. And then when you reach nav2 have it bind to sphere. Go to nav3 then come back to nav2 and set up a var or function of some kind that unbinds the Midway. Unforunately I can't see how you would be able to get bind to sphere to be false when you are in nav2 and it would negate the binding immediately. Maybe if you added something else that would happen in nav2 that would make the ship unbind from that nav. Good Luck!
  20. ronaldace Spaceman

    Message Count:
    23
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Spain
    How about I unbing it from Nav 2 when I arrive at Nav 1?

    By the way, how can I unbind? Tell me that and I'll try to get it to work.

Share This Page