Jump to content

Recommended Posts

Hey, great work. Super easy to use. I am getting this error though when the unit spawns in...
 

Error Reserved variable in expression

file functions\sarogahtyp_SSC\fn_spawn.sqf [saroSSC_fnc_spawn], line 319

 

Here's line 319.. i'm a script noob so it looks fine to me. -   missionNamespace setVariable [(_x select 31), _unit];

 

Anyone else run into this? Basically i'd like a group or specific unit to have a name i can call from other task scripts so we can cache everything and then spawn them once players are nearby and have them kill the HVT and complete their objective. I'm not sure it's storing the unit variable name we type in from the editor.

 

regards

Gav

  • Like 1

Share this post


Link to post
Share on other sites

Hey gav!
I'm sorry but currently I am totally busy and so I can't work on that error now.
I've been run into the same problem as I put the script on my server some weeks ago. I just commented that line out and everything worked fine.
But if I understood your effort then u need this line because I want to access the variable name given in editor.
I think u have to wait one or two weeks until I have the time to fix it.
What I can do is to drop a link with that version I'm using on my server. I can do this tomorrow morning...

sent from mobile using Tapatalk

Share this post


Link to post
Share on other sites

Fixed error but u cant use that editor given var name:

SSSC

 

EDIT:

but maybe the error comes from not white listing the command

setVehicleVarName

for usage with remoteExec in ur missions decription.ext

U can try to do this but idk if this would help to get rid of that error.

Share this post


Link to post
Share on other sites

@gavc

Okay, I worked on that error and it turns out that it is only spam in the rpt file. It is caused by units which dont have a editor given variable name. That mean that u can avoid this error message if u just name all units/vecs which will be handled by my script.

I ll release a fixed version but this will take some time because I ll fix some other stuff with that release as well.

  • Like 1

Share this post


Link to post
Share on other sites

New Release (first post updated):

 

Sarogahtyps Spawn Script Creator - SSSC Alpha 0.5

 

Changelog:

V 0.5 Alpha - 07.06.2017

fixed a bug with editor given variable names (thx for report @gavc)

added saving of stuff in backpacks, vests and uniforms inside of vehicle inventories.

added saroSSC_fnc_set_options - now u r able to set saving options for units and vehicles. see fn_set_options.sqf header for further informations. this function has to be called before saroSSC_fnc_save. it will destroy all allready saved information because of array structure changes.

added support for setFace and face

added support for setNameSound and nameSound

added support for setPitch and pitch

added support for setAmmo and ammo

added support for setBleedingRemaining and getBleedingRemaining

added support for getOxygenRemaining

added support for unitRecoilCoefficient

restructured some array for faster handling

Share this post


Link to post
Share on other sites

Hi, this looks just like something I need. I really dig this save everything for respawn. Thanks a lot!

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, Janez said:

Hi, this looks just like something I need. I really dig this save everything for respawn. Thanks a lot!

You r welcome :-)

Just tell me if u encounter any problems with using it. I will try to help for sure.

Also report any issues, bugs, wishes and/or suggestions please. I will work on it for sure if I get those kind feedback.

 

Share this post


Link to post
Share on other sites

Even with my abysmal scripting knowledge and a little help we managed to get this working to make some great ambushes on our insurgency mission.

Thanks again for the update.


Gav

  • Like 1

Share this post


Link to post
Share on other sites

I'm thinking about giving this a try this weekend. Have you done any testing on dedicated servers or with headless clients present?

  • Like 1

Share this post


Link to post
Share on other sites

Hey, i m running it on one of my 3 HCs without any problems. If you ve issues then just ask.

sent from mobile using Tapatalk

  • Like 1

Share this post


Link to post
Share on other sites
On 23.6.2017 at 8:08 PM, diehardfc said:

I'm thinking about giving this a try this weekend. Have you done any testing on dedicated servers or with headless clients present?

to be more specific:

SSSC uses MP methods and is compatible with dedicated server environment.

All things which need to be propagated through network are done this way in MP environment.

SSSC uses ...Global commands like addWeaponGlobal  and uses remoteExec where it is needed to get the stuff working in MP environment.

SSSC doesn't use any isServer or similar condition because  the mission creator alone has to decide where the provided functions should run.

Share this post


Link to post
Share on other sites

