Blubu 1 Posted September 25, 2012 So first of all hello to everybody iam new to the forum :D now to my problems Iam planning to make a mission for OFP like the insurgency mission for Arma 2 but with a leveling system and a new UI first problem How the heck am I able to place local variables inside a unit? For example I could make something like ply1xp = 0 ply2xp = 0... and so on but to do this with 24 players... it seems to be a unefficent methode to me. In Arma I can use setvariable and getvariable but how do I things like that in OFP ? There would be also some more variables to define for each player like maxXP currentXP and stuff. I hope you unterstand my problem ^^ second problem I can place RSC on the screen with titleRsc and cutRsc ok but I have more recources and if I use cut and title the old recource spawned with the command disappears and the new one shows up but I need about 3 - 4 ressources on the screen :/ and those recources should be called by a script to change their color for example like in Dayz when you get hungry the ressource turns red.. same thing needed her but in ofp things seem to be a little more difficult ^^ PS: Does somebody know a good AI scripting tutorial this area is kind of new to me and I dont know how to start :) thanks for the answers. Share this post Link to post Share on other sites
Blubu 1 Posted September 26, 2012 Ok the first problems is solved ^^ maybe someone still can help with the cutRsc problem and a AI-tutorial :) Share this post Link to post Share on other sites
*zeewolf* 4 Posted September 27, 2012 I think you should start by looking into how "health bar" type addons work. I believe several FFUR releases had one. That is essentially what you want if I understand you correctly. Also bear in mind you can use dialogs to display much more complex information to a player than a cutrsc. You mentioned DayZ so I assume you are trying to replicate the temperature, hunger, blood and thirst icons. Is that the case? Have you considered providing an individual RSC for each possible state of the available icons? If you allowed each icon to be either green, amber or red and used titlersc for two of the icons and cutrsc for the other two, you would need 18 images, which isn't completely ridiculous. Unconsciousness, broken bones and exposure effects could be covered by sound and camera effects. Also consider using hints, titletext and briefing objectives to display status to the player. Regarding AI, I suggest you start by designing flowcharts for an AI's decision making and actions. Then convert these flowcharts into state machines which are the fundamental components of general AI scripting. Once you've worked out what information an AI unit needs to make a decision and what they're actually going to do you can then think about the scripting to make it happen. If you are doing zombies then look into the many previous zombie mods that have been made for this game over the years which offer similar behavior to DayZ's denizens. If you're making a multiplayer mod you'll need to be aware of the locality of your scripts, scripting commands and variables at all levels of your mission framework in order for it to work properly. Is the mission going to be multiplayer? Share this post Link to post Share on other sites
nikiller 18 Posted September 28, 2012 (edited) hi, Here's health bar HUD script. SP/MP compatible. init.sqs ;******************************* ;Init Script by Nikiller v0.9b ;contact: nikillerofp@hotmail.fr ;******************************* nik_client=local player ;----------------------------------------------------------------------------------------- ; Health indicator ;----------------------------------------------------------------------------------------- [player] exec "player\health\health.sqs" exit health.sqs if nik_client then {} else {goto "ende"} ~1 _u = _this select 0 _l="l" _d=0.01 #l ? !(alive _u): CutRsc ["indicator_0","PLAIN DOWN"]; exit _gdu=(getDammage _u*40) _exa=(40-_gdu) _res=(_exa %1) _hea=(_exa-_res) ? _res>=0.5: _hea=(_hea+1) ? (_gdu>39.5): _hea=1 ~_d _title=(format ["indicator_%1",_hea]) ? !(alive _u): CutRsc ["indicator_0","PLAIN DOWN"]; exit if (_hea!=40) then {CutRsc [_title,"PLAIN DOWN"]} else {CutRsc ["indicator_39","PLAIN DOWN"]} ~_d goto _l #ende exit description.ext #define CT_STATIC 0 #define ST_PICTURE 48 class RscPicture { type = CT_STATIC IDC = -1 style = ST_PICTURE ColorBackground[] = {0,0,0,0}; ColorText[] = {1,1,1,1}; font = "tahomaB24"; SizeEx = 0 }; class RscTitles { titles[] = {}; class indicator_39 { name = "health indicator 39"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_39.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_38 { name = "health indicator 38"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_38.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_37 { name = "health indicator 37"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_37.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_36 { name = "health indicator 36"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_36.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_35 { name = "health indicator 35"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_35.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_34 { name = "health indicator 34"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_34.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_33 { name = "health indicator 33"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_33.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_32 { name = "health indicator 32"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_32.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_31 { name = "health indicator 31"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_31.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_30 { name = "health indicator 30"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_30.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_29 { name = "health indicator 29"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_29.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_28 { name = "health indicator 28"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_28.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_27 { name = "health indicator 27"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_27.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_26 { name = "health indicator 26"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_26.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_25 { name = "health indicator 25"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_25.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_24 { name = "health indicator 24"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_24.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_23 { name = "health indicator 23"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_23.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_22 { name = "health indicator 22"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_22.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_21 { name = "health indicator 21"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_21.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_20 { name = "health indicator 20"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_20.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_19 { name = "health indicator 19"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_19.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_18 { name = "health indicator 18"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_18.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_17 { name = "health indicator 17"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_17.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_16 { name = "health indicator 16"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_16.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_15 { name = "health indicator 15"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_15.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_14 { name = "health indicator 14"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_14.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_13 { name = "health indicator 13"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_13.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_12 { name = "health indicator 12"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_12.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_11 { name = "health indicator 11"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_11.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_10 { name = "health indicator 10"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_10.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_9 { name = "health indicator 9"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_9.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_8 { name = "health indicator 8"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_8.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_7 { name = "health indicator 7"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_7.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_6 { name = "health indicator 6"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_6.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_5 { name = "health indicator 5"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_5.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_4 { name = "health indicator 4"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_4.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_3 { name = "health indicator 3"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_3.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_2 { name = "health indicator 2"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_2.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_1 { name = "health indicator 1"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_1.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; class indicator_0 { name = "health indicator 0"; duration = 10000000; FadeIn = 0; IDD = -1; MovingEnable = false; controls[] = {health}; class health : RscPicture { text = "picture\heatlh_indicator\indicator_0.paa"; x = 0.825000; y = 0.500000; w = 0.200000; h = 0.266666; }; }; }; Here's a demo to show how it works: DEMO LINK cya. Nikiller. Edited September 28, 2012 by Nikiller Share this post Link to post Share on other sites
Blubu 1 Posted September 28, 2012 (edited) I think you should start by looking into how "health bar" type addons work. I believe several FFUR releases had one. That is essentially what you want if I understand you correctly. Also bear in mind you can use dialogs to display much more complex information to a player than a cutrsc.You mentioned DayZ so I assume you are trying to replicate the temperature, hunger, blood and thirst icons. Is that the case? Have you considered providing an individual RSC for each possible state of the available icons? If you allowed each icon to be either green, amber or red and used titlersc for two of the icons and cutrsc for the other two, you would need 18 images, which isn't completely ridiculous. Unconsciousness, broken bones and exposure effects could be covered by sound and camera effects. Also consider using hints, titletext and briefing objectives to display status to the player. Regarding AI, I suggest you start by designing flowcharts for an AI's decision making and actions. Then convert these flowcharts into state machines which are the fundamental components of general AI scripting. Once you've worked out what information an AI unit needs to make a decision and what they're actually going to do you can then think about the scripting to make it happen. If you are doing zombies then look into the many previous zombie mods that have been made for this game over the years which offer similar behavior to DayZ's denizens. If you're making a multiplayer mod you'll need to be aware of the locality of your scripts, scripting commands and variables at all levels of your mission framework in order for it to work properly. Is the mission going to be multiplayer? yes it will be multiplayer :) I also have now another question I want to make a radio for the driver of the vehicle. so when he puts on the radio every player inside the vehicle should hear the music, also maybe some hint messages should broadcasted to all players connected some ideas/help :O ? And its not with zombies ^^ its going to be a WW2 map based on the libmod where you have to take over all cities and you will gain money and xp for each kill so you can buy tanks and skill your character with some abilitys like building a sandbag and stuff and the AI is just needed to spawn when you are close to a village and some things like flanking you and so on :) and thx to nkiller Edited September 28, 2012 by Blubu Share this post Link to post Share on other sites
nikiller 18 Posted September 28, 2012 hi, What you want to achieve is basically a CTI mission. I suggest you to have a look here: http://mfcti.sourceforge.net/index.html open the mission and study the scripting. For the vehicle radio, use an addAction with a say command and a publicVariable to broadcast the addAction. Watch out the addAction command in MP since it is very tricky, you should read this tutorial Triggers, Scripts & addAction in MultiPlayer. Good luck. cya. Nikiller. Share this post Link to post Share on other sites
Blubu 1 Posted September 28, 2012 (edited) only one more thing and then iam done with asking ^^ another thing is how do I make a script wich checks if I killed a man or a vehicle its needed for the xp gain man = 200xp vehicle = 500xp with the command vehicle I only check the vehicle wich the unit is inside so any ideas ? Edited September 28, 2012 by Blubu Share this post Link to post Share on other sites
*zeewolf* 4 Posted September 28, 2012 (edited) For radios I suggest using Init eventhandlers on the vehicles that detect when a player is inside the given vehicle, if so they play the relevant sound to them. The current sound to play could be controlled by the server if all players need to hear the same sound at the same time. A simple server side script that broadcasts the current sound to be played and a signal to start playing it would suffice. The locality of scripts can be controlled using the local command, it's standard practice in 1.96 to use an editor placed game logic called "Server" to determine locality, since editor placed objects are always local to the server, "local Server" will always return false on clients but true on the server. v1.99 has the isServer function that serves the same purpose but is not backward compatible. Broadcast communication of hints and generic sounds is relatively simple in multiplayer. Just run an "effects" script on each player's machine that loops around waiting for a global variable to change. When it does it parses the variable and plays the appropriate local effect. Simultaneously other scripts can write to the global variable and broadcast it to other client machines using the publicvariable command. This is a peer to peer setup. E.g. clientfx.sqs as used in MWC _UAVSound = format["%1EnemyUAV",PlayerSound] _AirSound = format["%1EnemyAirstrike",PlayerSound] _PredSound = format["%1EnemyPredator",PlayerSound] _ReaperSound = format["%1EnemyReaper",PlayerSound] _AC130Sound = format["%1EnemyAC130",PlayerSound] #lp _sc = fx_code + 0 ?(Ending): goto "end" ~0.5 ?(_sc == 0) : goto "lp" ?(_sc > 400) : goto "ac130" ?(_sc > 300) : goto "reaper" ?(_sc > 200) : goto "predator" ?(_sc > 100) : goto "jdam" ?((fx_code mod 100) != PlayerSID): playsound _UAVSound ~0.5 fx_code = 0 goto "lp" #jdam ?((fx_code mod 100) != PlayerSID): playsound _AirSound playsound "Jet" ~2.5 [target, 20, 100, 5, 30] exec "killstreaks\bombfx.sqs" ~0.5 fx_code = 0 goto "lp" #predator ?((fx_code mod 100) != PlayerSID): playsound _PredSound ~0.5 fx_code = 0 goto "lp" #reaper ?((fx_code mod 100) != PlayerSID): playsound _ReaperSound ~0.5 fx_code = 0 goto "lp" #ac130 ?((fx_code mod 100) != PlayerSID): playsound _AC130Sound ~0.5 fx_code = 0 goto "lp" #end [] exec "Outro.sqs" an example caller script, in this case MWC's s_jdam.sqs which runs when a player calls in a precision airstrike 7 kill streak reward: onMapSingleClick {} _TargetPos = _this select 0 #lp ~1 ?(fx_code != 0) : goto "lp" target setpos _TargetPos playsound format["%1FriendlyAirstrike",PlayerSound] fx_code = 100 + PlayerSID ~0.1 publicvariable "fx_code" ~2.5 _bomb = "laserguidedbomb" createvehicle _TargetPos ~1 StreakActive = 0 publicvariable "StreakActive" The other way to do it is have the server detect when an effect needs to occur then broadcast it to all clients, check out the Coin coop engine (if you can find it) for a well written example of a rigid server-client system. Which you choose depends upon how you want to balance scripting load across the machines on the network. You'll need a bit of thought to prevent race conditions and ensure the "effects" script is able to read and execute the effects faster than machines are going to send them. I tend to think of triggering most remote sound, cut and drop effects as best effort so lump them all together. But in the case of mission critical synchronisation of data a dedicated set of scripts and public variables can be used to ensure the information is passed using publicvariable handshakes. For checking who killed someone you need to use killed eventhandlers, they receive an object reference to the killer passed by the engine. Unfortunately killed eventhandlers only run on the machine the unit was local to. So if say player 1 kills player 2, a killed eventhandler assigned to player 2 will only run on player 2's machine. Once the script has figured out who killed player 2 (i.e. who to reward) it needs to pass that data back to other machines on the network using public variables. In some cases in multiplayer the killer isn't identified by the engine (you'd see "player x was killed" in global chat rather than "player x was killed by player y") in this case the killed eventhandler will run but the killer will be null, this usually happens with splash damage weapons or being run over by a vehicle. In most cases if you don't receive a killer reference in the eventhandler there's no practical way of finding out who killed them, so you just have to treat it as suicide. When I made kill streaks in my MWC mod I had to pass a lot of data over the network to give the killed eventhandlers a chance of identifying the killer (since hitting someone with a predator missile would trigger a "player x was killed" message). For some basic AI scripts check out stuff like GDCE, or Coin coop engine. They have basic AI behaviours in comparison to CTI missions (which may be a little heavy if you're not familiar with how they work). For multiplayer purposes just spawn and manage all AI groups on the server, you just have to be careful about what happens in mixed AI/player groups if the player takes command of the squad. Edited September 28, 2012 by *Zeewolf* Share this post Link to post Share on other sites
Blubu 1 Posted October 3, 2012 Yeah I have a new problem :D I made a attach script for my Opel Blitz so that I can attach a Pak to it so here is the problem after I have done this several times the trigger adds the order to attach/detach the Pak several times ._. I have deleted the eventhandler with a script and added it again because the eventhandler only triggers once here is the code: transporter.sqs _vehicle = _this select 0 _vehipos = _this select 1 _vehunit = _this select 2 _action = false #distance _object = nearestobject [_vehicle, "LIB_PAK36"] _dis = _vehicle distance _object if (_dis < 10) then {goto "attach"} ~1 goto "distance" #attach if (_dis > 6) then {goto "distance"} if not (_action) then {_attach = _object addaction ["Pak ankoppeln", "attach.sqs"]} _action = true hint "Pak kann jetzt angekoppelt werden." exit attach.sqs _pak = _this select 0 _id = _this select 2 detach = false _object = nearestobject [_pak, "Lib_Blitz_Closed"] _dis = _object distance _pak _dirpak = getdir _pak _dirveh = getdir _object _check = _dirpak - _dirveh if (_check < 190 and _check > 170 or _check > -190 and _check < -170) then {goto "remove"} hint "Das Fahrzeug muss anders positioniert werden!" exit #remove _pak removeaction _id _detach = _pak addaction ["Pak abkoppeln", "detach.sqs"] #attach if not (alive _object) then {exit} if (detach) then {exit} _unitpos = getpos _object _uposx = _unitpos select 0 _uposy = _unitpos select 1 _uposz = _unitpos select 2 _dirveh = getdir _object _dirupdate = _dirveh - 180 _sidex = sin(_dirupdate) * _dis _sidey = cos(_dirupdate) * _dis _uposx = _uposx + _sidex _uposy = _uposy + _sidey _pak setpos [_uposx, _uposy,(_unitpos select 2)] _pak setdir _dirupdate ~0.02 goto "attach" detach.sqs _pak = _this select 0 _id = _this select 2 _pak removeaction _id detach = true opel_blitz1 removeEventhandler ["getin", 0] opel_blitz1 addEventhandler ["getin", {_this exec "transporter1.sqs"}] exit PS: Is there a possibility to change the vertical directon of objects? Share this post Link to post Share on other sites