Jump to content

Recommended Posts

Posted (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,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 by Wizxrd
  • Thanks 1
Posted (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 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

Posted (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 by Wizxrd
  • Thanks 1
Posted

It will be a visible explosion that destroys the unit, compared to deactivate which just removes it with no explosion animation.

  • Thanks 1
Posted

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

  • Thanks 1
Posted

Might not work the best using the first one through triggers, I would suggest trying to use Explode Unit 

  • Thanks 1
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...