I'll do it if I ve time for it but may take a while...

  • Like 1

Share this post


Link to post
Share on other sites

im currently us Murklors spawn system which is very simple to use but has errors...

So im trying to get my head around this system... 

 

If I understand this correctly I could for example index or mark some groups as "0" And then put thIs " [0] call saroSSC_fnc_spawn; " into a trigger and activate how I wish? And this will spawn the deleted groups back into the game when trigger is activated? Apologies if it's very obvious.

Share this post


Link to post
Share on other sites
12 minutes ago, katipo66 said:

im currently us Murklors spawn system which is very simple to use but has errors...

So im trying to get my head around this system... 

 

If I understand this correctly I could for example index or mark some groups as "0" And then put thIs " [0] call saroSSC_fnc_spawn; " into a trigger and activate how I wish? And this will spawn the deleted groups back into the game when trigger is activated? Apologies if it's very obvious.

Yes. It is a simple description about it but this is the way like it works.

 

Necessary steps:
1. editor placing units

2. marking one unit of each group with an index - [this, 123] call saroSSC_fnc_mark;

3. saving the current state of a marked group at the time you want to - [123] call saroSSC_fnc_save;

4. deleting all groups with a specific index at the time you like - [123] call saroSSC_fnc_delete;

5. spawn all saved units in (maybe with a trigger) - [123] call saroSSC_fnc_spawn;

X. You can repeat step 3.-5. as long as you want.

Share this post


Link to post
Share on other sites
Just now, sarogahtyp said:

Yes. It is a simple description about it but this is the way like it works.

 

Necessary steps:
1. editor placing units

2. marking one unit of each group with an index - [this, 123] call saroSSC_fnc_mark;

3. saving the current state of a marked group at the time you want to - [123] call saroSSC_fnc_save;

4. deleting all groups with a specific index at the time you like - [123] call saroSSC_fnc_delete;

5. spawn all saved units in (maybe with a trigger) - [123] call saroSSC_fnc_spawn;

X. You can repeat step 3.-5. as long as you want.

 

Hmm.. ok cool, thanks for quick reply, I think I can visualise this in my little brain now, I can fnc_save and fnc_delete in a script (init.sqf for example) and spawn with a trigger when ever I want, nice... sounds great, I can't wait to test it out next chance, thanks again :)

Share this post


Link to post
Share on other sites



 
Hmm.. ok cool, thanks for quick reply, I think I can visualise this in my little brain now, I can fnc_save and fnc_delete in a script (init.sqf for example) and spawn with a trigger when ever I want, nice... sounds great, I can't wait to test it out next chance, thanks again :)


Yeah, Just play around a bit with the demo mission and u LL get fast how to handle it

sent from mobile using Tapatalk

Share this post


Link to post
Share on other sites
On 8/16/2017 at 0:05 AM, sarogahtyp said:


 

 


Yeah, Just play around a bit with the demo mission and u LL get fast how to handle it

sent from mobile using Tapatalk
 

 

 

Yeah! i got my head around it... this is a great set of scripts, i found it very simple in the end...

 

Would be cool if you had something like a distance check [this, 0, distance] call saroSSC_fnc_spawn;

 

Cheers again!

Share this post


Link to post
Share on other sites
Guest

 

Using your sample mission with a few modifications, there are errors coming up when your system tries to hide/show enemies that are killed.

 

Sample mission adjustments:


2 units west

4 units east

West units waypoint plan allows full engagement (no longer switches to combatmode blue/careless).

West units delete and spawn only once to allow full engagement of enemies.

Time of enemies remaining spawned before deleting increased to allow high chance of enemies being killed in-between each hide/show cycle.

Normally 1 out of 2 tests reveal the errors.


Errors from RPT :


