Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Vehicle Respawn - multiple vehicles of one type

  1. #1
    Staff Sergeant Stuntman's Avatar
    Join Date
    Jun 17 2006
    Location
    Tønsberg, Norway
    Posts
    290
    Hello guys.

    I'm using a vehicle respawn script in a MP mission I'm making. Its ported from OFP. Its not the built in ArmA script, because in my script every individual vehicle will respawn at its starting position.

    My problem is, when there are more than me on a dedicated server, the vehicles respawn more than once.

    If there are 5 people on, 5 bmp's respawn for example.

    What can I do to prevent this to happen?

    I'm not on my mission pc right now, so if you need the script receipt, please tell me and I'll get that posted.

    Thanks in advance!
    IN NEED OF A VOICE ACTOR? I work in a RADIO STATION with the latest recording equipment. PM me if you are interested in a mature voice with great sound quality!
    Follow me on YouTube for ArmA 2 gameplay footage, tournaments and machinimas!

  2. #2
    You respawn script must be run only in server, not in each client.

  3. #3
    Quote Originally Posted by (RAV_RAVEN @ Sep. 21 2008,18:50)
    You respawn script must be run only in server, not in each client.
    Yup, there should be an ?!isserver:exit check at the start of the script.

  4. #4
    Staff Sergeant Stuntman's Avatar
    Join Date
    Jun 17 2006
    Location
    Tønsberg, Norway
    Posts
    290
    Author of the Thread
    Thanks mates! I will try that right now.

  5. #5
    Staff Sergeant Stuntman's Avatar
    Join Date
    Jun 17 2006
    Location
    Tønsberg, Norway
    Posts
    290
    Author of the Thread
    Sadly it did not work.

    The vehicles still respawn more than once.

    I hope you can help me here, I will write how its set up-

    This is how I have set the script to work:

    in the init file of every empty vehicle, I write

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">&#91;this, xxx&#93; exec &#34;vehciles.sqs&#34;[/QUOTE]

    xxx is the amount of time in seconds before they respawn.
    "vehicles.sqs" is the respawn script file located in the mission folder.
    Some of the vehicles respawn at 10, some at 300, some at 180 etc.

    This is how the script looks like:

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    ?&#33;isserver&#58;exit
    ~2
    _vcl = _this select 0
    _vcltype = typeof _vcl
    _vcldir = getdir _vcl
    _vclpos = getpos _vcl
    _delay = _this select 1

    #alive
    ?&#33; alive _vcl&#58;goto &#34;notalive&#34;
    ~1
    goto &#34;alive&#34;

    #notalive
    ~_delay

    deletevehicle _vcl
    ~1
    _vcl = _vcltype createvehicle _vclpos
    _vcl setdir _vcldir
    goto &#34;alive&#34;
    [/QUOTE]

    Is this information helpful enough? Is the script maybe wrong or something wrongly placed?

    Hope you guys can help me here&#33;






  6. #6
    Moderator [FRL]Myke's Avatar
    Join Date
    May 27 2007
    Location
    Yay, Rank 34 of 47119 and catching up.
    Posts
    5,699
    Can&#39;t say exactly whats wrong there but i&#39;ve wrote an own respawn script.

    It is in sqf and should be a little more CPU friendly.

    vehicle_respawn.sqf
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    if &#40;&#33; isServer&#41; exitwith {};
    sleep 2;
    _vehicle = _this select 0;
    _delay = _this select 1;
    _numbers = _this select 2;
    _counter = 0;
    _veh_type = typeof _vehicle;
    _veh_pos = getpos _vehicle;
    _veh_dir = getdir _vehicle;
    while {_counter &#33;= _numbers} do {
    *** *** *** ***while {alive _vehicle} do {sleep 1};
    *** *** *** ***sleep &#40;&#40;_delay/5&#41;*4&#41;;
    *** *** *** ***deletevehicle _vehicle;
    *** *** *** ***sleep &#40;_delay / 5&#41;;
    *** *** *** ***_vehicle = _veh_type createvehicle _veh_pos;
    *** *** *** ***_vehicle setdir _veh_dir;
    *** *** *** ***_counter = _counter + 1;
    };
    [/QUOTE]

    Call this script from the initline as you did before:
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    nul = &#91;this, 50, -1&#93; execVM &#34;vehicle_respawn.sqf&#34;
    [/QUOTE]
    I&#39;ve added a third parameter to make limited respawns. If you set -1 it is unlimited, else just insert the number of times the vehicle should respawn (i.e. 5 will let the vehicle 5 times).

    Hope this helps and you get your problem solved.


    Myke out

  7. #7
    Staff Sergeant Stuntman's Avatar
    Join Date
    Jun 17 2006
    Location
    Tønsberg, Norway
    Posts
    290
    Author of the Thread
    Thanks a lot pal&#33;

    I will give you a message if it does or does not work.

  8. #8
    Staff Sergeant Stuntman's Avatar
    Join Date
    Jun 17 2006
    Location
    Tønsberg, Norway
    Posts
    290
    Author of the Thread
    The script works, but after intense respawn tests, its starting to bug out after 3 mins.

    I will try to say it as clear as possible: they respawn in order again and again. But after 3 minutes of respawning right after each other, they suddenly start to respawn at a random time.

    Its respawning multiple vehciles at the same time....but one at the correct time and the rest at a random time.

    This continues to happen; if we blow one tank up, one will respawn at correct time....and one will do it in random time afterwards.

    In the end we got like 4 tanks at one respawn point, and if we destroy on of those 4 tanks, they stack up etc.

    Is this an ArmA limitation?

  9. #9
    Moderator [FRL]Myke's Avatar
    Join Date
    May 27 2007
    Location
    Yay, Rank 34 of 47119 and catching up.
    Posts
    5,699
    Odd things happen to you, mate.

    Let&#39;s see if it is really only running on the server. Please edit the script like this:

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    if &#40;&#33; isServer&#41; exitwith {};
    hint &#34;You shouldn&#39;t see this&#34;;
    sleep 2;
    [/QUOTE]

    It&#39;s one line added. After changing this, do some more tests. Unless someone is hosting (means, you don&#39;t play on dedicated) then no one should see the message. If someone hosts, only this player should see the message.

    And, if possible, please watch if
    - a player was/is in the killed vehicle
    - if several players where in the vehicle, does the too many respawned vehicles correspond with players that where in the vehicle.

    Probably not easy to track but i have an idea what it could be. So those info would help to verify if i&#39;m right or wrong.

  10. #10
    Staff Sergeant Stuntman's Avatar
    Join Date
    Jun 17 2006
    Location
    Tønsberg, Norway
    Posts
    290
    Author of the Thread
    Going to test it out.

    Btw, I forgot to tell you that I have both the custom script for empty vehicles (target practise) and the built in arma vehicle respawn script for some other tanks spread around.

    in the description.ext I have "respawnVehicleDelay = 180;"


    So I wonder if that built in script for some odd reason conflicts with the custom script?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •