Jump to content
Sign in to follow this  
ToM666

Creating a unit when trigger activated

Recommended Posts

Hi guys

There are occasions when I just want a unit or group of units to appear do something then disappear again.

An example would be that a player sets of a trigger.

Thsi would then cause two ghosthawks to appear a short distance away and then fly at high speed straight over the players position.

I would then like them to disappear again.

Is there a way t do this?

Thanks

ToM

Share this post


Link to post
Share on other sites

You could use BIS_fnc_ambientFlyby for that kind of thing.

Description:

Spawns an ambient air unit, makes it move and deletes it when it reaches destination

Vehicle will never engage and will be flagged as captive

Good for simple creation of ambient fly by's

Parameter(s):

_this select 0: ARRAY - The position where vehicle will spawn

_this select 1: ARRAY - The end position of the vehicle, it will be deleted here

_this select 2: NUMBER - The spawn and flight height of the vehicle

_this select 3: STRING - The speed the vehicle will move ("LIMITED", "NORMAL", "FULL")

_this select 4: STRING - The classname of the vehicle to spawn

_this select 5: SIDE - The side the vehicle belongs

Share this post


Link to post
Share on other sites
You could use BIS_fnc_ambientFlyby for that kind of thing.

That sounds just the job. How do I implement that in the editor?

Share this post


Link to post
Share on other sites

It's already implemented, you'd call that function from the trigger.

Share this post


Link to post
Share on other sites
It's already implemented, you'd call that function from the trigger.

You'll have to excuse me cuel I am still learning alot of the aspects when it comes to map making :)

I have tried to interprete how to "call that function from the trigger".

I just tried putting the code"BIS_fnc_ambientFlyby" into the triggers on action box, didnt work.

I then thought maybe you were talking about a module getting activated by the trigger so I have just been working through all the different options available in the modules but couldn't find it there either.

However, on the positive side I have no figured out how to make it instantly foggy, and creat various mine fields which is cool :cool:

Is there a good tutorial you know of on how to do this?

Thanks

ToM

Share this post


Link to post
Share on other sites

This in the trigger onAct of whatever starts the flyby. Place the "flyByStart" and "flyByEnd" markers where you want it to start and stop.

null = [getMarkerPos "flyByStart", getMarkerPos "flyByEnd", 200, "FULL", "B_Heli_Transport_01_F", west] call BIS_fnc_ambientFlyby;

Share this post


Link to post
Share on other sites
This in the trigger onAct of whatever starts the flyby. Place the "flyByStart" and "flyByEnd" markers where you want it to start and stop.

null = [getMarkerPos "flyByStart", getMarkerPos "flyByEnd", 200, "FULL", "B_Heli_Transport_01_F", west] call BIS_fnc_ambientFlyby;

Perfect, thankyou Kylania just the job sir, works and looks great :cool:

Share this post


Link to post
Share on other sites
Perfect, thankyou Kylania just the job sir, works and looks great :cool:

Kylania, I've just found the functions viewer in editor and indeed found this function.

I can now see where cuel got his info from.

However reading through the notes in the viewer I could not see how you came up with your code.

Is there somewhere else I should be looking?

Share this post


Link to post
Share on other sites

The stuff I quoted in my first post was from the functions viewer actually and describes the code I put later on. I guess you just need to know what parameters are and how to call a function though, sorry for leaving that out.

To use a function it's:

null = [parameters] call Function_Name;

Then we just went through the parameters the script required and filled in our values (in orange).

_this select 0: ARRAY - The position where vehicle will spawn getMarkerPos "flyByStart" (we know that getMarkerPos returns an array)

_this select 1: ARRAY - The end position of the vehicle, it will be deleted here getMarkerPos "flyByEnd"

_this select 2: NUMBER - The spawn and flight height of the vehicle 200

_this select 3: STRING - The speed the vehicle will move ("LIMITED", "NORMAL", "FULL") "FULL"

_this select 4: STRING - The classname of the vehicle to spawn "B_Heli_Transport_01_F"

_this select 5: SIDE - The side the vehicle belongs west

Share this post


Link to post
Share on other sites
The stuff I quoted in my first post was from the functions viewer actually and describes the code I put later on. I guess you just need to know what parameters are and how to call a function though, sorry for leaving that out.

To use a function it's:

null = [parameters] call Function_Name;

Then we just went through the parameters the script required and filled in our values (in orange).

Ahh, I see what you mean. So the initial function code is generic across all functions with the parameters being the only variables which are described in the function viewer.

Thanks Kylania, for your help mate. I feel like I have just taken a large step forward in the world of map editing :D

---------- Post added at 17:32 ---------- Previous post was at 17:20 ----------

Oh my god LOL. I have just looked at the ambient helicopters function and well let's just say I'd like to retract the large step forward comment :rolleyes:

Share this post


Link to post
Share on other sites
This in the trigger onAct of whatever starts the flyby. Place the "flyByStart" and "flyByEnd" markers where you want it to start and stop.

null = [getMarkerPos "flyByStart", getMarkerPos "flyByEnd", 200, "FULL", "B_Heli_Transport_01_F", west] call BIS_fnc_ambientFlyby;

Kylania - thank you for this awesome little script but I've run into one glaring issue. I was testing my mission with my buddy and every time we hit a trigger using the script it would spawn 2 vehicles per set of markers usually resulting in both victors exploding.

I haven't tested this to see if the more people who join the mission produces more vehicles but I wouldn't be surprised if that were the case. If I preview the mission in the editor everything runs flawlessly but even when I solo test over Internet I get the same results of exploding vehicles.

I love the script because it adds so much to my mission -- if there is any more info you may know about please let me know and I'll do the same.

Share this post


Link to post
Share on other sites

Triggers on the map will execute for all players and the server. To get around this add isServer to the condition of the trigger. So it reads:

this && isServer

That way only the server runs the trigger and it only happens once.

Share this post


Link to post
Share on other sites
Triggers on the map will execute for all players and the server. To get around this add isServer to the condition of the trigger. So it reads:

this && isServer

That way only the server runs the trigger and it only happens once.

Thank you. Works exactly as intended now. Should I apply this to every single trigger in my mission regardless if they seemed worked fine before?

Share this post


Link to post
Share on other sites

Only if it's something you only want to happen on a server like spawning. Other things you want to happen for everyone like task updates or hints.

Share this post


Link to post
Share on other sites
Only if it's something you only want to happen on a server like spawning. Other things you want to happen for everyone like task updates or hints.

Awesome news and thanks again. I've already started letting other noob editors like me know the deal and why. I never would've guessed all these different, little ambient effects were built in game without your help.

It's those little subtle touches that I spend hours tweaking knowing full well most won't even notice for more than a passing glance but at the same time adds a level of atmosphere to the mission many take for granted. Keep up the good work!

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  

×