15:44:15 Error in expression <ect 7);
_unit stop (_x select 8);
_unit setSuppression (_x select 9);
_unit setD>
15:44:15   Error position: <setSuppression (_x select 9);
_unit setD>
15:44:15   Error setsuppression: Type Array, expected Number
15:44:15 File functions\sarogahtyp_SSC\fn_spawn.sqf [saroSSC_fnc_spawn], line 425
15:44:18 Error in expression <ndex";
_x removeEventHandler ["killed", _eh_index];
} count _local_leader_array;>
15:44:18   Error position: <_eh_index];
} count _local_leader_array;>
15:44:18   Error Undefined variable in expression: _eh_index
15:44:18 File functions\sarogahtyp_SSC\fn_unmark.sqf [saroSSC_fnc_unmark], line 24
15:44:18 Error in expression <ndex";
_x removeEventHandler ["killed", _eh_index];
} count _local_leader_array;>
15:44:18   Error position: <_eh_index];
} count _local_leader_array;>
15:44:18   Error Undefined variable in expression: _eh_index
15:44:18 File functions\sarogahtyp_SSC\fn_unmark.sqf [saroSSC_fnc_unmark], line 24

 

 

In the Spoiler tab is both the InitServer.sqf code and the Mission.sqf code if you would like to use them to replicate the errors in game:

 

Spoiler

InitServer.Sqf :


_test_SSSC = true;  // set to false to test mission without SSSC

if (_test_SSSC) then
{
[0] call saroSSC_fnc_save;

[0] call saroSSC_fnc_delete;
sleep 3;

[1] call saroSSC_fnc_save;
[1] call saroSSC_fnc_delete;

[0] call saroSSC_fnc_spawn;

sleep 3;

[1] call saroSSC_fnc_spawn;

sleep 5;
//[0] call saroSSC_fnc_delete;
[1] call saroSSC_fnc_delete;

sleep 2;
//[0] call saroSSC_fnc_spawn;
[1] call saroSSC_fnc_spawn;

sleep 5;
//[0] call saroSSC_fnc_save;
[1] call saroSSC_fnc_save;
//[0] call saroSSC_fnc_delete;
[1] call saroSSC_fnc_delete;

sleep 3;
//[0] call saroSSC_fnc_spawn;
[1] call saroSSC_fnc_spawn;

sleep 3;

hint format ["Papas name is: %1", (str papa)];

[1] call saroSSC_fnc_destroy;
[1] call saroSSC_fnc_unmark;
[0] call saroSSC_fnc_destroy;
[0] call saroSSC_fnc_unmark;
};

 

Mission.sqf

 

