Jump to content
Sign in to follow this  
Somerville

Script issue

Recommended Posts

I have the following script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if ((dammage UH1)<0.5) then (UH1 SideChat "Say this Text")

_PosUH1 = getpos UH1

"BH1" setMarkerPos _PosUH1

Basically, this is what is supposed to happen. Blackhawk, called "UH1", is shot at and the dammage value falls below 0.5. What's supposed to happen is UH1, in sidechat, then says something.

By the way, am I right in saying that sideChat isn't local?

Then, the marker called "BH1" is supposed to go to the value _PosUH1, which is the value of UH1's position at the time of getting shot down/damaged.

It gives me the error:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">((dammage UH1)<0.5) error missing )

Help please?!?

Share this post


Link to post
Share on other sites

this is wrong :

if ((dammage UH1)<0.5) then (UH1 SideChat "Say this Text")

with then you use {} like:

if ((dammage UH1)<0.5) then {UH1 SideChat "Say this Text"};

Share this post


Link to post
Share on other sites

edit: nuxil was faster

http://community.bistudio.com/wiki/sideChat

"Types text to the side radio channel. Note: This function only types text to the list, it does not broadcast the message. If you want the message to show on all computers, you have to execute it on all of them."

Share this post


Link to post
Share on other sites

Maybe what i will say you it will sounds you like a stupid variation. Just try it exactly.

Quote[/b] ]? ((getDammage UH1) < 0.5) : UH1 sideChat "Say this Text"

_PosUH1 = getpos UH1

"BH1" setMarkerPos _PosUH1

Well, maybe i have to make a tip about 'healths':

This is legal:

damage

getDamage

getDammage

setDamage

setDammage

The rest, not, so...

'dammage UH1' will always fail. In your case, ArmA is reading your 'dammage' command as another variable, not as a command, then... you understanding now why ArmA Error Brigade is saying you

Hey mate, i need another " ) " !!!

I think this case is a good one to understand that, never you can put "1 variable (space) another variable".

Share this post


Link to post
Share on other sites

So.. what you're saying there is, sidechat won't broadcast to all players on the same side as the unit?

Dang

Edit: Guys, this isn't doing anything. The script is there, and works, but one problem.

If I have this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? ((getDammage UH1) < 0.5) : UH1 sideChat "Say this Text"

_PosUH1 = getpos UH1

"BH1" setMarkerPos _PosUH1

Then at the start of the map, it immediately says "SAY THIS TEXT" in side channel. What I'm looking for is to make it so that, when the chopper can no longer stay airborne, and it is going down, then it says "SAY THIS TEXT".

Can anyone help?

Share this post


Link to post
Share on other sites
? ((getDammage UH1) < 0.5) : UH1 sideChat "Say this Text"

Then at the start of the map, it immediately says "SAY THIS TEXT" in side channel. What I'm looking for is to make it so that, when the chopper can no longer stay airborne, and it is going down, [i]then[/i] it says "SAY THIS TEXT".

Of course it says it right away, you are checking if the damage dealt to the vehicle is LESS than 0.5. At the start of the mission, its damage is obviously 0. 0 < 0.5 is true.

So either change < to > or try command canMove

Instead of sidechat, look into sideRadio

Share this post


Link to post
Share on other sites

Thing is, I changed it to >0.5, and still no luck...

I'm wondering if it's because the unit's actually an empty UH60 at the start of the map, does it need to know who the pilot is in order to work correctly?

Share this post


Link to post
Share on other sites

You're going to have to re-think your evaluation. You want to check if the damage is greater than something not less than. Also make sure that "BH1" is the name of the vehicle. When is this script being called. If it's at the beginning of the mission then the evaluation will fail and nothing will happen.

Try:

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

@((getDammage UH1) < 0.5)

UH1 sideChat "Say this Text"

It also might be better to use the eventhandler "HIT". Check the BIKI and OFPEC.

--Ben

Share this post


Link to post
Share on other sites

How would I make it so it was only called when the damage value was true? I can't think of a way to make it call when the UH60 (UH1) is hit and damaged > 0.5.

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">helo addeventhandler ["Hit", {[helo] exec "hit.sqs"}]

hit.sqs =

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

_helo = _this select 0

_damhelo = getdammage _helo

?(_damhelo >.5) : goto"here"

exit

#here

put the code you want to do when helo is dammaged here

exit

Share this post


Link to post
Share on other sites

I think there is an error from the concept of damage.

getDammage is returning the value of the damage.

It means.

Value 0 = 100% healthy

Value 0.5 = 50% healthy

Value 1 = Vehicle 'exploding', 'dying' or next to 'not alive' in few milliseconds.

With getDammage < 0.5 : sidechat xxxxxxx

Always you will be launching at start, the sidechat.

Because at the start, getDammage UH1 = 0, so... 0 is lower than 0.5 .... right?

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  

×