Jump to content
Sign in to follow this  
BennetArms

[Release] Bens Drag&Drop

Recommended Posts

18289576zf.jpg

Downloadlink below

BD&D - Bens Drag & Drop v0.3

-Feature: A Script, that allows players to drag around objects, statics and crates, that are defined in an array of objects. (Supported classnames below)

Hi all

I got the idea to make this little - far from perfect - script, as we are playing with the well-made logistics script -IgiLoad- from Igi_PL. Sometimes we wished to adjust the loadable cargo by hand. The script itself is called from the init.sqf in the mission folder and not from an objects init. So the mission maker doesn't have to name or init any draggable object. It is tested on the dedicated server of the 14.Jägerkompanie.

I see it as a little help, handling the cargo of logistics scripts or mods.

Its about time to share it i guess.

Supported Classnames (so far):

"Box_IND_Ammo_F","Land_MetalBarrel_F","Land_WaterTank_F","Land_WaterBarrel_F","BWA3_Box_Gear","WL_GER_Back_Box_Flecktarn","TF_NATO_Radio_Crate","B_supplyCrate_F","IG_supplyCrate_F","O_supplyCrate_F","I_supplyCrate_F","B_Mortar_01_F","B_HMG_01_F","B_HMG_01_high_F","B_HMG_01_A_F","B_GMG_01_F","B_GMG_01_high_F","B_GMG_01_A_F","B_static_AA_F","B_static_AT_F","B_G_Mortar_01_F","O_Mortar_01_F","O_HMG_01_F","O_HMG_01_high_F","O_HMG_01_A_F","O_GMG_01_F","O_GMG_01_high_F","O_GMG_01_A_F","O_static_AA_F","O_static_AT_F","O_G_Mortar_01_F","I_G_Mortar_01_F","I_Mortar_01_F","I_GMG_01_A_F","I_static_AT_F","I_static_AA_F","I_HMG_01_A_F","I_HMG_01_high_F","I_HMG_01_F","Land_BarrelEmpty_F", "Land_BarrelSand_F", "Land_BarrelTrash_F", "Land_BarrelWater_F", "Land_MetalBarrel_F","Box_NATO_Wps_F", "Box_East_Wps_F", "Box_IND_Wps_F", "Box_East_WpsLaunch_F", "Box_NATO_WpsLaunch_F", "Box_IND_WpsLaunch_F", "Box_IND_WpsSpecial_F","Box_East_WpsSpecial_F","Box_NATO_WpsSpecial_F","BWA3_Box_Gear","WL_GER_Back_Box_Flecktarn","TF_NATO_Radio_Crate","BWA3_Box_Weapons","BWA3_Box_Attachments","BWA3_Box_Ammo","Box_NATO_AmmoOrd_F", "Box_East_AmmoOrd_F", "Box_IND_AmmoOrd_F", "Box_NATO_Grenades_F", "Box_East_Grenades_F", "Box_IND_Grenades_F", "Box_NATO_Ammo_F", "Box_East_Ammo_F", "Box_IND_Ammo_F", "Box_IND_Support_F", "Box_East_Support_F", "Box_NATO_Support_F","Land_CargoBox_V1_F","x39_medicBox","Land_Pallet_MilBoxes_F","Land_PaperBox_closed_F","Land_PaperBox_open_empty_F","Land_PaperBox_open_full_F","Box_NATO_AmmoVeh_F","Box_East_AmmoVeh_F","Box_Ind_AmmoVeh_F","Land_MetalBarrel_empty_F","MetalBarrel_burning_F","Land_BarrelSand_grey_F","Land_BarrelWater_grey_F","Land_BarrelWater_F","Land_BarrelTrash_grey_F","Land_BarrelTrash_F"

To make an object not draggable, add this line to the objects init:

this setvariable ["nodrag",false,true];

Changelog & fixes:

v0.3

-Included a line you can add to an objects init-line. (Exclude objects from dragging). - Thanks to F2k Sel

-While dragging the "X"-Key gets disabled to prevent animation glitches. - Thanks to F2k Sel

-I got a report, that the script disabled the addaction-menu at MCC Sandbox. This got also fixed by another way of removing the specific addaction.

v0.2

