Jump to content
Sign in to follow this  
Pyry

Chopter(Action scene)

Recommended Posts

Hello,

Im building up a map and i came up with wacky idea, a bit like movie based scene to scare or accidentally kill the player. The idea would be making a chopter moving swiftly forward, then come lower it's altitude a bit and fly above players shooting rockets or something explosive to a defined place and then keep moving forwards and taking some distance from the player by flying higher.

I understand perfectly if nobody is willing to sacrifise their sparetime to help me but i would appreciate it a lot.

1. How to define altitude for chopter, and how to order a chopter to change it during the flight.

2.How to make it shoot without actually targeting anything. (How to create an invisible target-dummy?)

3.Finally, would it be possible to make the chopter shoot rockets using burst fire, for example 20 rockets shot while flying high speed.

Thanks in advance

Share this post


Link to post
Share on other sites
Quote[/b] ]1. How to define altitude for chopter, and how to order a chopter to change it during the flight.

You can do it in init line of helo by using this:

name of unit: helo1

condition: flying

Init: helo1 flyinheight 5

Or

You use a setpos getpos command to beam it to the right position and height.

Quote[/b] ]2.How to make it shoot without actually targeting anything. (How to create an invisible target-dummy?)

The helo will only fire if it has an actual target.

You could use house far away in the line of sight for helo read it´s Object ID from mission editor and use knowsabout, dotarget, dofire on that object. Check ComRef for syntax.

There is an Invisible Targets addon done by Lester. I guess you can find it on mapfact.de. If you use those there is no problem.

You could also camcreate a rocket at the helo. That means it would be spawned right at your desired position and that way you can simulate the firing.

Quote[/b] ]3.Finally, would it be possible to make the chopter shoot rockets using burst fire, for example 20 rockets shot while flying high speed.

Use a helo that has FFAR rockets like the Mi 17. Remove all weapons apart the FFAR Launcher and Ammo (check Weapon/unitnames in sticky thread. Use selectweapon to have the gunner choose FFAR and use dotarget dofire again.

Share this post


Link to post
Share on other sites
1. How to define altitude for chopter, and how to order a chopter to change it during the flight.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">helo flyInHeight 30

30 = Height in meters

Quote[/b] ]2.How to make it shoot without actually targeting anything. (How to create an invisible target-dummy?)

Either search for Lester's invisible targets or just let it fire via command:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">helo fire "ZuniLauncher"

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">3.Finally, would it be possible to make the chopter shoot rockets using burst fire, for example 20 rockets shot while flying high speed.

Yep, by looping the above command in a script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_maxRockets = 20

;;; Loop

_i = 0

#loop

helo fire "ZuniLauncher"

~0.05

_i = _i+1

? _i < _maxRockets : goto "loop"

Share this post


Link to post
Share on other sites

Hey,

Thanks. Everything works now. smile_o.gif

Share this post


Link to post
Share on other sites

Hi again,

To prevent wasting any space and creating extra topics i'll ask my next question here.

How to generate a chance for a trigger to happen. So trigger, when triggered would teleport my units to either destination 1, destination 2, or destination 3? Is there a specified command for this?

Thanks in advance.

Share this post


Link to post
Share on other sites

There are several ways I guess. You could, for example, store all positions (or the objects that reference them) of the spawnpoints in an array and select an according item via random.

For example in the trigger onActivation line:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">spawnPoints = [getMarkerPos "spawn1", getMarkerPos "spawn2", getMarkerPos "spawn3"]; (spawnPoints select (random 2.99)) exec "spawnUnits.sqs"

In this example, _this in spawnUnits.sqs would reference to one of the three marker positions. Yet better would be if you'd move the above code into the script itself, so you don't need global variables.

Share this post


Link to post
Share on other sites

Hey,

spawnPoints = [getMarkerPos "spawn1", getMarkerPos "spawn2", getMarkerPos "spawn3"]; (spawnPoints select (random 2.99)) exec "spawnUnits.sqs"

Okay, that mostly scared me since i dont understand much of it. You explained the "SpawnUnits.sqs" but with my english skills it left me wondering what this all actually meant. Are the spawn points the places the units defined in "Spawnunits.sqs" would respawn in?

And if so, i need to add this the units actually doing the teleport, or spawn are allready somewhere around the map. Should i define a name for them and somehow link it with the previous commands. The main idea would be to teleport them, and give them a waypoint to follow.

Share this post


Link to post
Share on other sites

Ok, I'll explain it a bit further.

In my example, there are three spawnpoints which I for that cause defined with markers, named "spawn1", "spawn2" and "spawn3". You set those markers in the editor, preferably as invisible markers (empty markers) and name them accordingly.

