Jump to content

Recommended Posts

Hello, everyone. Would you help me with the following idea I have in mind: I want a specific item or a custom object, that can be placed in the inventory (and via a script also checked if it's inside of it - to complete the task), to be spawned after a trigger is activated within a specific trigger's/marker's area, for example inside a building (where the trigger or the market is placed to make it appear there like a custom loot). So the player must find the item and collect it, but it should appear on different locations within this area, somewhere in the building. After the item is picked up, a task is finished successfully. What can I use to make it work? Another possible condition, instead of trigger's/marker's area, could be player distance _object < X, and when the player is close enough, the item shall spawn somewhere around... and in this case, I guess, it should be again within a specific area, marked by a trigger or a map marker... So I'd prefer the first option with another condition.

Thank you in advance! 🙂

Share this post


Link to post
Share on other sites

The other possible way is to use several markers (for example 5 or 10) as custom positions and the specific object/item must spawn at one of the possible positions, but every time at a random/new one. That's also a good idea, but which one would be easier to do or more effective? 🙂

Share this post


Link to post
Share on other sites

@black_hawk_mw2_87,
 

Quote

 I want a specific item or a custom object, that can be placed in the inventory (and via a script also checked if it's inside of it - to complete the task), to be spawned after a trigger is activated within a specific trigger's/marker's area...

Quote

The other possible way is to use several markers (for example 5 or 10) as custom positions and the specific object/item must spawn at one of the possible positions,


You have the right idea. I would set up helpers in a few places where the object could spawn. Then ,when player hits trigger zone, object will appear at one of those places randomly.

hiddenOBJECTpos= [pos1, pos2, pos3] call BIS_fnc_selectRandom;
object hideObject false;
object setpos (getpos hiddenObjectpos);

 

  • Like 3

Share this post


Link to post
Share on other sites
1 hour ago, wogz187 said:

@black_hawk_mw2_87,
 


You have the right idea. I would set up helpers in a few places where the object could spawn. Then ,when player hits trigger zone, object will appear at one of those places randomly.


hiddenOBJECTpos= [pos1, pos2, pos3] call BIS_fnc_selectRandom;
object hideObject false;
object setpos (getpos hiddenObjectpos);

 

You, my friend, saved the day! Time for testing! 🙂

  • Like 1

Share this post


Link to post
Share on other sites
6 minutes ago, black_hawk_mw2_87 said:

You, my friend, saved the day! Time for testing! 🙂

By the way, should I place the object anywhere on the map and name it in the init's field (variable name)? 🙂

Share this post


Link to post
Share on other sites
58 minutes ago, black_hawk_mw2_87 said:

By the way, should I place the object anywhere on the map and name it in the init's field (variable name)? 🙂

Yes. There's a few ways to deal with this depending on the object. If it's a static object just show/hide should be fine. 

  • Like 1

Share this post


Link to post
Share on other sites

Could always just use random markers with the createVehicle command? created from some random building positions.

_vehicle = createVehicle[ "someObject", _position, [ "marker_1", "marker_2", "marker_3" ], 0, "CAN_COLLIDE" ];

Just a quick example mission needs some tidying to make sure there are no crap positions.

  • Like 3

Share this post


Link to post
Share on other sites

@Larrow

Quote

Could always just use random markers with the createVehicle command? created from some random building positions.

But why? How is this a better solution? I'm not being sarcastic, I'm genuinely curious because,

Quote

needs some tidying to make sure there are no crap positions.

this solution comes with a new problem.

Is it for MP compatibility or something else I don't understand?

Edited by wogz187
there's a lot I don't understand...
  • Like 2

Share this post


Link to post
Share on other sites
33 minutes ago, wogz187 said:

But why? How is this a better solution?

Never said its a better solution. Its just another option based on the OP where random building/markers where mentioned.

  • Like 2

Share this post


Link to post
Share on other sites
11 hours ago, wogz187 said:

@black_hawk_mw2_87,
 


You have the right idea. I would set up helpers in a few places where the object could spawn. Then ,when player hits trigger zone, object will appear at one of those places randomly.


hiddenOBJECTpos= [pos1, pos2, pos3] call BIS_fnc_selectRandom;
object hideObject false;
object setpos (getpos hiddenObjectpos);

 

This doesn't work for some reason, which is weird. Nothing happens when I enter the trigger. I even use a show/hide module to hide the object and name it object1, and I use the same name in the script, instead of just "object". I tried first with the code like it is.

 

7 hours ago, Larrow said:

Could always just use random markers with the createVehicle command? created from some random building positions.


_vehicle = createVehicle[ "someObject", _position, [ "marker_1", "marker_2", "marker_3" ], 0, "CAN_COLLIDE" ];

Just a quick example mission needs some tidying to make sure there are no crap positions.

This one doesn't work either. = "Local variable in global space" is the error message when I try to close the trigger by clicking OK.

Share this post


Link to post
Share on other sites

@black_hawk_mw2_87,

Don't use modules just un-check "show object" in object properties "object: special states". All the scripts work, try like this,

 

438077-1566274939.png

hiddenOBJECTpos= [hideSPOT1, hideSPOT2, hideSPOT3] call BIS_fnc_selectRandom; 

hideBOX hideObject false; 

hideBOX setpos (getpos hiddenOBJECTpos);

if you make the trigger repeatable it will hide again.

  • Like 3

Share this post


Link to post
Share on other sites
1 hour ago, wogz187 said:

@black_hawk_mw2_87,

Don'y use modules just un-check "show object" in object properties "object: special states". All the scripts work, try like this,

 

438077-1566274939.png


hiddenOBJECTpos= [hideSPOT1, hideSPOT2, hideSPOT3] call BIS_fnc_selectRandom; 

hideBOX hideObject false; 

hideBOX setpos (getpos hiddenOBJECTpos);

if you make the trigger repeatable it will hide again.

OK, thank you very much for the answer and I will definitely try it out as soon as go back home. As far as I understand, I must put the object and ONLY change its special state in the properties, as you mentioned above? I mean, without the show/hide module as well. But do I  need to set a variable name for this object and which one exactly? Or may be not because of its special "hidden" state? Please, explain this to me step by step, as the questions follow. 🙂 I will be very thankful, mate! I have asked about the variable name because I didn't see one in your script above... Than you in advance! 🙂 And one more question - do I need to use some special markers in the map and as far as I know, their variable names should be changed to hideSPOT1, 2... etc. Your script above, on the other hand, should be put in the On Activation field of a trigger, and when it's activated by a condition, it should work out and spawn the object. Would all this work for other items that could be taken/picked up by the player inside his inventory, like the GPS device for example? 🙂

Edited by black_hawk_mw2_87

Share this post


Link to post
Share on other sites
11 hours ago, Larrow said:

Could always just use random markers with the createVehicle command? created from some random building positions.


_vehicle = createVehicle[ "someObject", _position, [ "marker_1", "marker_2", "marker_3" ], 0, "CAN_COLLIDE" ];

Just a quick example mission needs some tidying to make sure there are no crap positions.

Thank you for for the example, but do I need to put the specific item's name (from the editor) in the brackets, instead of "someObject"? 🙂

Share this post


Link to post
Share on other sites

@black_hawk_mw2_87,

 

Quote

do I need to use some special markers in the map and as far as I know, their variable names should be changed to hideSPOT1, 2... etc. Your script above, on the other hand, should be put in the On Activation field of a trigger, and when it's activated by a condition, it should work out and spawn the object. Would all this work for other items that could be taken/picked up by the player inside his inventory, like the GPS device for example?

Yes, yes, yes. Name the object, name the 3 hiding spots put those names in the script, put the script in a trigger. It will work for any object, item, character (vehicle).

 

Quote

Thank you for for the example, but do I need to put the specific item's name (from the editor) in the brackets, instead of "someObject"? 🙂

Yes. Exactly.

  • Like 1
  • Thanks 1

Share this post


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

@black_hawk_mw2_87,

 

Yes, yes, yes. Name the object, name the 3 hiding spots put those names in the script, put the script in a trigger. It will work for any object, item, character (vehicle).

 

Yes. Exactly.

Thank you again! No 🛌 sleep tonight, I am going to 💼 work on my 🆕 campaign... 😎 It is going to be very complex and full of scripts.

  • Like 2

Share this post


Link to post
Share on other sites
17 hours ago, black_hawk_mw2_87 said:

Thank you again! No 🛌 sleep tonight, I am going to 💼 work on my 🆕 campaign... 😎 It is going to be very complex and full of scripts.

But it didn't work for me again... 😞 Which is quite strange and annoying considering other complicated scripts I have managed to get working. I will try that other example scenario from one of the posts above. Would you send me a working test scenario from the screenshot above, #wogz187? I really need this script for my latest scenario. 🙂 Thank you in advance.

Share this post


Link to post
Share on other sites

@black_hawk_mw2_87,

Quote

Would you send me a working test scenario from the screenshot above, #wogz187? I really need this script for my latest scenario.


Yup.

 

Drive link

Your test script is in my current "workshop" file so there's a few interesting things in there,
1) A multi-cam set up
2) [FTA] Money Script example
3) Your Object hider
4) A "healing bed"

"hideAbox.sqf" is the script you're looking for,

Have fun!

Use the @ symbol + username to mention somebody in a topic. I almost missed this.

  • Like 3

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

×