Jump to content
Sign in to follow this  
Sniperwolf572

Be a hero...

Recommended Posts

Second. What is the possibility of the dragee being able to shoot from that position?

If it's multiplayer surely there are other teammates. If not, the dragger should just get the fuck out of there himself wink_o.gif

Cannot wait to see this completed!

Share this post


Link to post
Share on other sites
I have a couple of comments. If you already know then I'm sorry.

First, whoever said the guy and dragee are going too fast for their feet he's right. I'm sure you know this so never mind. confused_o.gif

Second. What is the possibility of the dragee being able to shoot from that position?

1.Yes I know, anims are placeholders ATM

2.If he can shoot, then why the f*** are they dragging him in the first place? tounge2.gif

Share this post


Link to post
Share on other sites

I've done next to no MP scripting, but the little I have done was with User Actions. So I have one idea that you could try. It's based on the principle that the MoveInCargo only works for another player when it's run on thier client?

I removed this line:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? !(local Server) : exit

As this would stop other players from using the drag option. Server is only local to your machine (You acting as the Server), so thats probably why it never worked for the other tests you did?

So the final version looks like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Injured=_This Select 0

_DragBy=Player

~0.1

_DragVeh="TEN_DragVeh" createVehicle getPos _Injured

SNI_DRAGVEH=_DragVeh

PublicVariable "SNI_DRAGVEH"

SNI_INJURED=_Injured

PublicVariable "SNI_INJURED"

@(IsNull SNI_INJURED)

_DragBy assignAsDriver _DragVeh

_DragBy moveInDriver _DragVeh

I've removed the loops to check for the crew getting in and out, I think this could all be handled better, by the getin and out events? Plus you dont have to worry about that just yet, until your happy you can get both players into the vehicle.

If you noticed, I'm waiting until the injured guy has got in, with this bit:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">@(IsNull SNI_INJURED)

_DragBy assignAsDriver _DragVeh

_DragBy moveInDriver _DragVeh

Before trying to move the dragging guy in. Perhaps it should be the other way around, if at all? But it might help to keep things in sync.

In addition to the above script, you run another from each soldiers init event:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">init="[_This Select 0] Exec ""\<Addon path goes here>\SoldierInit.sqs""";

SoldierInit.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Soldier=_This Select 0

SNI_DRAGVEH=ObjNull

PublicVariable "SNI_DRAGVEH"

SNI_INJURED=ObjNull

PublicVariable "SNI_INJURED"

#Loop

~1

If !(Alive Player) Then {goto "Exit"}

If ((IsNull SNI_INJURED) And (SNI_INJURED!=Player)) Then {goto "Loop"}

Player AssignAsCargo SNI_DRAGVEH

Player MoveInCargo SNI_DRAGVEH

SNI_DRAGVEH=ObjNull

PublicVariable "SNI_DRAGVEH"

SNI_INJURED=ObjNull

PublicVariable "SNI_INJURED"

If (Alive Player) Then {goto "Loop"}

#Exit

So the idea is, SoldierInit runs from the start of the mission checking the public variable to see if a drag vehicle has been created. It's a basic loop so I doubt it will lag anything.

Once it finds a vehicle it then checks to see who should be getting into it. If it's the player then move him in, else ignore the request. When the guy is in, it tells the other units it's finished by setting the variables back to null.

There are a few problems with people trying to drag multiple bodies at once. But that can be fixed by updating your user action conditions. Not to mention all the other things that will need adding.

Well I cant test this in MP, so it's a guess smile_o.gif But put plenty of sidechat messages in, to see whats happening and whats being updated, if it all goes horribly wrong.

Share this post


Link to post
Share on other sites

Report on UNN's solution:

Situation 1 - Client drags server:

Vehicle spawns, client is put in, server does not respond, still standing around.

Situation 2 - Server drags client:

Vehicle spawns, server is put in, client does not respond, still standing around.

Situation 3 - Server drags AI:

Works fine.

Situation 4 - Client drags AI:

Vehicle spawns, client is put in, AI just standing around, no reaction.

Same situation as brefore, only noone is getting ejected because lack of the #check, and vehicle does not delete after getting out, same reason.

@ Whoever suggested adding action trough script via AddAction command:

Action is visible in large radius, I'm guessing at least 10 meters, so I would be kind of weird.

Share this post


Link to post
Share on other sites

Try putting a side chat in the loop to see if the injured player is actualy being identified correctly and sent to the clients. You can also use the action command to move units in and out of vhicles.

Quote[/b] ]#Loop

~1

Player SideChat Format ["Injured %1",SNI_INJURED]

If !(Alive Player) Then {goto "Exit"}

If ((IsNull SNI_INJURED) And (SNI_INJURED!=Player)) Then {goto "Loop"}

Really you want a basic script\test mission just to make sure you can move any other player into a vehicles cargo position using scripts alone.

Share this post


Link to post
Share on other sites

yes combat drag, enables one man to move another wounded person from danager this also works regardless of if the injured is on his back or front. using the load bearing gear as a handle also lessens the risk of causing further injury to the wounded. Even can drag wounded this way in the prone to lessen risk of behing hit while recovering a wounded person. If the wounded is not incompasitaed he is still able to protect the rescuer with his weapon. This drill is praticed a lot so the wounded knows what to do the minute they are down and unable to move, somebody will get to them if able. LBE is very useful when moving injured personal. Even more so when extraction from a disabled vehicle is needed under a combat situation and the victim isn't pinned. Firemans carry (across the shoulders) is another common movement of wounded but usualy the injured if has internal or back injuries can be hurt worse moving them. This tends to be if its the last option due to injured may bleed out if carried too long cause the carrier is uable to watch the wounded.

two man carry is another as the wounded is carried in a sitting postion. then the more common soft stretcher and stiff stretcher liter removal, but usualy only after being stablized. Having been trained and used theses in the real military and after one chopper crash being moved to safety is imparitive due to the risk of fire and or explossion.

There are pictures of said movements being done under combat but are rather grusome to be posting here due to the soldiers trying to save the wounded were also shot trying to save their buddies. Or aftermath of terrorist attacks on convoys and security forces.

Share this post


Link to post
Share on other sites

If you have links to them, please PM me.

@UNN:

Thanks again, I will check that.

Share this post


Link to post
Share on other sites

Ok try this on for size:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

init="[_This Select 0] Exec ""\<Addon path goes here>\SoldierInit.sqs""";