-Every Player can Drag simultaneously now.

Future plans to figure out:

Seperation between carrying light things and dragging heavier things.

Issues so far:

//

Only known issue at usage with IgiLoad - Script:

Drop your draggables before loading cargo into vehicles. Otherwise this happens to you:

3lockad3

I was able to load the box in the vehicle by hand, and it got loaded into the vehicle,, buuut I got stuck in an animation till I dropped the item, and when I did that the truck blew up killing me. That is try number 1.

Feedback and hints/tips for improvement is highly appreciated!

######################

Credits and thanks:

Forums Bistudio

An old post from A-Suicidal

F2k Sel

Vienna from Hx3 Forums

14.Jgkp for testing and motivation

[14.jgkp]Merlin - for the nice little graphic

######################

I hope you enjoy it =)

DOWNLOAD:

The script:

https://www.dropbox.com/s/v1ppaicd2q8pkmp/BDD.7z

Example mission with script:

https://www.dropbox.com/s/8zkdlgms7fo65pb/Bens_Drag_and_Drop.Stratis.7z

Edited by BennetArms
Version 3 uploaded

Share this post


Link to post
Share on other sites

Oh nice, I was thinking about something similar.

I guess we could also check the size/boundingbox to determine if an object is draggable or not. Not sure how well that would work.

Share this post


Link to post
Share on other sites

Other then dragging things around what is the point to this script ?

Can I load boxes into victors ? Or is that end goal ?

Share this post


Link to post
Share on other sites
Guest

Release frontpaged on the Armaholic homepage.

==================================================

You are not registered on Armaholic, or at least not that we are aware of. In the future we offer the possibility to authors to maintain their own pages.

If you wish to be able to do this as well please register on Armaholic and let me know about it.

This is not mandatory at all! Only if you wish to control your own content you are welcome to join, otherwise we will continue to follow your work like we have always done ;)

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Ah very good, was trying this also but have no time for updating my Drag&Drop Script. Nice work !

Share this post


Link to post
Share on other sites

Thank you Foxhound =)

Other then dragging things around what is the point to this script ?

Can I load boxes into victors ? Or is that end goal ?

Im sorry if this was not clearly stated through the description.

The only goal was to ease up the cargo-handling to play nicely together with the logistics script from IgiPL. Because at his script - which is incredibly well done - there is no drag option. =)

His amazing script thread here:

http://forums.bistudio.com/showthread.php?173109-IgiLoad-script-logistical-support

Edited by BennetArms

Share this post


Link to post
Share on other sites

Fixed: Every player can drag simultaneously now.

Cigar0

Ah very good, was trying this also but have no time for updating my Drag&Drop Script. Nice work !

Cool Script Cigar0 - you inspired me to future plans =)

Now i try to seperate dragging items from carrying items.

Share this post


Link to post
Share on other sites
Thank you Foxhound =)

Im sorry if this was not clearly stated through the description.

The only goal was to ease up the cargo-handling to play nicely together with the logistics script from IgiPL. Because at his script - which is incredibly well done - there is no drag option. =)

His amazing script thread here:

http://forums.bistudio.com/showthread.php?173109-IgiLoad-script-logistical-support

Ah okay I get the point now,, I'll now have to check this out.

Cheers mate

Share this post


Link to post
Share on other sites

This is just what we need. And this could potentially be a great logistics script (I included some stuff to your Greifer.sqf that I'll put in spoilers below). However...

  • Would it be possible to add a string to an object I placed in editor that I dont want to be able to be dragged?
  • I added the Hesco barriers, razor wire and sandbags to this scipt and they worked when they're placed on the editor. But if you have a script that spawns them in after the mission begins (via an addaction on an object) they aren't recognized. Also, when Zeus places them they aren't recognized.
  • When loading the following scripting error comes up: '((_target distance _this)<2|#|' Error Missing ).
  • Lastly, what does the attach = false in the init.sqf do exactly for your script?

"Land_HBarrierBig_F",

"Land_HBarrier_3_F",

"Land_HBarrier_5_F",

"Land_HBarrier_1_F",

"Land_HBarrierWall_corridor_F",

"Land_HBarrierWall_corner_F",

"Land_HBarrierWall6_F",

"Land_HBarrierWall4_F",

"Land_HBarrierTower_F",

"Land_Razorwire_F",

"Land_BagFence_Long_F",

"Land_BagFence_Short_F",

"Land_BagFence_Round_F",

"Land_BagFence_End_F",

"Land_BagFence_Corner_F"

Edited by SpectreRSG

Share this post


Link to post
Share on other sites

I was able to load the box in the vehicle by hand, and it got loaded into the vehicle,, buuut I got stuck in an animation till I dropped the item, and when I did that the truck blew up killing me. That is try number 1.

-----------------------------------------------------------------------------------------------

Okay, so don't place them in by hand just drop them then add action. Nice scripts together!

This is a permanent add to my template! both scripts creators will be in my credit line,, if that is good with you.

Edited by 3lockad3

Share this post


Link to post
Share on other sites

if you don't want an object to move you could place this in the init line of the object

this setvariable ["nodrag",false,true];

and then change this line in Greifer.sqf

{_x  addAction ["<t color=""#FFAD1F"" size='2.5' shadow='2'>" +"Drag", "BDD\ziehen.sqf", "", 1,true, true, "", "!attached and player distance _target<2"];} foreach gueter;

change to

{_x  addAction ["<t color=""#FFAD1F"" size='2.5' shadow='2'>" +"Drag", "BDD\ziehen.sqf", "", 1,true, true, "", "!attached and player distance _target<2 and (_target getvariable ['nodrag',true])"];} foreach gueter;

Share this post


Link to post
Share on other sites

Thanks for your Feedback. As this is my first "releasable" script i am new to scripting. I'll try to get some more stuff into it like carrying small items and so forth.

Would it be possible to add a string to an object I placed in editor that I dont want to be able to be dragged?

------The Post above would be the solution for this. @F2k Sel, do you mind, if i would include it into the Script?

I added the Hesco barriers, razor wire and sandbags to this scipt and they worked when they're placed on the editor. But if you have a script that spawns them in after the mission begins (via an addaction on an object) they aren't recognized. Also, when Zeus places them they aren't recognized.

-----Maybe the solution to this would be looping the greifer.sqf (its the grabberscript, which puts the addaction to all the objects in the array). This is because the greifer/grabber.sqf puts an addaction to the draggables at init.sqf at mission launch.

Lastly, what does the attach = false in the init.sqf do exactly for your script?

------The attach = false is the local variable that the script passes to every client. Because it is not a public variable, every player can drag and drop at the same time. When attached = true your drag - addaction gets removed and you can select the drop - addaction

---------- Post added at 14:54 ---------- Previous post was at 14:53 ----------

This is a permanent add to my template! both scripts creators will be in my credit line,, if that is good with you.

Thank you, and sure this is fine by me.

Edited by BennetArms

Share this post


Link to post
Share on other sites

No problem anyone can use anything I post.

Have you thought about having the two actions drag/drop on the player and then when the cursor detects an object of that type in the array the action to drag appears.

I used it on a similar script some time ago.

Share this post


Link to post
Share on other sites

I heard something otherwise. If you addaction to a player it seems like its eating more performance than addaction on an object. Somebody wrote in his blog about. Think it was killzone kid.

And the array had to be checked every 0.5 secs?

Share this post


Link to post
Share on other sites

Yea there's no easy way to check timings in Arma, even if placed on an object they must still perform some check to see if they've been detected or player is near.

I just ran a few tests but couldn't detect any real difference, results vary too much on each run but the larger the array the greater time it may take.

I have noticed one issue, when dragging an object if you press X key followed by S key strange actions happen, you may have to disable some key presses to solve this.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

I have noticed one issue, when dragging an object if you press X key followed by S key strange actions happen, you may have to disable some key presses to solve this.

I read about the Problem, that if you put Hotkeys into Addactions, strange errors occur.

For example:

disableSerialization;

(findDisplay 46) displayAddEventHandler ["KeyDown","if ((_this select 1) == 42) then {hint 'drop'; [] execvm 'do something'};false"];

If you have this in your scriptfolder, which checks, if a certain key is pressed, you cannot use ACRE or TFAR again, because it messes with your keyboard-input.

I am not very much into that type of problem, but i am always open for a kind advise =)

