Jump to content
Sign in to follow this  
fortun

Trigger for destroying buildings, towers?

Recommended Posts

Am i able to have triggers for map static related things like buildings and towers or such? Think i saw a thread about this, but im unable to find it. Like if i destroy lighthouse (small) or Transmitter tower (big) 1 then mission complete and so? Know how to end mission, but can you do it on buildings and so like that? And also, if i can, is it this command to have it already destroyed: name setdamage 1?

Share this post


Link to post
Share on other sites

You can place a Game Logic object on the building in the editor, and in its on act do something like "bldgToBurn = nearestBuilding this". Now the building should be named 'bldgToBurn' and will respond to scripting.

Share this post


Link to post
Share on other sites

For single buildings a trigger is ok.

Just place it over the building and group the building to the trigger

then in on act

   (thislist select 0) setdamage 1

To monitor if a building had been destroyed

as before except you can set it to not present

and instead of setdamage it could have a hint.

on act

 hint "Building has been destroyed"

Share this post


Link to post
Share on other sites

There's a few ways to do it but I think you can do it like this

make up a name for the building so lets say "tower"

locate the tower on the map, turn on ID's so you can see the buildings ID number (let's say the buildings ID is 94577), then place an object on the map. In the init of the object put: tower = getPos this nearestObject 94577

That will have named that building "tower", now you can use !alive tower as a condition to check if it's been destroyed and then trigger the task complete.

---------- Post added at 03:15 ---------- Previous post was at 03:14 ----------

There's a few ways to do it but I think you can do it like this

make up a name for the building so lets say "tower"

locate the tower on the map, turn on ID's so you can see the buildings ID number (let's say the buildings ID is 94577), then place an object on the map. In the init of the object put: tower = getPos this nearestObject 94577

That will have named that building "tower", now you can use !alive tower as a condition to check if it's been destroyed and then trigger the task complete.

Share this post


Link to post
Share on other sites

One thing that you should notice tho is that i found out that the id on objects changes very often, atleast it did in the alpa/beta. So if it stops working, look up if the ID has changed on the building

Share this post


Link to post
Share on other sites

Yeah, ID's can change with updates. For that reason, it's best to use the object's classname rather than the ID.

My_tower = nearestObject [getMarkerPos "towerMarker", "Land_TTowerBig_1_F"];

You can find classnames by putting something like this in a radio trigger or the script console:

thing = nearestObject [player, "house"]; copyToClipboard format ["%1;",typeOf thing];

Activating that while standing next to your desired building will copy the classname to the clipboard, and all you have to do is ctrl+v.

Or, using the ID and a marker to get the classname:

thing = ((getMarkerPos "towerMarker") nearestObject 123456); copyToClipboard format ["%1;",typeOf thing];

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×