soldierinit.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

new_drag_veh = false

#loop

~2

?(vehicle _this == (nearestobject[_this,"TEN_DragVeh"])) && (driver vehicle _this == _this): goto "loop"

?(vehicle _this == (nearestobject[_this,"TEN_DragVeh"])) && (count crew vehicle _this == 1): unassignvehicle _this; _this action ["eject", vehicle _this]; goto "loop"

?(vehicle _this == (nearestobject[_this,"TEN_DragVeh"])): goto "loop"

?(new_drag_veh) && ((nearestobject[_this,"TEN_DragVeh"]) distance _this < 5): goto "getin"

goto "loop"

#getin

new_drag_veh = false

publicvariable "new_drag_veh"

_veh = nearestobject[_this,"TEN_DragVeh"]

_this assignascargo _veh

_this moveincargo _veh

@(vehicle _this == _veh)

goto "loop"

drag.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_Injured=_This Select 0

_DragBy=Player

~0.1

_dragvehicle = "TEN_DragVeh" createVehicle getPos _Injured

_inj_original_veh = vehicle _injured

_drag_original_veh = vehicle _dragby

~0.2

_DragBy assignAsDriver _dragvehicle

_DragBy moveInDriver _dragvehicle

@(vehicle player != _drag_original_veh)

new_drag_veh = true

publicvariable "new_drag_veh"

@(vehicle player != _drag_original_veh) && (vehicle _DragBy != _inj_original_veh)

#check

~1

? count crew vehicle _dragvehicle == 1 : goto "eject"

? count crew vehicle _dragvehicle >= 2 : goto "check"

#eject

_DragBy action ["eject", vehicle _DragBy]

deleteVehicle _dragvehicle

exit

hmm i rushed it and may have got some of the timings wrong but try it anyhows. it could do with error checking and sending of object names by publicvariable - but u dont need these things for a first try

new_drag_vehicle is made true by the dragger and triggers the dragee to check for nearby drag vehicles.

nearestobject is our friend - if it dont work i hope it gives you some ideas anyway

this one is starting to turn into a toughy

Share this post


Link to post
Share on other sites

I asked about the shooting because if you are dragging someone out of a combat zone, you can't shoot and drag someone at the same time. Not by the vid anyway. So, I was wondering if his hands are free why not let him be able to use his own rifle. If you can't do it or it's too much work just say.

The thing in it's self is good as it is. I was just wondering is all.

Share this post


Link to post
Share on other sites
I asked about the shooting because if you are dragging someone out of a combat zone, you can't shoot and drag someone at the same time. Not by the vid anyway. So, I was wondering if his hands are free why not let him be able to use his own rifle. If you can't do it or it's too much work just say.

The thing in it's self is good as it is. I was just wondering is all.

Well, by the current system, it is hardly possible, becuase units get put in a bike-alike vehicle and we all know that OFP cargo cannot shoot with their own weapon.