version=53;
class EditorData
{
    moveGridStep=1;
    angleGridStep=0.2617994;
    scaleGridStep=1;
    autoGroupingDist=10;
    toggles=1;
    class ItemIDProvider
    {
        nextID=28;
    };
    class Camera
    {
        pos[]={23781.199,71.86261,18507.947};
        dir[]={0.89359379,-0.2502149,0.37269124};
        up[]={0.23093987,0.96818882,0.096317627};
        aside[]={0.38493502,-8.1010512e-008,-0.92295152};
    };
};
binarizationWanted=0;
addons[]=
{
    "A3_Characters_F",
    "A3_Soft_F_Beta_Truck_01"
};
class AddonsMetaData
{
    class List
    {
        items=2;
        class Item0
        {
            className="A3_Characters_F";
            name="Arma 3 Alpha - Characters and Clothing";
            author="Bohemia Interactive";
            url="https://www.arma3.com";
        };
        class Item1
        {
            className="A3_Soft_F_Beta";
            name="Arma 3 Beta - Unarmored Land Vehicles";
            author="Bohemia Interactive";
            url="https://www.arma3.com";
        };
    };
};
randomSeed=13280573;
class ScenarioData
{
    author="sarogahtyp";
};
class Intro
{
    class Intel
    {
        timeOfChanges=1800.0002;
        startWeather=0.30000001;
        startWind=0.1;
        startWaves=0.1;
        forecastWeather=0.30000001;
        forecastWind=0.1;
        forecastWaves=0.1;
        forecastLightnings=0.1;
        year=2035;
        month=6;
        day=24;
        hour=12;
        minute=0;
        startFogDecay=0.013;
        forecastFogDecay=0.013;
    };
};
class Mission
{
    class Intel
    {
        timeOfChanges=1800.0002;
        startWeather=0.30000001;
        startWind=0.1;
        startWaves=0.1;
        forecastWeather=0.30000001;
        forecastWind=0.1;
        forecastWaves=0.1;
        forecastLightnings=0.1;
        year=2035;
        month=6;
        day=24;
        hour=12;
        minute=0;
        startFogDecay=0.013;
        forecastFogDecay=0.013;
    };
    class Entities
    {
        items=6;
        class Item0
        {
            dataType="Group";
            side="West";
            class Entities
            {
                items=1;
                class Item0
                {
                    dataType="Object";
                    class PositionInfo
                    {
                        position[]={23815.166,3.1914389,18642.998};
                    };
                    side="West";
                    flags=6;
                    class Attributes
                    {
                        skill=0.40000001;
                        init="this setCaptive true";
                        isPlayer=1;
                        isPlayable=1;
                    };
                    id=8;
                    type="B_Soldier_F";
                };
            };
            class Attributes
            {
            };
            id=7;
        };
        class Item1
        {
            dataType="Group";
            side="West";
            class Entities
            {
                items=5;
                class Item0
                {
                    dataType="Object";
                    class PositionInfo
                    {
                        position[]={23807.561,3.1914389,18670.467};
                        angles[]={-0,1.3495127,0};
                    };
                    side="West";
                    flags=6;
                    class Attributes
                    {
                        skill=1;
                        rank="SERGEANT";
                        name="papa";
                        aiRadarUsage=2869;
                    };
                    id=10;
                    type="B_Soldier_TL_F";
                    class CustomAttributes
                    {
                        class Attribute0
                        {
                            property="allowDamage";
                            expression="_this allowdamage _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "BOOL"
                                        };
                                    };
                                    value=0;
                                };
                            };
                        };
                        class Attribute1
                        {
                            property="speaker";
                            expression="_this setspeaker _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "STRING"
                                        };
                                    };
                                    value="Male03ENG";
                                };
                            };
                        };
                        class Attribute2
                        {
                            property="pitch";
                            expression="_this setpitch _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "SCALAR"
                                        };
                                    };
                                    value=1.02;
                                };
                            };
                        };
                        nAttributes=3;
                    };
                };
                class Item1
                {
                    dataType="Object";
                    class PositionInfo
                    {
                        position[]={23812.561,3.1914389,18665.518};
                        angles[]={-0,1.2866184,0};
                    };
                    side="West";
                    flags=4;
                    class Attributes
                    {
                        skill=1;
                        rank="CORPORAL";
                        init="call{this call saroSSC_fnc_mark;}";
                    };
                    id=11;
                    type="B_soldier_UAV_F";
                    class CustomAttributes
                    {
                        class Attribute0
                        {
                            property="allowDamage";
                            expression="_this allowdamage _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "BOOL"
                                        };
                                    };
                                    value=0;
                                };
                            };
                        };
                        class Attribute1
                        {
                            property="speaker";
                            expression="_this setspeaker _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "STRING"
                                        };
                                    };
                                    value="Male09ENG";
                                };
                            };
                        };
                        class Attribute2
                        {
                            property="pitch";
                            expression="_this setpitch _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "SCALAR"
                                        };
                                    };
                                    value=1.02;
                                };
                            };
                        };
                        nAttributes=3;
                    };
                };
                class Item2
                {
                    dataType="Waypoint";
                    position[]={23811.211,3.1900001,18679.988};
                    combatMode="RED";
                    combat="AWARE";
                    expCond="call{true}";
                    class Effects
                    {
                    };
                    showWP="NEVER";
                    id=12;
                    type="Move";
                };
                class Item3
                {
                    dataType="Waypoint";
                    position[]={23819.73,3.1900001,18711.703};
                    speed="FULL";
                    class Effects
                    {
                    };
                    showWP="NEVER";
                    id=13;
                    type="Move";
                };
                class Item4
                {
                    dataType="Waypoint";
                    position[]={23828.602,3.1900001,18721.852};
                    type="Join";
                    synchronizations[]={0};
                    class Effects
                    {
                    };
                    showWP="NEVER";
                    syncId=2;
                    id=14;
                };
            };
            class Attributes
            {
            };
            id=9;
        };
        class Item2
        {
            dataType="Group";
            side="East";
            class Entities
            {
                items=2;
                class Item0
                {
                    dataType="Object";
                    class PositionInfo
                    {
                        position[]={23858.188,3.1914389,18686.086};
                    };
                    side="East";
                    flags=6;
                    class Attributes
                    {
                        rank="SERGEANT";
                        name="track";
                        aiRadarUsage=-947134159;
                    };
                    id=16;
                    type="O_Soldier_F";
                    class CustomAttributes
                    {
                        class Attribute0
                        {
                            property="speaker";
                            expression="_this setspeaker _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "STRING"
                                        };
                                    };
                                    value="Male01PER";
                                };
                            };
                        };
                        class Attribute1
                        {
                            property="pitch";
                            expression="_this setpitch _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "SCALAR"
                                        };
                                    };
                                    value=0.95999998;
                                };
                            };
                        };
                        nAttributes=2;
                    };
                };
                class Item1
                {
                    dataType="Object";
                    class PositionInfo
                    {
                        position[]={23863.188,3.1914389,18681.137};
                    };
                    side="East";
                    flags=4;
                    class Attributes
                    {
                        rank="SERGEANT";
                        init="[this, 1] call saroSSC_fnc_mark;";
                        name="pups";
                        aiRadarUsage=-8760129;
                    };
                    id=17;
                    type="O_Soldier_F";
                    class CustomAttributes
                    {
                        class Attribute0
                        {
                            property="speaker";
                            expression="_this setspeaker _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "STRING"
                                        };
                                    };
                                    value="Male02PER";
                                };
                            };
                        };
                        class Attribute1
                        {
                            property="pitch";
                            expression="_this setpitch _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "SCALAR"
                                        };
                                    };
                                    value=1.03;
                                };
                            };
                        };
                        nAttributes=2;
                    };
                };
            };
            class Attributes
            {
            };
            id=15;
        };
        class Item3
        {
            dataType="Group";
            side="East";
            class Entities
            {
                items=2;
                class Item0
                {
                    dataType="Object";
                    class PositionInfo
                    {
                        position[]={23866.262,3.1914389,18708.568};
                    };
                    side="East";
                    flags=6;
                    class Attributes
                    {
                        rank="SERGEANT";
                        name="tricky";
                    };
                    id=19;
                    type="O_Soldier_F";
                    class CustomAttributes
                    {
                        class Attribute0
                        {
                            property="speaker";
                            expression="_this setspeaker _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "STRING"
                                        };
                                    };
                                    value="Male03PER";
                                };
                            };
                        };
                        class Attribute1
                        {
                            property="pitch";
                            expression="_this setpitch _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "SCALAR"
                                        };
                                    };
                                    value=0.98000002;
                                };
                            };
                        };
                        nAttributes=2;
                    };
                };
                class Item1
                {
                    dataType="Object";
                    class PositionInfo
                    {
                        position[]={23871.262,3.1914389,18703.619};
                    };
                    side="East";
                    flags=4;
                    class Attributes
                    {
                        rank="SERGEANT";
                        init="[this, 1] call saroSSC_fnc_mark;";
                        name="sleepy";
                    };
                    id=20;
                    type="O_Soldier_F";
                    class CustomAttributes
                    {
                        class Attribute0
                        {
                            property="speaker";
                            expression="_this setspeaker _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "STRING"
                                        };
                                    };
                                    value="Male01PER";
                                };
                            };
                        };
                        class Attribute1
                        {
                            property="pitch";
                            expression="_this setpitch _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "SCALAR"
                                        };
                                    };
                                    value=0.98000002;
                                };
                            };
                        };
                        nAttributes=2;
                    };
                };
            };
            class Attributes
            {
            };
            id=18;
        };
        class Item4
        {
            dataType="Group";
            side="West";
            class Entities
            {
                items=5;
                class Item0
                {
                    dataType="Object";
                    class PositionInfo
                    {
                        position[]={24542.061,3.175941,18672.012};
                        angles[]={0,4.6659107,6.2805324};
                    };
                    side="West";
                    flags=6;
                    class Attributes
                    {
                        name="transporterD";
                        aiRadarUsage=-1920997461;
                    };
                    id=23;
                    type="B_Soldier_F";
                };
                class Item1
                {
                    dataType="Waypoint";
                    position[]={24000.395,3.1900001,18669.656};
                    class Effects
                    {
                    };
                    showWP="NEVER";
                    id=24;
                    type="Move";
                };
                class Item2
                {
                    dataType="Waypoint";
                    position[]={23840.43,3.1900001,18670.814};
                    type="Load";
                    synchronizations[]={1};
                    class Effects
                    {
                    };
                    showWP="NEVER";
                    syncId=3;
                    id=25;
                };
                class Item3
                {
                    dataType="Waypoint";
                    position[]={23799.795,3.1900001,18670.82};
                    class Effects
                    {
                    };
                    showWP="NEVER";
                    id=26;
                    type="Move";
                };
                class Item4
                {
                    dataType="Waypoint";
                    position[]={23756.172,3.1900001,18646.678};
                    expActiv="_d= {_x setDamage 1} count vehicles";
                    class Effects
                    {
                    };
                    showWP="NEVER";
                    id=27;
                    type="Move";
                };
            };
            class Attributes
            {
            };
            class CrewLinks
            {
                class LinkIDProvider
                {
                    nextID=1;
                };
                class Links
                {
                    items=1;
                    class Item0
                    {
                        linkID=0;
                        item0=23;
                        item1=22;
                        class CustomData
                        {
                            role=1;
                        };
                    };
                };
            };
            id=21;
        };
        class Item5
        {
            dataType="Object";
            class PositionInfo
            {
                position[]={24542.066,5.3992848,18671.961};
                angles[]={0,4.6659107,6.2805324};
            };
            side="West";
            flags=6;
            class Attributes
            {
                rank="SERGEANT";
                init="this call saroSSC_fnc_mark;";
                name="transporter";
            };
            id=22;
            type="B_Truck_01_transport_F";
        };
    };
};
class OutroLoose
{
    class Intel
    {
        timeOfChanges=1800.0002;
        startWeather=0.30000001;
        startWind=0.1;
        startWaves=0.1;
        forecastWeather=0.30000001;
        forecastWind=0.1;
        forecastWaves=0.1;
        forecastLightnings=0.1;
        year=2035;
        month=6;
        day=24;
        hour=12;
        minute=0;
        startFogDecay=0.013;
        forecastFogDecay=0.013;
    };
};
class OutroWin
{
    class Intel
    {
        timeOfChanges=1800.0002;
        startWeather=0.30000001;
        startWind=0.1;
        startWaves=0.1;
        forecastWeather=0.30000001;
        forecastWind=0.1;
        forecastWaves=0.1;
        forecastLightnings=0.1;
        year=2035;
        month=6;
        day=24;
        hour=12;
        minute=0;
        startFogDecay=0.013;
        forecastFogDecay=0.013;
    };
};

 

 

 

 

