black_hawk_mw2_87 74 Posted July 12, 2019 Hello, Community friends! I want to use a script and make a unit die WHEN a trigger is activated. My idea is to use an animation for the unit making him looks like wounded, lying down on the ground and after a conversation with the player, he dies. I would use the last trigger with text from that conversation, which should activate his death. What should I put in "On Activation" in the trigger? Thanks in advance. 🙂 1 Share this post Link to post Share on other sites
JohnKalo 657 Posted July 12, 2019 You will have to place: execVM "nameOfScript.sqf"; In the script you will have to find whatever animations you want via the animation viewer located in the Eden editor and then have something like: NameOfUnit switchMove "NameOfAnimation"; sleep HowManySecondsTheAnimationLasts; switchMove ""; NameOfUnit switchMove "NameOfAnimation"; sleep HowManySecondsTheAnimationLasts; switchMove ""; and so on. In the end a: NameOfUnit setDamage 1; when playing an animation sometimes switchMove does not work and you need a playMove. 3 Share this post Link to post Share on other sites
black_hawk_mw2_87 74 Posted July 12, 2019 On 7/12/2019 at 1:10 PM, JohnKalo said: You will have to place: execVM "nameOfScript.sqf"; In the script you will have to find whatever animations you want via the animation viewer located in the Eden editor and then have something like: NameOfUnit switchMove "NameOfAnimation"; sleep HowManySecondsTheAnimationLasts; switchMove ""; NameOfUnit switchMove "NameOfAnimation"; sleep HowManySecondsTheAnimationLasts; switchMove ""; and so on. In the end a: NameOfUnit setDamage 1; when playing an animation sometimes switchMove does not work and you need a playMove. Thank you, but is this script: NameOfUnit setDamage 1, going to eliminate the AI unit when I trigger the sqf file? 🙂 Share this post Link to post Share on other sites
major-stiffy 282 Posted July 12, 2019 On 7/12/2019 at 1:15 PM, black_hawk_mw2_87 said: eliminate the AI unit He will fall down and die on the ground. 1 Share this post Link to post Share on other sites
JohnKalo 657 Posted July 13, 2019 Yep exactly like @major-stiffy said. If you do not want him to die you can erase that line of code. Since you want a conversation to take place first you can use the sleep command again. That way the unit will wait for the conversation to finish and then die 1 Share this post Link to post Share on other sites
wogz187 1086 Posted July 13, 2019 All above is good but you don't have to be quite that literal with the death. The final switchmove can be a dead animation and you can remove the body with deleteVehicle when appropriate. Being dead animation: this switchmove "AinjPpneMstpSnonWnonDnon"; deleteVehicle _deadActor; This prevents all kinds of other settings from interfering. Like corpse removal. Also if you're grouped to the dying unit somebody will inevitably pipe up with, "Oh, no! _x is down!". And that would ruin the vibe you're going for I think. 1 Share this post Link to post Share on other sites
black_hawk_mw2_87 74 Posted July 14, 2019 Thank you very much, guys. It's time for testing. I am working on a very scripted campaign right now, so wish me good luck. xD 🙂 1 Share this post Link to post Share on other sites
black_hawk_mw2_87 74 Posted July 14, 2019 There is a much easier solution, guys. 1. I put the AI near an object, for example a building. In his INIT field: 0 = this spawn {waitUntil {time > 0}; _this switchMove "Acts_SittingWounded_loop"}; {this disableAI _x} forEach ["ANIM", "TARGET", "AUTOTARGET", "MOVE"]; I set his HP at 49. This way he's wounded from the very beginning. I call him unit1. 2. I put the player and call him X. 3. I put triggers for every sentence of their conversation, depending on the needs of the scenario, so no matter how long the dialogue is, the AI dies after it. I put the texts of the conversations and change nothing in the triggers, except timer values. In all triggers I use: player distance unit1 <X, where X is the distance in meters. On Activation: the texts of the conversation. I put one last trigger with a delay of several seconds after the AI's last words, where: the condition remains the same, and On Activation: this switchmove "AinjPpneMstpSnonWnonDnon"; unit1 setDamage 1; and he falls down dead. Voilla! Sounds pretty simple, right? P.S. You can add a dying sound on the last trigger to make this scene look more realistic. Cheers! 1 Share this post Link to post Share on other sites
JohnKalo 657 Posted July 14, 2019 Quote There is a much easier solution, guys. Placing anything in the INIT field is nice but if the mission is an MP one calling such animation commands via a trigger (or even better via the iniPlayerLocal.sqf) is advised. That is because triggers work on all clients (players). Otherwise it can happen that only the host watches the animations. Yep have been there.. As for using triggers so as to show conversations I used to do that too since recently! The problem is that when many conversations are involved too many triggers exist. Hence you can again call a script via a trigger. Nothing changes: NameOfPlayer sideChat ""; sleep NumberOfSeconds; NameOfPlayer sideChat ""; sleep NumberOfSeconds; Best of Wishes for your campaign! 1 Share this post Link to post Share on other sites