VR Flight Guy in PJ Pants Posted July 14, 2021 Posted July 14, 2021 (edited) Can I script/make objects in game to self-explode trough trigger? Thank you. Edited July 15, 2021 by VFGiPJP I Fly, Therefore I Am. One cannot go around not saying "Thank you" every time these days, can't you? YouTube: https://www.youtube.com/channel/UCc9BDi-STaqgWsjNiHbW0fA
Wizxrd Posted July 14, 2021 Posted July 14, 2021 (edited) Hi, yes it can be done both ways. But depending on the condition you want them to explode, you might find your self doing something different than what I have done. Which is to detect if a group or unit has entered a zone and destroy either the group or unit in that zone. You can run and test both .miz files provided below and see how each one works differently. Mission Editor Trigger: explode_trigger.miz This example will destroy an ENTIRE group if: 1) ALL OF GROUP IN ZONE or 2) PART OF GROUP IN ZONE becomes true. This will also only happen ONCE because of the ONCE Type TRIGGER. Scripted Trigger: explode_script.miz To be noted: This script requires MIST The code below will destroy a SINGLE unit from the group if it is within the zone. However the downside to this is that it needs to be continuously updated to detect if any unit from the group is within the zone. It will run until it finds that the entire group no longer exists and then it will stop. function explode_group() local groupName = "Hog 1" local zone = trigger.misc.getZone("Explode Zone") if Group.getByName(groupName) then local units = Group.getByName(groupName):getUnits() for k,v in pairs(units) do local unit = v local unit_name = unit:getName() local unit_pos = unit:getPosition().p if mist.utils.get2DDist(unit_pos, zone.point) < zone.radius then trigger.action.outText("Destroying "..unit_name.." In Zone!", 5) unit:destroy() trigger.action.explosion(unit_pos, 500) else trigger.action.outText(unit_name.." Not In Zone!", 5) end end timer.scheduleFunction(explode_group, nil, timer.getTime() + 6) else trigger.action.outText("cannot find group named: "..groupName, 5) end end explode_group() The mission editor trigger should be fairly straight forward to accomplish based on your needs. If you have any questions on how the scripting one works, feel free to ask. Enjoy Edited July 15, 2021 by Wizxrd 1
VR Flight Guy in PJ Pants Posted July 15, 2021 Author Posted July 15, 2021 Sure will brother everyone here in case I have further scripting questions. I Fly, Therefore I Am. One cannot go around not saying "Thank you" every time these days, can't you? YouTube: https://www.youtube.com/channel/UCc9BDi-STaqgWsjNiHbW0fA
VR Flight Guy in PJ Pants Posted July 15, 2021 Author Posted July 15, 2021 (edited) Edit: may be I asked the wrong question -- how can I put up some "fireworks display" up in the air? I tried flaks shooting up at a certain "area", they are good but kinda smallish. I tried using "explosion" at a certain zone at a certain altitude, triggered by certain unit entering another zone, but nothing showed up... Thanks. Edited July 15, 2021 by VFGiPJP I Fly, Therefore I Am. One cannot go around not saying "Thank you" every time these days, can't you? YouTube: https://www.youtube.com/channel/UCc9BDi-STaqgWsjNiHbW0fA
Wizxrd Posted July 15, 2021 Posted July 15, 2021 (edited) 1 hour ago, VFGiPJP said: Edit: may be I asked the wrong question -- how can I put up some "fireworks display" up in the air? I tried flaks shooting up at a certain "area", they are good but kinda smallish. I tried using "explosion" at a certain zone at a certain altitude, triggered by certain unit entering another zone, but nothing showed up... Thanks. I’ve edited the block of code in my original post to include this: trigger.action.explosion(unit_pos, 500) func explosion can be found here: func explosion. Have a play with number power, and see what comes of it Edited July 15, 2021 by Wizxrd 1
VR Flight Guy in PJ Pants Posted July 15, 2021 Author Posted July 15, 2021 Further question: what exactly does the Explode action does in the event trigger in the ME (not script)? I Fly, Therefore I Am. One cannot go around not saying "Thank you" every time these days, can't you? YouTube: https://www.youtube.com/channel/UCc9BDi-STaqgWsjNiHbW0fA
Wizxrd Posted July 15, 2021 Posted July 15, 2021 It will be a visible explosion that destroys the unit, compared to deactivate which just removes it with no explosion animation. 1
VR Flight Guy in PJ Pants Posted July 16, 2021 Author Posted July 16, 2021 The strange thing is the action in question needs a zone rather than a unit... I Fly, Therefore I Am. One cannot go around not saying "Thank you" every time these days, can't you? YouTube: https://www.youtube.com/channel/UCc9BDi-STaqgWsjNiHbW0fA
Wizxrd Posted July 16, 2021 Posted July 16, 2021 There are two options: 1) Explosion: Creates an explosion of a specified power on a trigger zone at a given altitude 2) Explode Unit: Creates an explosion centered on the unit of a specified volume. Bigger the volume bigger the boom. Information on the two can be found here: Editor Actions 1
VR Flight Guy in PJ Pants Posted July 16, 2021 Author Posted July 16, 2021 (edited) Unfortunately, the first one has no visible effect when triggered. I sm on the latest OB Edited July 16, 2021 by VFGiPJP I Fly, Therefore I Am. One cannot go around not saying "Thank you" every time these days, can't you? YouTube: https://www.youtube.com/channel/UCc9BDi-STaqgWsjNiHbW0fA
Wizxrd Posted July 18, 2021 Posted July 18, 2021 Might not work the best using the first one through triggers, I would suggest trying to use Explode Unit 1
PravusJSB Posted July 19, 2021 Posted July 19, 2021 Fireworks can be made with some math and the trigger.action.signalFlare SSE function and a simple iterator. 1 Creator & Developer of XSAF ::An AI model that wants to kill you, and needs no help from humans. Discord: PravusJSB#9484 twitch.tv/pravusjsb https://www.patreon.com/XSAF https://discord.gg/pC9EBe8vWU https://bmc.link/johnsbeaslu Work with me on Fiverr: https://www.fiverr.com/pravusjsb
VR Flight Guy in PJ Pants Posted July 19, 2021 Author Posted July 19, 2021 Thanks! Any example I can use I Fly, Therefore I Am. One cannot go around not saying "Thank you" every time these days, can't you? YouTube: https://www.youtube.com/channel/UCc9BDi-STaqgWsjNiHbW0fA
Recommended Posts