MobiSev Posted October 29, 2020 Posted October 29, 2020 I'm trying to remove objects from the map when that specific unit is destroyed using a script. My trigger looks like this: Trigger: 1 ONCE (remove object 1, ON DESTROY) Condition: UNIT DEAD(Static object #1) Action: DO SCRIPT(StaticObject.ge) Script: StaticObject.getByName('Static object #1'):destroy() I'm using multiple triggers like the one above for different static objects, and I'm wanting to remove only the unit that was destroyed, while keeping the others on the map. The issue I'm running into is that whenever anything gets destroyed, ALL the objects get destroyed. Any help or notice what I'm doing wrong? Modules owned: FC3, M-2000C, Mig-21bis, F-5E, AJS-37 Viggen, F/A-18C, KA-50, Mi-8, F-14A&B, JF-17
Grimes Posted October 29, 2020 Posted October 29, 2020 The on destroy event setting is limiting when that check will be run. Literally anytime someone is destroyed it'll run that check, not necessarily if that specific unit you are checking was killed. Also you can't remove the wrecks of any objects that are destroyed, so that script won't work. As for why it is removing other objects, that does sound weird. Make sure all the object names reference the individual object you actually want to remove and within the condition for each. Could add a message for each to see if they are getting triggered or if for some reason StaticObject.getByName('someObject'):destroy() is destroying other objects, then please attach the mission. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Recommended Posts