Jump to content
Texeiro

Spawn (custom) compositions

Recommended Posts

I m doing progres learning about srcipting, reading the forums,  editing someone else work, seing tuts on youtube. A few weeks ago I didn´t  know what was an Array. True word.

Now I m trying to edit the  Rawner135 script for camp, tent and camfire spawn.  I want to solve two things. First, Put more objects in the composition. And second, the sleep script that doesn´t work n multiplayer as the autor advertised, but I guess that is a vety complex issue.

My modification at least doesn´t crash or make an error, just doesn´t work.  If anyone could get me a hand on this, will be preciated. Thanks in advance

Quote

/*Script by Rawner135.

private["_objType","_objName","_unit","_unitName","_unitDir","_unitPos","_spawnTime","_spawnDistance","_action"];
_unit = _this select 0;
_action = _this select 2;
_unit removeAction _action;

_objType = ["Land_TentA_F","Land_TentDome_F,"Land_Sleeping_bag_F",]; // I´ve modified this to make an array:  Original was only one object.Please don´t laugh on me...


_unitName = name _unit;
_unitDir = direction _unit;
_unitPos = position _unit;

//Wait time till object is spawned, set 0 for instant
_spawnTime = 9.3;

_spawnDist = 6;


obj1 = _objType createVehicle [0,0,0];   //<-------- I guess that I have to add something here....


_unit playMove "AinvPknlMstpSnonWnonDnon_medicUp3";


sleep _spawnTime;
obj1 setpos (_unit modelToWorld [0,_SpawnDist,0]);
camp1 = obj1 addAction ["<t color=""#F8FF24"">" +format["Pack Up Camp"],"Camp_Script\pack.sqf"];

//To make MP compatible, Remove the the script below!

camp2 = obj1 addAction ["<t color=""#F8FF24"">" +format["Sleep",name _unit],"Camp_Script\sleep.sqf"];


private["_objType2","_objName2","_unit2","_unitName2","_unitDir2","_unitPos2","_spawnTime2","_spawnDistance2","_obj2"];


_objType2 = "FirePlace_burning_F";


_unitName2 = name _unit;
_unitDir2 = direction _unit;


this is the sleep script:

Quote

Sleep Script by Rawner135.


- sleep.sqf - (DO NOT CHANGE NAME!)


TO MAKE THIS MP, REMOVE "sleep.sqf".
TO MAKE IT SP, leave as is.


USAGE:

Place this into your unit's init within the editor, or into the init.sqf:

player addAction ["<t color=""#F8FF24"">" +format["Set Up Camp"],"Camp_Script\spawn.sqf"];


TERMS AND CONDITIONS:

Any changes, modifications and publications of this script by other people MUST give the author (me) credit or recognition.

If used for games, programs, etc (such as GTA), that are not made by Bohemia Interactive, is strictly Forbidden!


 - CopyRight(C) Protected under the BI Community -
*/

//YOU MAY CHANGE THE BELOW
titleCut ["", "BLACK OUT"];
titleCut ["", "BLACK"];
sleep 1;


//Change the 7 hours below to whatever you like
titleText ["7 Hours Later..", "PLAIN"];

/*
Classname of object replacing burning one, you may change but with caution.
*/

obj3 = "Land_FirePlace_F" createVehicle (getPos obj2);


//DO NOT CHANGE!
deleteVehicle obj2;


/*
You may change the below but with caution. You may change the setDate with ease, but make sure it is in this order:

 

Share this post


Link to post
Share on other sites

If not already, for debugging purposes, use -showScriptErrors in startup params and do not use -noLogs.

- Using -showScriptErrors gives a black error box on screen when an error occurs.  Let's you know when there is an error encountered which is quite helpful.

- Not using -noLogs will catch errors in the .rpt log and lets you review the encountered error.  But using -noLogs prevents the .rpt from logging errors.

 

The problem is here . . .

On ‎4‎/‎2‎/‎2019 at 2:55 PM, Texeiro said:

_objType = ["Land_TentA_F","Land_TentDome_F,"Land_Sleeping_bag_F",];

"Land_TentDome_F" is missing a string quote ( " ) at its end, and there is a comma ( , ) after last item of the array.  One would think it should have errored on those.

 

and here . . .

On ‎4‎/‎2‎/‎2019 at 2:55 PM, Texeiro said:

obj1 = _objType createVehicle [0,0,0];  

createVehicle command needs a string classname to create.  You made _objType an array.  createVehicle can't do anything with it.  One would think it should have given a "type array, expected string" error on that.

 

An array could be used, but it really is simpler to create three objects in a row from string.

A problem is that the sleep script shows "obj2" and "obj3" are variables already in use.

You would need to decide what variables to use to reference the additional created objects, and how to position them when obj1 is setPos.

  • Thanks 1

Share this post


Link to post
Share on other sites
10 hours ago, opusfmspol said:

If not already, for debugging purposes, use -showScriptErrors in startup params and do not use -noLogs.

- Using -showScriptErrors gives a black error box on screen when an error occurs.  Let's you know when there is an error encountered which is quite helpful.

- Not using -noLogs will catch errors in the .rpt log and lets you review the encountered error.  But using -noLogs prevents the .rpt from logging errors

Great! I will do!

 

10 hours ago, opusfmspol said:

The problem is here . . .

On 4/2/2019 at 6:55 PM, Texeiro said:

_objType = ["Land_TentA_F","Land_TentDome_F,"Land_Sleeping_bag_F",];

"Land_TentDome_F" is missing a string quote ( " ) at its end, and there is a comma ( , ) after last item of the array.  One would think it should have errored on those.

 

and here . . .

On 4/2/2019 at 6:55 PM, Texeiro said:

obj1 = _objType createVehicle [0,0,0];  

createVehicle command needs a string classname to create.  You made _objType an array.  createVehicle can't do anything with it.  One would think it should have given a "type array, expected string" error on that.

I ll check if I could modify this to work.

 

10 hours ago, opusfmspol said:

An array could be used, but it really is simpler to create three objects in a row from string.

I thought that!  At least I am on the rigth path!

Thank you very much for your help Opus!

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

×