Jump to content
Sign in to follow this  
usmcrp

Script help

Recommended Posts

I am recieving an error message and need some assistance with a script, please see below. Any help would be great, thanks.

S/F

USMCRP

#loop1

?(  ("(_x distance pilot1) < 100" count  _bluforlist) > 0 ):goto "throwsmoke"

~5

goto "loop1"

;============= THROW SMOKE ==============

#throwsmoke

"SmokeShellGreen" camcreate [getpos pilot1 select 0, (getpos pilot1 select 1) - 20, 10]

~5

;============= CALL OUT ================

#call_out

_rn = random (100)

?(_rn < 15): goto "pilotcall1"

?(_rn < 30): goto "pilotcall2"

?(_rn < 45): goto "pilotcall3"

?(_rn < 60): goto "pilotcall4"

#call_out_return

?( ("(_x distance pilot1) < 20" count  _bluforlist) > 0  ):goto "join_rescuers"

_rt = random (1)+1

~_rt

goto "call_out"

;=========== JOIN RESCUERS ===========

#join_rescuers

;figure out who the guy is that found the pilots

;nearestobject should work but it fukin don't!!!

;_myobj = nearestobject [pilots, "MARINE_REGULAR"]

_i = count _bluforlist

_myguy = objnull

_mydistance = 10000

#loop2

~0.01

_i = _i - 1

_myobj = _bluforlist select _i

? ((_myobj distance pilot1) < _mydistance):_myguy = _myobj;_mydistance = (_myobj distance pilot1)

?(_i > 0):goto "loop2"

?(_myguy == player):playsound "pilotsfound"

[pilot1, pilot2] join group _myguy

pilot1 setbehaviour "aware"

pilot1 setunitpos "auto"

pilot2 setbehaviour "aware"

pilot2 setunitpos "auto"

~5

w_duvall sideradio "duvall_radio3"

pilotsfound = true

exit

;====== pilot call 1 ============

#pilotcall1

pilot1 say "pilotcall1"

goto "call_out_return"

;====== pilot call 2 ============

#pilotcall2

pilot1 say "pilotcall2"

goto "call_out_return"

;====== pilot call 3 ============

#pilotcall3

pilot2 say "pilotcall3"

goto "call_out_return"

;====== pilot call 4 ============

#pilotcall4

pilot2 say "pilotcall4"

goto "call_out_return"

Share this post


Link to post
Share on other sites

Maybe because nearestObject can't find objects up to 50 meters away?

Read the link where "Notes".

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

I think it's logical that ArmA is blocking a bit this commands, because (i think too) this command is getting a bit more CPU usage (and making more requests to internal code of ArmA) than others.

So they need to block a bit the limits of this commands.

And you need a different command.

In this kind of scripts i will recommend always:

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

Still not tested the real limits of detected-within-radius.

I hope this save you more script lines.

Ok, i'm seeing the new error, as i suspected, that statement of _x was so suspect (but still i'm noob in _x statements so i told you nothing about)

Just change all your 'distance' lines with "...." by {....}

Still i'm thinking that those 'distance' lines containing more errors.

I think the error can be solved in this way.

Try to say us all, how you thinking that 'distance' lines.

Maybe is a problem with syntax.

Share this post


Link to post
Share on other sites

Still i'm thinking you have more than one error.

The line with smokeshell, probably it will show you another error.

I never used camcreate so i can't solve that line.

This line under "join rescuers":

?( ("(_x distance pilot1) < 20" count  _bluforlist) > 0  ):goto "join_rescuers"

will cause the same error that you posted.

And the line where you starting to do:

_i = count _bluforlist

_myguy = objnull

i'm not understanding what you want to do when reaching to "#join_rescuers"

Anyway, this piece of script that i give you now can give you some light from start till #join_rescuers

Quote[/b] ]#initcheck

_cntBluforList = count _bluforlist

#Checking-Distance-From-Pilot1-To-All-BluforList

? _cntBluforList = 0 : ~5 ; goto "initcheck"

_cntBluforList = _cntBluforList - 1

? ((pilot1 distance (_bluforlist select _cntBluforList)) < 100) : "SmokeShellGreen" camcreate [getpos pilot1 select 0, (getpos pilot1 select 1) - 20, 10] ; ~5 ; goto "call_out"

