Jump to content
Sign in to follow this  
derox

complete a few tings too make somting happen.

Recommended Posts

Heey

I made a mission where you need to do someting in order to capture an area.

In my case i need to close pipes that are leaking toxic gas. But i want that if you closed 3 or 2 pipes then you wil capture the area.

I know the part to capture etc. but i realy dont know how to make an script that makes somting els work after you in this case closed 3 or 2 pipes.

Here are the codes i used.

Init.

execVm "scripts\Closepipe\spawnpipe.sqf";

Pipe1 Init.

this setPos [(getPos this select 0),(getPos this select 1),+0.5];this enableSimulation false;

pipe1.sqf

Player playmove "ActsPercSnonWnonDnon_carFixing2";

deleteVehicle Smoke1;
deleteVehicle Pipe1;
"cp_1" setMarkerAlpha 0;
"cp" setMarkerAlpha 1;

Spawnpipe.sqf

pipe1 = pipe1 addAction ["Close Pipe", "scripts\Closepipe\Pipe1.sqf"];

i want that this part of the script

"cp_1" setMarkerAlpha 0;
"cp" setMarkerAlpha 1;

will run if i closed all the pipes in the area (3).

Like this.

and in order to run

"cp_1" setMarkerAlpha 0;
"cp" setMarkerAlpha 1;

u need too close

Pipe1

pipe2

pipe3

Can somone help me with this?

Edited by Derox

Share this post


Link to post
Share on other sites

Here's a proof of concept. Could maybe be polished a bit more. :)

I decided to use the LAND_pumpa as a pipe since I didn't have OA installed. Replace it with whatever on map wheel you're using.

tiki-download_file.php?fileId=33&display

Since I knew it was on the map I found one I wanted to use and placed a GameLogic near it. This will allow me to find the object on the map, assign an action to it and create smoke at the location. Here's the init of the Gamelogic, but you can offload this to a script if you wanted:

pipe1 = ((nearestObjects[this, ["Land_pumpa"], 200]) select 0);  
pipe1 addAction ["Pull me", "pullme.sqf", [this, "markerPipe1"]]; 
this setPos getPos pipe1; 
"markerPipe1" setMarkerPos getPos pipe1;
0 = [this,3,time,false,false] spawn BIS_Effects_Burn;

First line finds the nearest, in 200m, land lump and saves it as an object, pipe1. Second line adds the action to the on map item. This will add it for everyone since it's an on map init field. Third line moves the gameLogic over to the pump. Fourth line moves the preplaced marker (red) over the pump. Fifth line makes the gameLogic, and therefore the pump, spew smoke endlessly.

Also notice that we put [this, "markerPipe1"] as the arguments for the addAction so we can delete the gamelogic to clear the smoke and change the color of the marker with the script.

Here's the pullme.sqf:

_target = _this select 0;  // Object that had the Action (also _target in the addAction command)
_action = _this select 2;  // ID of the Action

_args = _this select 3;
_smoke = _args select 0; // this from the arguments, the Gamelogic
_marker = _args select 1;  // Name of the marker.

deleteVehicle _smoke;
_marker setMarkerColor "ColorGreen";
[nil, _target, "per", rREMOVEACTION, _action] call RE;  // This should remove the action from all players.
[nil, nil, "per", rHINT, "Pipe closed!"] call RE;
taskhint ["Pipe closed!\nGood job!", [0.600000,0.839215,0.466666,1], "taskDone"];

You could of course spawn your own objects and instead of the nearestObjects stuff just reference the object you placed on the map. Hope this helps. :)

Share this post


Link to post
Share on other sites

Thx Kylania

Ill test it out and ill let you know :D

---------- Post added at 23:21 ---------- Previous post was at 23:13 ----------

It works but what i ment is i want a massage too apear if you closed more pipes. this is 1 pipe. But thx anyway i will use the code in the gamelogic since its working better than what i have :D

Share this post


Link to post
Share on other sites

New demo mission showing 5 pipes needing to be disabled before the fanfare. Unfortunately the wheel pipe model isn't a "real" object. So you can't addAction it and if you try to attachTo an object to it ArmA2 crashes hard. So I used your idea for a fuel tank, which is some cases is ugly. :( But it works if you're happy with it. heh

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  

×