Personally, I am using your spawn/hide system in a manner that would not actually include dead units being dealt with, and so I have not yet seen any issue directly affecting my own usage, but I thought you would at least like to know about these errors.

 

Apart from the error report - thanks for the great work on this, it is saving me tons of time and complexity in trying to script hundreds of units and tons of waypoint plans to be spawned in. This is the kind of thing that should be integrated into the game, it certainly makes MP spawning much easier and therefore provides greater room for more detailed usage of spawned units - like many waypoints with various conditions/etc.

 

 

 

 

 

Share this post


Link to post
Share on other sites

Is it possible to save a leaders/units init? i was wanting to use UPS patrol script but cannot figure out how to apply it after they are spawned back in?

Share this post


Link to post
Share on other sites
Guest
On 9/28/2017 at 7:24 PM, katipo66 said:

Is it possible to save a leaders/units init? i was wanting to use UPS patrol script but cannot figure out how to apply it after they are spawned back in?

 

This is what I have been doing in my scripts right after spawning units via [1] call saroSSC_fnc_spawn :

 

 

[1] call saroSSC_fnc_spawn;

Sleep 1;

WaitUntil {sleep 0.1;((!IsNil "Rus_ParaTrooper_29") && {(!IsNull Rus_ParaTrooper_29)})};
WaitUntil {sleep 0.1;((Count (Units (Group Rus_ParaTrooper_29))) > 5)};
{
_x AllowFleeing 0;
_x DoWatch (_x modelToWorldVisual [0,300,0]);_x DisableAI "Target";
_x setVariable ["AffectOthersOnce",2,false];
} ForEach (Units (Group Rus_ParaTrooper_29));