Quote[/b] ]Looks cool. Will it work correctly in MP?

If you read the whole thread then you would realise that I'm having issues with MP thing, SP works correctly with the current setup.

@ROBINO:

Thanks again, when I started this I tought it was going to be easy, I guess I was wrong. sad_o.gif

Share this post


Link to post
Share on other sites

actualy you can have cargo fire from a bike if placed as a gunner proxy. bunch of motor cuycles with mounted cannons and MGs on them.. Had even had the rear rider on the klr shooting . drawback the AI usualy hosed the driver of the bike cause I didn't set the rotation corectly and AI are stupid with auto targeting but was decent for players. was plotting to make an all new dirtbike for this due never got the approval to release altered sstklr.

A few problems arise getting shot while in this mode, keeping trigger happy ai from killing everyone being cRRIED OR doing the dragging. a good example to the man porteable arty sytsem tat is floating around, has a guy dragging a heavy weapon about by hand.

dragger driver, draggee gunner. should get rid of a ton of problems. Otyhher that a script to incompasitate your draggee. Well this be used on a live player that got no legs and not sobody who is actually wasted.

Share this post


Link to post
Share on other sites

I knew those damned ugly static animations would come in handy!  wink_o.gif

You'll have to fix the floating weapon on the back, I used the old Earl/Such USMC Pack for those.

Ever since I made those I've always wondered about looking into something like this but I never dove into it as you have.

Good luck man, I hope you get a good outcome from this.

Share this post


Link to post
Share on other sites

I finally had a chance to watch the videos, a clever concept and one that will be a great addition to the game. I especially like the video of the desert Marines, the speed was just about right.

I hope for the best in progress smile_o.gif

Share this post


Link to post
Share on other sites

The problem comes from the fact that the command MoveInCargo will only work if issued by the computer which the unit is local to.

Most units (as opposed to empty vehicles and objects) are local to the server only, except if they are spawned by a client, in which case they are local to that computer.

Therefore, the only solution that I can think of is a trigger, activated by a variable made public by the script, with the following line in its activation field :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">TEN_rescuee moveInCargo TEN_MAGICVEHICLE;TEN_var=false;publicVariable {TEN_var}

Your script would then look like this :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_Injured=_This Select 0

_DragBy=_this select 1

TEN_RESCUER = _DragBy

TEN_RESCUEE = _Injured

publicvariable "TEN_RESCUER"

publicvariable "TEN_RESCUEE"

~0.1

_dragvehicle = "TEN_DragVeh" createVehicle getPos _Injured

TEN_MAGICVEHICLE = _dragvehicle

publicvariable "TEN_MAGICVEHICLE"

TEN_var=true

publicVariable {TEN_var}

_DragBy assignAsDriver _dragvehicle

_DragBy moveInDriver _dragvehicle

#check

~1

? count crew vehicle _dragvehicle == 1 : goto "eject"

? count crew vehicle _dragvehicle >= 2 : goto "check"

#eject

~1

_Injured action ["eject", vehicle _Injured]

_DragBy action ["eject", vehicle _DragBy]

deleteVehicle _dragvehicle

exit

This works, I have tested it, using a jeep as vehicle. I understand that this is rather troublesome to ask mission-designers to add a trigger to have the anim and action work properly in MP, but that's nothing compared to the utter coolness of your concept.

Or someone might just come up with a simpler working solution smile_o.gif.

Share this post


Link to post
Share on other sites

I guess you can just start on every computer a looped monitor script with the same function as trigger. Isn't?

Share this post


Link to post
Share on other sites

What you can do to get the MP issues sorted is the following:

As this is a bit complicated I'll just describe the idea and then how to do it in detail.

What you need is a way to run a script on every client to move the units into your drag-vehicle and a way how to associate both units with the dragging action and the vehicle across the network.

An easy way to send variables with units across the network is the publicVariable command, but since you want more than one unit be dragged at one time you can't allways use the same variable.

To make a variable unique you add a number to its name via the call command (create a dynamic variable). Check if the variable allready exists before you create it and if it does then just increase the number. You also should do that allways on the server to make sure you don't use the same var for two different draggings due to network delays with the publicVariable command.

Since you're creating an addon, a rather easy way to get scripts run on all clients and the server is to createVehicle a special object that runs the script with its init eventhandler (EH). With the last patch the init EH is run everywhere.

Unfortunately you can just run a script with the EH when you createVehicle the object from inside another script, but you can't pass variables to it directly.

That's why you ned to define a (fast) animation in your special object. By setting the animationPhase of the animation to a number that can be associated with the number of your dynamic variable, the number gets transfered across the network and can be read inside the init script of your object.

Number -> animationPhase (for 3 digit numbers)