~5

goto "Checking-Distance-From-Pilot1-To-All-BluforList"

;============= CALL OUT ================

#call_out

_rn = random (100)

?(_rn < 15): pilot1 say "pilotcall1" ; goto "call_out_return"

?(_rn < 30): pilot1 say "pilotcall2" ; goto "call_out_return"

?(_rn < 45): pilot1 say "pilotcall3" ; goto "call_out_return"

?(_rn < 60): pilot1 say "pilotcall4"

#call_out_return

_cntBluforList = count _bluforlist

#Checking-Distance-From-Pilot1-To-All-BluforList-2

? _cntBluforList == 0 : goto "call_out_return"

_cntBluforList = _cntBluforList - 1

? ((pilot1 distance (_bluforlist select _cntBluforList)) < 20) : goto "join_rescuers"

_rt = random (1)+1

~_rt

goto "call_out"

Probably smokeshell will fail...

Take always into acount that if the array _bluforlist is empty, will cause you some headache and the whole piece of script will be inside an infinite loop, and only will exit of that loop when _bluforlist is having a new player (??).

Ah sry, if this #Checking-Distance-From-Pilot1-To-All-BluforList is failing when doing goto, just put another name. I did that name to help me to understand what you trying.

As another tip, i see that you using the script as a 'linear' way to reach something... so.... you don't need to declare _rn and _rt. Just you can use only _rt or _rn, because you are using a 'linear' way, and you are declaring all the time the values, so it will never mix these variables.

It means:

Quote[/b] ]#call_out

_rt = random (100)

?(_rt < 15): pilot1 say "pilotcall1" ; goto "call_out_return"

?(_rt < 30): pilot1 say "pilotcall2" ; goto "call_out_return"

?(_rt < 45): pilot1 say "pilotcall3" ; goto "call_out_return"

?(_rt < 60): pilot1 say "pilotcall4"

And keep this

Quote[/b] ]_rt = random (1)+1

~_rt

as itself.

_rt will never be 'mixed'. Now you are using one variable less.

And what i've done changing your 'distance' sentences is just to simulate a nearestObject adding array to be checked, because i don't know specifically how many objects can have _bluforlist

   wink_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]i'm not understanding what you want to do when reaching to "#join_rescuers"

Thanks for all your efforts thus far. The join rescuers is simply having some downed pilots in enemy territory join the rescue team once they have been reached.

S/F

USMCRP

Share this post


Link to post
Share on other sites

The error says, that a CODE was expected, but a STRING was given instead, in the following line before the 'count' command<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?( ("(_x distance pilot1) < 100" count _bluforlist) > 0 ):goto ...

I think the correct way should be this:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?( ({(_x distance pilot1) < 100} count _bluforlist) > 0 ):goto ...

You need to use curly brackets instead of the double apostrophe.

edit: i see that someone has already corrected this error. Sorry, next time i'll try to read better.

Share this post


Link to post
Share on other sites

I've read earlier that nearestobject doesnt work well in Arma because the engine streams data (objects).

Are the pilots placed randomly? That sounds like a bit of work just to make the pilots join your group and throw smoke smile_o.gif .

Share this post


Link to post
Share on other sites
I've read earlier that nearestobject doesnt work well in Arma because the engine streams data (objects).

Are the pilots placed randomly? That sounds like a bit of work just to make the pilots join your group and throw smoke smile_o.gif .

What would you recommend?

S/F

USMCRP

Share this post


Link to post
Share on other sites

Just copy the 'feeling' of the nearestObject command, and make your 'few-lines' in the exact way, but allowing more than 50 meters and no issues with streams.

I think is easy to 'copy' this nearestObject.

Also try to test the "nearestObjects". In Wiki, not appearing that 50 meters limit. (I never used it for more than 14 meters, even never tried to check more than 14m).

Share this post


Link to post
Share on other sites
I've read earlier that nearestobject doesnt work well in Arma because the engine streams data (objects).

Are the pilots placed randomly? That sounds like a bit of work just to make the pilots join your group and throw smoke smile_o.gif .

I think you got confused. The object command doesn't work because of the streaming, and the nearestObject command must be used instead.

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  

×