WaitUntil {sleep 0.1;((!IsNil "Rus_ParaTrooper_20") && {(!IsNull Rus_ParaTrooper_20)})};
WaitUntil {sleep 0.1;((Count (Units (Group Rus_ParaTrooper_20))) > 14)};
{
_x AllowFleeing 0;
_x setVariable ["AffectOthersOnce",2,false];
_x DoWatch (_x modelToWorldVisual [0,300,0]);_x DisableAI "Target";
} ForEach (Units (Group Rus_ParaTrooper_20));

//Now one can safely access the unit global names that have been confirmed to exist in above code

Rus_ParaTrooper_21 DoSomething
Rus_ParaTrooper_22 DoSomething

//Can access groups as well by just using the leaders name or whomever
(Group Rus_ParaTrooper_20) SetCombatMode "RED";
(Group Rus_ParaTrooper_29) SetCombatMode "RED";

 

I have not been able to get group names to be savable, so I'm using the name of each group leader instead - and then the script checks on each groups total unit count, once the unit count is fully where it should be through the spawn, execution of commands for those group units can commence and later in script it should be safe to access the unit names of the spawned units as well. Note that the safety measures for each group in code must be there in the checks to prevent script errors due to the unit name/object not actually existing yet - but it's really easy because it's just copy and paste. Being that these particular units are non-player Ai, they are server sided so indexing of the units in their Init code has 'if (IsServer) then { }; and the script above is executed only on server side. Basically, if the spawning is only for non-player group Ai which it likely often is, the entire usage of the Spawn System here should be kept to server side to avoid duplicate executions on various client ends.

 

