Jump to content
Sign in to follow this  
DestroyerX

2 questions

Recommended Posts

Hi,

I want to know how to add a flare to a unit. And I need something that detecs if the flare is fired, so a chopper comes.

Next thing is that if I place some resistance men near some empty Shilka's, they go nutts. I have them in safe mode but they go and lie down on the ground in combat mode.

Anyone know how to solve this? confused.gif

Thanks in advance, DX

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">

Event based scripts

There are some scripts in the game which are launched when some event occured. Some of them has name given by mission designer (scripted waypoint, particle scripts (since 1.50), user action scripts). Names of others are given by the program.

init.sqs - launched when mission is started (before briefing screen)

- no arguments

initIntro.sqs - launched when intro is started (since 1.50)

- no arguments

exit.sqs - launched when mission is finished (before debriefing screen, since 1.50)

- argument: end # - number of game end

onFlare.sqs - launched when illuminating shell is lit(since 1.45)

- arguments: [[r, g, b], gunner] - r, g, b is light color

<span id='postcolor'>

Share this post


Link to post
Share on other sites

Ok, so you make a script OnFlare.sqs and put something in it, so when a Flare is shooted, the things within the script happen? confused.gif Could you be more precisely please? I don't know much about scripting. smile.gif

Share this post


Link to post
Share on other sites

Well im not quite sure myself as i havent really used it.

as for resistance thing you could...make them careless mode.

im not sure i have a sore head. right now.

Share this post


Link to post
Share on other sites

Create a soldier, name him GUY1

Edit its properties

Case no1

If your soldier is WEST side

in its initialization field, type

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">removeallweapons this; this addmagazine "M16"; this addmagazine "M16"; this addmagazine "M16"; this addmagazine "M16"; this addmagazine "flare"; this addmagazine "flare"; this addmagazine "flare"; this addweapon "M16GrenadeLauncher"<span id='postcolor'>

He will now have 3 normal flares an 4 magazines

Now , to make him launch a flare, you must have this at the "On Activation" line on a trigger (choice of your"Activation" depends on your mission)

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">GUY1 fire ["m203muzzle", "flare"]<span id='postcolor'>

and the WEST soldier will launch a flare for the condition you have defined in your trigger

Case no2

(i consider the name of the unit is always GUY1)

If your soldier is a WEST unit it is not the same thing

you must put this on its init line

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">removeallweapons this; this addmagazine "AK47"; this addmagazine "AK47"; this addmagazine "AK47"; this addmagazine "AK47"; this addmagazine "flare"; this addmagazine "flare"; this addmagazine "flare"; this addweapon "AK47grenadelauncher"<span id='postcolor'>

He will now have 3 normal flares an 4 magazines

Now for to order this guy to launch a flare, you will need that on a trigger

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">GUY1 fire ["grenadesmuzzle", "flare"]<span id='postcolor'>

And the east guy named GUY1 will launch its flare for the condition you have defined in your trigger

That is how to launch flares , be carefull EAST and WEST does not use the same codes.

There is colored flare too, just repalce the word    flare   in thoes codes by

flarered   or   flaregreen    or   flareyellow

Case of your chopper

Now if you want an helico to come where the flare was launched, just do this

Create the chopper you want at a good distance of where you need the flare to be launched , name the chopper for this example HELI, do notmake it in Flying position (so it will not arrive to quickly)

now, remember the codes you use to force the guy to launch the flare ?

Remember in the example my guy was named GUY1

so if he was WEST side , the code will be

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">GUY1 fire ["m203muzzle", "flare"]; HELI domove getpos GUY1<span id='postcolor'>

If the soldier was EAST side

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">GUY1 fire ["grenadesmuzzle", "flare"]; HELI domove getpos GUY1<span id='postcolor'>

So at the time the soldier will launch the flare, the chopper will take off and will fly to the position of the GUY1 soldier when he launched its flare (so to the position of the flare too wink.gif )

Share this post


Link to post
Share on other sites

For the resistance units, to prevent them to fall prone when they see something horrible wink.gif

just put this in each unit init line

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setunitpos "UP"<span id='postcolor'>

then they will never go prone

Share this post


Link to post
Share on other sites

Thanks, this worked pretty good! biggrin.gif

Only, the chopper comes and flies a bit too far and then stands still. I want the chopper to pick me up. And when the flare is shooted, I want a little cutscene starting. No complicated scripted cutscene, just a simple one by trigger(s).

(Note that the player shoots a flare)

For the resistance men, they will not go down but don't stay in safe mode. And they must be standing in safe mode. Also they are looking from one Shilka to the other all the time. Very stupid, lol. smile.gif

Share this post


Link to post
Share on other sites

try this:

Shilka1 SetCaptive True

this could work. wink.gif