Share this post


Link to post
Share on other sites
if you don't want an object to move you could place this in the init line of the object

this setvariable ["nodrag",false,true];

and then change this line in Greifer.sqf

{_x  addAction ["<t color=""#FFAD1F"" size='2.5' shadow='2'>" +"Drag", "BDD\ziehen.sqf", "", 1,true, true, "", "!attached and player distance _target<2"];} foreach gueter;

change to

{_x  addAction ["<t color=""#FFAD1F"" size='2.5' shadow='2'>" +"Drag", "BDD\ziehen.sqf", "", 1,true, true, "", "!attached and player distance _target<2 and (_target getvariable ['nodrag',true])"];} foreach gueter;

Thanx, that works very well.

Share this post


Link to post
Share on other sites
I read about the Problem, that if you put Hotkeys into Addactions, strange errors occur.

For example:

disableSerialization;

(findDisplay 46) displayAddEventHandler ["KeyDown","if ((_this select 1) == 42) then {hint 'drop'; [] execvm 'do something'};false"];

If you have this in your scriptfolder, which checks, if a certain key is pressed, you cannot use ACRE or TFAR again, because it messes with your keyboard-input.

I am not very much into that type of problem, but i am always open for a kind advise =)

I really can't say about ACRE or TFAR I don't use them.

I did try testing for an animation change, that worked but there seems to be no way of cancelling the new animation.

The only option is to disable the keypress so the action never starts.

These are the two modified files.

Ziehen

disableserialization; 
_Last = _this select 0;
_spieler = _this select 1;
_act = _this select 2;

_block_key = (findDisplay 46) displayAddEventHandler ["KeyDown","if ((_this select 1) == 45) then {true} else {false}"];// disable key X 

player setvariable ["drop",[_Last,_spieler,_act,_block_key],true];// add the EVH name so it can be removed later

_spieler removeAction _act;
_spieler playMove "acinpknlmstpsraswrfldnon";//Für die DragGrab-Animation
sleep 2;

//_Last attachTo [_spieler,[0,1.6,0.15]];
_Last attachTo [_spieler, [0,0.75,0.01],"lefthand"];
//_Last setdir 90;

attached = true;

_actionId = _spieler addAction ["<t color=""#FFAD1F"" size='2.5' shadow='2'>" +"Drop", "BDD\loslassen.sqf", [], 99, true, true, "", "(attached && (_target == _this))"];

_spieler setvariable ["getragenes",_Last];
_spieler addMPEventHandler ["MPkilled", {detach ( _this select 0) getvariable "getragenes",attached=false}]; 

loslassen

_temp = player getvariable "drop";
_Last =  _temp select 0;
_spieler = _temp select 1;
_act = _temp select 2;

_spieler removeAction _act;
_spieler removeMPEventHandler ["killed",0]; 
//hint format ["%1",_temp];

detach _Last;
_Last setpos [(getpos _Last) select 0 , (getpos _Last) select 1 , 0.01];
_spieler playmove "acinpknlmwlksraswrfldb";
_spieler switchMove "";

attached = false;

_block_key = player getvariable "drop";// get EVH name
(finddisplay 46) displayremoveeventhandler ["KeyDown",_block_key select 3]; // Remove EVH

removeAllActions _spieler;

Share this post


Link to post
Share on other sites

i try this atm. If it works with the key disable EVH. Thanks for your thoughts about it =)

Tested with 4 guys in dedicated environment. Ill add it to the script.

I was also contacted via steam, that the script kills addactions from the player. This is fixed also. Im updating the download atm.

Edited by BennetArms
more info

Share this post


Link to post
Share on other sites

Thanks for the update! I have been testing this with another script that adds actions and I have noticed this script removes those actions so that could be a possible issue, perhaps because of using removeAllActions.

Share this post


Link to post
Share on other sites
Thanks for the update! I have been testing this with another script that adds actions and I have noticed this script removes those actions so that could be a possible issue, perhaps because of using removeAllActions.

You're welcome ssechaud.

And eeyup, that was the problem.

Share this post


Link to post
Share on other sites
Guest

New version frontpaged on the Armaholic homepage.

==================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

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
Sign in to follow this  

×