A side note as well, that if a waypoint plan ever has a waypoint attached to the unit itself of whom is to be deleted and spawned, it will cause an error that can end the entire spawning function (meaning further unit spawns won't happen) because the script system is trying to attach the waypoint to the no longer existing previous object.

 

 

 

 

 

Share this post


Link to post
Share on other sites
6 hours ago, special ed said:

 

This is what I have been doing in my scripts right after spawning units via [1] call saroSSC_fnc_spawn :

 

 


[1] call saroSSC_fnc_spawn;

Sleep 1;

WaitUntil {sleep 0.1;((!IsNil "Rus_ParaTrooper_29") && {(!IsNull Rus_ParaTrooper_29)})};
WaitUntil {sleep 0.1;((Count (Units (Group Rus_ParaTrooper_29))) > 5)};
{
_x AllowFleeing 0;
_x DoWatch (_x modelToWorldVisual [0,300,0]);_x DisableAI "Target";
_x setVariable ["AffectOthersOnce",2,false];
} ForEach (Units (Group Rus_ParaTrooper_29));

WaitUntil {sleep 0.1;((!IsNil "Rus_ParaTrooper_20") && {(!IsNull Rus_ParaTrooper_20)})};
WaitUntil {sleep 0.1;((Count (Units (Group Rus_ParaTrooper_20))) > 14)};
{
_x AllowFleeing 0;
_x setVariable ["AffectOthersOnce",2,false];
_x DoWatch (_x modelToWorldVisual [0,300,0]);_x DisableAI "Target";
} ForEach (Units (Group Rus_ParaTrooper_20));

//Now one can safely access the unit global names that have been confirmed to exist in above code

Rus_ParaTrooper_21 DoSomething
Rus_ParaTrooper_22 DoSomething

//Can access groups as well by just using the leaders name or whomever
(Group Rus_ParaTrooper_20) SetCombatMode "RED";
(Group Rus_ParaTrooper_29) SetCombatMode "RED";

 

I have not been able to get group names to be savable, so I'm using the name of each group leader instead - and then the script checks on each groups total unit count, once the unit count is fully where it should be through the spawn, execution of commands for those group units can commence and later in script it should be safe to access the unit names of the spawned units as well. Note that the safety measures for each group in code must be there in the checks to prevent script errors due to the unit name/object not actually existing yet - but it's really easy because it's just copy and paste. Being that these particular units are non-player Ai, they are server sided so indexing of the units in their Init code has 'if (IsServer) then { }; and the script above is executed only on server side. Basically, if the spawning is only for non-player group Ai which it likely often is, the entire usage of the Spawn System here should be kept to server side to avoid duplicate executions on various client ends.

 

A side note as well, that if a waypoint plan ever has a waypoint attached to the unit itself of whom is to be deleted and spawned, it will cause an error that can end the entire spawning function (meaning further unit spawns won't happen) because the script system is trying to attach the waypoint to the no longer existing previous object.

 

 

 

 

 

 

Hey Special Ed, awesome... thanks for that!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×