I've read this in Mr-Murray's editing source some time ago.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote ([TU]$33ker @ Nov. 06 2002,15:50)</td></tr><tr><td id="QUOTE">try this:

Shilka1 SetCaptive True

this could work. wink.gif

I've read this in Mr-Murray's editing source some time ago.<span id='postcolor'>

sad.gif Doesn't work. Thanks for the suggestion though.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">person setCaptive captive

Operand types:

person: Object

captive: Boolean

Type of returned value:

Nothing

Description:

Mark unit as captive. If unit is vehicle, commander is marked. Captive is neutral to everyone. Note: This function does not remove unit's weapons.

<span id='postcolor'>

Are you SURE this didn't work??? You put "this setCaptive true" in the Initialization of the Shilka, right?

Doolittle

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">And they must be standing in safe mode.<span id='postcolor'>

If you need them to be standing there in safe mode

only as a visual effect, then you could also set them

to "careless" instead of "safe" (optically it's the same effect).

If you need them to be in safe mode, so that they can react

on enemies, you should rather use the setcaptive command.

:note - You need to setcaptive true each shilka, so that they

aren't seen as enemies by the resi's anymore.

:edit

wait - are those shilka's empty at the start of the mission?

If yes, then the setcaptive won't work, because it only works

for intelligent units (not for empty vehicles).

If you are using empty shilka's, you could try following:

fill the shilka's with other resistance soldiers at the start of

the mission and remove them later again. This way the empty

shilka's should be seen as friendly to your resi guys then.

If it doesn't work, use the "careless" variant.

~S~ CD

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (DV Chris Death @ Nov. 07 2002,23wow.gif)</td></tr><tr><td id="QUOTE">wait - are those shilka's empty at the start of the mission?

If yes, then the setcaptive won't work, because it only works

for intelligent units (not for empty vehicles).

If you are using empty shilka's, you could try following:

fill the shilka's with other resistance soldiers at the start of

the mission and remove them later again. This way the empty

shilka's should be seen as friendly to your resi guys then.

If it doesn't work, use the "careless" variant.

~S~ CD<span id='postcolor'>

Thanks Chris, Setting the behaviour to 'Careless' and putting men in the Shilka's and let them disembark works, but now ofcourse they don't react if they are under attack. <!--emo&confused.gif  smile.gif

Share this post


Link to post
Share on other sites

Try this. Nevermind the the unit and shilka INIT field values you input. Just start the mission with the Resistance guys inside the empty shilkas, then order them to disembark. If I remember correctly they should see the Shilkas as friendlies since they were inside of them.

Let's say you have 4 shilkas and 4 resistance guys. Name each shilka in its "Name" field like shilkaone, shilkatwo, shilkathree and shilkafour (make sure you insert EMPTY shilkas). Then in the init field of each one of those four resistance soldiers put this

this moveInCommander shilkaone

for the second resistance soldier write the same, just change the shilkaname i.e. this moveInCommander shilkatwo

etc. repeat for each of the 4 soldiers.

Finally set a waypoint "GET OUT" and set the waypoint properties combat mode to "SAFE" for each one of those 4 resistance soldiers, and place that GET OUT waypoint right on top of each shilka.

If all goes as I think it will those men will be in safe mode, yet still react when attacked.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (advocatexxx @ Nov. 08 2002,14:37)</td></tr><tr><td id="QUOTE">then order them to disembark.<span id='postcolor'>

In my mission the Resistance is the enemy. I'm a West soldier.

Why do these soldiers do so complicated, what a pain in the ass. smile.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">In my mission the Resistance is the enemy. I'm a West soldier.

Why do these soldiers do so complicated, what a pain in the ass.<span id='postcolor'>

Does this mean, you're mission consists of:

WEST vs Resistance ?

If yes, and if it's not required to have resistance vs east,

why don't you set resistance friendly to east?

If you would do this, there would be no need for putting

dummies into the shilka's, because east would be considered

as friendly ==> no prone resistance near empty shilka's wink.gif

~S~ CD

Share this post


Link to post
Share on other sites

Ok question 2 is answered (Thx again Chris), but for case #1 it doesn't work as I want. confused.gif

If the player shoots a flare, a heli will come and pick the player and his 2 teammates up. So I need something that detecs if the player has shot a flare and the heli will come to a certain point and pick the units up.

If anyone knows how to do this, much appreciated. smile.gif

Share this post


Link to post
Share on other sites

wow.gif Ah yeah, question 1 smile.gif

OK, just create your script, called: onFlare.sqs

Inside this script, you need nothing more than just

a false becomes true.

e.g:

flareshot=true

exit

Now you just need a trigger in your mission, with a condition:

flareshot

This trigger will become active, once any flare has been launched.

Only the player will launch a flare, if you don't use any

commands for AI to do so, so nothing more than just turning

the "flareshot" from false to true is required here.

If you have more flairs in your mission, then we need to talk

again here wink.gif

Use the trigger to activate your chopper then.

~S~ CD

Share this post


Link to post
Share on other sites

Hmmm, I have set an empty UH60 with the fuel to 0. I placed a pilot with a waypoint GET IN on the UH60 and then (just for testing) a GET OUT WP near the player.

I made a trigger with the Activation to West, Condition: flareshot, and On Activation: heli setfuel 1.

I made the script in my mission folder.

When I shoot a flare, nothing happens. confused.gif

What am doing wrong?

Share this post


Link to post
Share on other sites

Destroyer, i can't access OFP at the mo (me wife's running

around wink.gif ).

