Jump to content
Sign in to follow this  
Yolo Joe

Need help with ADVANCED scripting!

Recommended Posts

Is there any possible way I can make a broken vehicle dissapear after a certain amount of seconds when I'm standing next to it? I know how to make all vehicles on the map despawn after a certain amount of time, but it have to despawn when I'm standing next to it, and only the vehicle I'm standing next to..

Is this possible, and if so, can anybody please help me?

Help would be greatly appreciated!

Share this post


Link to post
Share on other sites

There are three methods I can think of to achieve this:

1) Create a trigger everytime a vehicle is !alive and handle the despawn whenever someone enters the area around it

2) Create a while-loop which checks the distance to every player to each vehicle after !alive

3) Create a while-loop which does the same like 2), but from the perspective from the player.

2) is effective when there are many vehicles, but a small number of players. 3) is the opposite to 2).

The question here is: Is the amount of vehicles you want to have monitored dynamically or a known set?

Like if every vehicle on your map should get monitored, regardless if new ones are spawned or not. If thats the case, I'd tend to 2), because you could easily add the vehicles to a globally known array and wrap a loop around it.

Now coming back to the title of your topic: You need help, what did you do to solve your problem?

Where can we help you?

What informations do you need?

Is this going to be a MP mission?

:)

Share this post


Link to post
Share on other sites

Thanks for the fast response!

My biggest problem here is that I'm fairly new to scripting in Arma 2, and I have no idea what a while-loop or !alive is.. xD

What I ment by "I know how to make all the vehicles on the map despawn" is: I downloaded a script and I tried to understand it.

To answer some of your questions:

It is not going to be more than 10 vehicles that are going to be despawned. I am using the ambient vehicles module, so it is going to be more vehicles on the map, but only those who is spawned destroyed is going to be using the script.

It is going to be a SP mission.

I basically need all the help I can get with making the script and understanding how it's done.

I also want to add some text on the screen while I'm despawning the vehicle. Something like "Extinguishing fire!".

Any ideas how I can do this?

Edited by Chillroy

Share this post


Link to post
Share on other sites

Easiest way to probably do it would be like XxAnimusxX said it, make a trigger.

Make a trigger and in the condition put

!alive name

Then on activation write:

deletevehicle _name

Then to get the text just go to effects and add a simple, text. make sure you name your vehicle in its Name box and do this for each vehicle. make sure each vehicle has a different name and the name is the same in the condition and activation fields

Share this post


Link to post
Share on other sites

Thanks! :) But what about the timer? I want it to take a bit of time before the vehicle despawns. Like say 30 seconds were I have to be inside the trigger area. How can this be done?

Share this post


Link to post
Share on other sites

Use trigger countdown or timeout to you liking:

countdown delays the reaction of a trigger for a certain length of time, determined by the min, max and mid values. thus if the triggering unit walks into the area then leaves, the trigger will fire after the countdown is complete, regardless of whether the triggering unit is present or not.

timeout requires that the condition of the trigger must be met for a certain length of time, determined by the min, max and mid values. thus if the triggering unit walks into the area then leaves before the timeout is complete, the trigger will not fire.

Share this post


Link to post
Share on other sites

Thanks guys! I will give you credit in the mission for helping me! ;)

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  

×