You can now read out the position of the markers with 'getMarkerPos'. In my example the three positions of the three markers were stored in an array:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">spawnPoints = [getMarkerPos "spawn1", getMarkerPos "spawn2", getMarkerPos "spawn3"]

The next step is to randomly select one of the three positions to spawn to. You don't want to select always the same one, but always a different one.

The first element of the array has the index 0, the second the index 1 and the third the index 2. You would read out the first entry of our array with

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">spawnPoints select 0

Now we don't want to select the first item, but randomly one of the three. So we generate a random number between 0 and 2.99 (3 would already reference to the next (fourth) item) and use it for the select statement. We don't need to round anything, since 'select' does that automatically (always to the next lower integer number).

So

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">spawnPoints select 2.65

is the same as

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">spawnPoints select 2

That basically explains the line

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(spawnPoints select (random 2.99)) exec "spawnUnits.sqs"

First we select a random element of the array and pass it to the script "spawnUnits.sqs" right away (with 'exec' we execute the script with given parameters).

But as I said, you can even move everything into a script. So your trigger onActivation line would be:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[] exec "spawnUnits.sqs"

and the top of "spawnUnits.sqs":

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_spawnPoints = [getMarkerPos "spawn1", getMarkerPos "spawn2", getMarkerPos "spawn3"]

_mySpawnPoint = _spawnPoints select (random 2.99)

; Just as example - move all units of group "grp1" to the selected point

{_x setPos _mySpawnPoint} forEach units grp1

Share this post


Link to post
Share on other sites

Okay, thanks it all sounds pretty clear now, thanks to you.

Just a few questions more, not to make it work but to clearer things to me.

[] exec "spawnUnits.sqs"

and the top of "spawnUnits.sqs":

Code Sample

_spawnPoints = [getMarkerPos "spawn1", getMarkerPos "spawn2", getMarkerPos "spawn3"]

_mySpawnPoint = _spawnPoints select (random 2.99)

; Just as example - move all units of group "grp1" to the selected point

{_x setPos _mySpawnPoint} forEach units grp1

So, considering that the group supposted to be teleported is defined in the script it shouldn't matter who executes that script, or does it? It doesnt seem to be a command to any specified unit so it doesn't take anybody to execute the actual script right?

1. []exec does it? Since nobody really executes that script, like the chopter does in our previous conversations.

2. I need to create specified script for each group to be teleported?

3. The 2.99 represents 3, then are the chances between possible spawning place around 33,3%. Just to satisfy my curiousity, is it possible to lower chance-percentage of specified spawnpoint?

I might have got it all wrong in my head, but you wrote me an example so i think it should work with enough trying. I'll try it later tonight possibly. Thanks a lot.

Share this post


Link to post
Share on other sites
1. []exec does it? Since nobody really executes that script, like the chopter does in our previous conversations.

Well, it depends on how you want to use your script. You can of course pass your group as parameter for the script. It would be '[myGroup] exec ....' then, in the script '_this select 0' represents your group then.

Quote[/b] ]2. I need to create specified script for each group to be teleported?

If you just pass the group as parameter (as shown above), no. Otherwise yes, but that'd be nonsense of course.

Quote[/b] ]3. The 2.99 represents 3, then are the chances between possible spawning place around 33,3%. Just to satisfy my curiousity, is it possible to lower chance-percentage of specified spawnpoint?

Exactly. 0...0.99 would select the first, 1...1.99 the second, 2...2.99 the third (3 would already be the next one).

If you want to have different percentages for the different spawnpoints, that is also possible, but a bit more complicated. Do you really need it?

Just to clarify the thing about the parameter above: Change your script call to

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[myGroup] exec "myScript.sqs"

where myGroup represents the name of the specified group.

On top of your script you write:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_grp = _this select 0

and you can work with _grp for the rest of the script, which always points to the group passed as parameter.

Share this post


Link to post
Share on other sites

Hey,

Awesome, i think this is all i could hope. At least for the moment. Thanks smile_o.gif

Share this post


Link to post
Share on other sites

Hey,

Something about the chopter firescript. It all works great, and there ain't anything wrong with the actual script (Who am i to say that icon_rolleyes.gif ) but recently i've noticed some problems in the performance. Why is that each time i "Retry" after a "Preview" in the mapeditor the script won't work..The chopter simply keeps flying without doing anything. I was pretty sure first that it wasn't worth mentioning but lately i have noticed that the (script?) ain't working correctly and it is matter of possibility if the chopter performs it. The actual activation is triggered by (East,Present) and the area is so wide that it just isn't possible to fly past it without tresspassing.

Is this normal? Will it work correctly in the actual mission and why is that it won't perform the script everytime i try?

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  

×