I'll check out exactly, what you want to do here, and then

i let you know, how i got it to work.

Meanwhile you could try some things by yourself, just to

get sure it doesn't work because of another reason.

Instead of "flareshot=true", create let display a message

from the script (e.g: hint "flare has been shot")

Also, instead of having a trigger waiting for the variable

"flareshot", just set the heli fuel to 1 by using the onFlare.sqs

The trigger doesn't make sense in this case (just a piece tooo

much here).

Also try the same thing with using a radio call instead of shooting your flare.

One more hint: at each part of your work, let a message

show up (e.g: from the onFlare.sqs, or the trigger, etc.)

If there's one of the messages not showing up, but the

previous one did, you found the location of your bug.

hope this helps for the next 4 hours, then i'm ready to OFP

~S~ CD

Share this post


Link to post
Share on other sites

OK back again;

I've recreated the scenario, you wanna have.

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

Me (officer night-equip) fired a flare

Chopper crew boards UH60mg

Chopper lands on an empty heli-pad (near me)

Chopper waits there, until i'm on board

Chopper takes off and leaves the area with me

<span id='postcolor'>

Now the "how i did it":

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

I've placed me - Officer (night equipment)

then i placed an empty helipad near me, named it: hpad1

then i placed an empty UH60mg, named it: heli1

then 2 pilots, grouped together

the very first waypoint of the crew i've placed exactly on

top of the higher ranked pilot -

behaviour: careless

condition: gogo

the 2nd waypoint of the crew i've placed exactly onto the

chopper

type: GetIn

behaviour: Aware

the 3rd waypoint i've placed exactly onto the helipad

type: move

onActivation: heli1 land "land"

and a last waypoint (nr. 4) - anywhere else (to where the chopper leaves the area)

Then i've created a gamelogic (ya know, where to select

the side of a unit, just select gamelogic)

now i created waypoint nr. 1 for the gamelogic

this wayopint i've syncronized (F5) with the 2nd waypoint

of the chopper crew (ya know: the getin wp)

then i placed a second waypoint for the gamelogic

timeout: max: 20 min: 20 avg: 20

followed by waypoint nr. 3 of the gamelogic

condition:

((getpos heli1 select 2) - (getpos hpad1 select 2)) < 8

and a fourth waypoint

onactivation: heli1 setfuel 0

The last thing i did was;

i've created a trigger

size: 0/0

condition: player in heli1

activation: heli1 setfuel 1

:note - instead of using a trigger, i could have done the

same with a fifth waypoint for the gamelogic, but the trigger

i had placed earlier when making this, so i didn't bother to

change ;)

OK, last but not least i've created a script, called: onFlare.sqs

with following text inside:

gogo=true

exit

That's all

<span id='postcolor'>

:note - i also could have been using the onFlare.sqs instead

of the gamelogic to do that, but there are such a lot of ways,

so i decided to do it this way.

If you're asking yourself, why i basically bothered myself with

that: ((getpos heli1 select 2) - (getpos hpad1 select 2)) < 8

Here's the reason: this command is checking for the height

difference between the helipad and the chopper.

The gamelogic i've used to add a delay between the chopper

waiting there/starting/and landing near me.

:one_more_note - you might have to play around with the

height difference between hpad and heli (this depends on

how fast the chopper is landing, or on what kind of ground it has to land). Just find a decent height, to remove the fuel, so

that it looks like the chopper has landed and turned off his

engines (without taking off imidiately after landing).

As i said, there are many ways to solve that, and this is just

the way, i did it. There might be smarter guys commin up with

better ways wink.gif , i know most of them (i mean the solutions, not the guys), but i've tried not to confuse you to much by showing you only this one.

Also i've used the gamelogic way, to show you a piece of what

can be done with gamelogic's (in case you didn't know that before).

Well, my fingers gettin hot from typing a lot of "explaining myself" here.

If it's not clear enough, just ask again, and i'll try to become

more detailed (lol - even more detailed - does this mean: 20 pages then biggrin.gif )

~S~ CD

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  

×