1 -> 0.001

53 -> 0.053

724 -> 0.724

So how does this all fit together?

To make the dragging work with existing adons I would add a hit EH to the units you want the dragging enabled via the init.sqs or the init line in the mission editor. This makes sure that the hit EH is added on every client and the server.

With the hit EH you detect when a unit is injured enough to be dragged. (The hit EH is only run where the unit that got hit is local.)

With the hit EH you run a script that uses createVehicle to create your special object with the animation and the init EH. Pause this init script on every client but not on the server and wait for the animationPhase of the object to be set.

On the server you generate a dynamic variable and initialise it with a special value (set it to -1 or 0 or whatever). Then publicVariable it.

In your hit EH script where you created your special vehicle you wait until the animationPhase of the special object is set (by the server) and then read out the animaionPhase and get the number of the created variable from it. (AnimationPhase 0.001 -> 1). Check if the variable were initialised by the server and then put the injured unit into the variable and publicVariable it again.

When the animationPhase is set by the server the init scripts of the special objects resume on every client. Extract the number from the animationPhase (wait until the animation settled). Then wait until the variable contains a unit and not the initialised value. Once that has happened, get the injured unit form the variable and add the drag action to it.

Now the unit has the drag action assigned to on every client.

After all is done, you delete the variable by seting it to nil on every client and the server.

When the drag action is activated by another unit it runs a script that creates the drag-vehicle. The drag vehicle also has an init EH and an animation.

Like before you create 2 dynamic variables with the init script on the server, publicVariable them and set the animation phase to the number you used for the variables. You need two variables: One for the injured unit and one for the dragging one.

The drag action script was paused until the animationPhase of the created vehicle is set. Then it puts the injured unit and the dragging one into the variables and publicVariables them again.

The paused init scripts on the server and the clients continue and read the units from the variables. If one or both of the units are local, then they are put into the drag-vehicle.

When both units are in the vehicle you delete the two variables on every clien and he server by setting them to nil.

Should work in MP with multiple units dragging someone without having a constantly looping script on every client and the server.

(sorry no souce examples as I'm away from my OFP editing PC)

Share this post


Link to post
Share on other sites

Thanks for your support guys.

@Igor Drukov

Thanks for the example and script testing, I am going to try that example of yours

@Romolus

Seeing that you have superior scripting knowledge than me,I did try to understand, but I lost you there after a few sentences.

I belive you and TJ did most of the BAS scripting, I tried to unpack a few MP-friendly addons you guys made (blackhawks and chinook), since I belive the fastrope script does something similar to what I need, but to no surprise, I lost you there again.

I'm gonna read up on the scripting tutes and comref, maybe I understand how to do what you're telling me.

Oh, I forgot to mention that Macollo contributed an animation whitch helped me alot, thank you Macollo. smile_o.gif

Share this post


Link to post
Share on other sites

Well if you specify which part(s) you have problems with, then I might be able to help you out there.

I just don't have the time to write and test the whole script myself.

You're right that the fastroping is similar to what you need. Most of the BAS addons rely on the animation technique I described above (we call such an animation a 'switch' ).

But since the init EH was only fixed in the last patch, the fastrope scripts still rely on constantly looping scripts that run on all clients, as far as I can remember.

Unfortunately you got a quite advanced MP problem there, so I fear there are no alternatives that are easier to handle if you want to get it done right.

Some resources to look at:

<ul>[*]addAction/removeAction by uiox

[*]Event Handlers by Igor Drukov

[*]Object Animations by Planck

I can't seem to find the tutorial about dyamic variables on OFPEC, but the basics are just this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">call format ["injuredUnitVar%1 = -1",_myNumber]

Share this post


Link to post
Share on other sites

After a bit of work, macollo completed both animations, this time, it actually looks like he is dragging the guy.

I lowered the vehicle speed and corrected animation speed a bit to remove the "moonwalk" syndrome.

Big thank you to macollo and anyone contributing.

drag_new.jpg

@Romolus

Yeah, I know time is a bitch, RL is bugging me too. sad_o.gif

But you writing the script would take all the fun away from me, and then it would be that I did nothing on the matter.

Thank you for your help.

Also, a question to everyone. Is it possible to reduce the radius of addAction command, last time I tested it I could see the action at least 10m away, whitch would be very weird in my case. crazy_o.gif

Share this post


Link to post
Share on other sites

cant you use

player1 distance player2 <= 3 : player1 addaction ["",""]

or something like that?

is it possible to get a copy of the script as you have it so far plz?

i'm very interested in using it in something i'm making at the moment

Share this post


Link to post
Share on other sites

This looks really nice ! Keep up, it will be an interesting script to see in action...

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  

×