Jump to content
Sign in to follow this  
OnlineKenji

Hmm...what am i doing wrong?

Recommended Posts

I must be doing something wrong...what is it? My code simply will NOT work properly. Please look at my script and comment. Thank you.

Legend:

InsertionChopper - the name of a West Chopper placed with the editor.

server - a gamelogic placed with the editor.

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

enableRadio false

titleText["Petrovice....", "Black In", 7]

;CREATE THE CAMERA

playMusic "7thIAmGonaFly"

_camera = "camera" CamCreate [4092.81,5112.39,13.34]

_camera CameraEffect ["Internal","Back"]

_camera camCommit 0

@camCommitted _camera

HostStartsIntro = false

PublicVariable "HostStartsIntro"

usedPlayers = (crew InsertionChopper); PublicVariable "usedPlayers";

?!(local server) : goto "WaitForHost"

?(local server) : titleText["Welcome Host. Map by Kenji.", "plain", 1]

_unusedPlayers = (crew InsertionChopper)

"_x MoveInCargo InsertionChopper" forEach [a1,a2,a3,a4,a5,a6,a7,a8]

usedPlayers = (crew InsertionChopper) - _unusedPlayers; PublicVariable "usedPlayers"

_LeadGuy = (usedPlayers select 0)

usedPlayers Join _leadGuy; publicVariable "usedPlayers"

HostStartsIntro=true; publicVariable "HostStartsIntro";

#WaitForHost

?!(local server) : titleText["Welcome client. Map by Kenji", "plain", 1]

@HostStartsIntro

#IntroStart

_ct = _ct + 1

...Skipped a Crap Load of camera shots

; Tell The Insertion Chopper to Move to the landing Zone

InsertionChopper flyinheight 100

InsertionChopper setPos [(getPos InsertionChopper select 0), (getPos InsertionChopper select 1), 100]

InsertionChopper doMove [(getPos lzInsertion select 0), (getPos lzInsertion select 1)]

InsertionChopper SetSpeedMode "NORMAL"

....Skipped Another Crap load of camera shots. No references to my player or Ai objects were made just cam scripting. All my cam commands ends with @camCommit _camera. I did them with Camera.sqs.

; EJECT EACH PLAYER ONE BY ONE

enableRadio false

HostFinishedEject=false; publicVariable "HostFinishedEject"

?!(local server) : goto "WaitForHostFinishedEject"

_i=0

_j = count usedPlayers

_LeadGuy = (usedPlayers select 0)

#EjectLoop

_ThisUnit = (usedPlayers select _i)

unassignVehicle _ThisUnit

_ThisUnit Action ["eject", vehicle InsertionChopper]

_i=_i+1

@(_ThisUnit distance InsertionChopper) > 40

?_j > _i : goto "EjectLoop"

HostFinishedEject=true; publicVariable "HostFinishedEject"

#WaitForHostFinishedEject

@HostFinishedEject

enableRadio true

; Destroy the camera

_camera cameraEffect ["terminate", "back"]

camDestroy _camera

; Start the timer

[] Exec "TimeLimit.sqs"

; SEND THE CHOPPER TO THE WAITING POINT

InsertionChopper doMove getPos ChopperWaitingPosition

Exit

<span id='postcolor'>

It gets to the part where it's supposed to eject the guys, but it doesn't. I had a titleText that displayed the count of the usedPlayers array, but my clients always saw either 0 or scalar. I don't know what I'm doing wrong. Give me a shout if you can. Thank you.

Share this post


Link to post
Share on other sites

PublicVariable will not pass arrays, of anything. Group references yes...

Share this post


Link to post
Share on other sites

Oh....

hmm..I don't have a group reference.

In the editor I have the team as one group, so that when you're choosing your role it apears as one team.

Then in init.sqs I split them up, so that each person can choose their own loadout.

Then I put them back together in the intro. I did not know that it couldn't pass arrays....the comref is very vague on it.

- Do you have an example where you use it more than in that RadioOn.sqs RadioOff.sqs example that I saw in the threads.

- Did you have to put it off in a seperate .sqs or is that just your style?

- Can i enumerate a "Group" like i can an array?

- Can I manipulate global objects from just the host machine? Like '?(local server) : "_x AddWeapon ""HK""" forEach <Public Group>'

I know i'm asking a lot, but I couldn't find this information anywhere. I just ask for a little patience with me

sad.gif . Thanks.

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">- Do you have an example where you use it more than in that RadioOn.sqs RadioOff.sqs example that I saw in the threads.

<span id='postcolor'>

Yes, look at the Multiplayer Marker Management on the bn880 web page below. There is 1 other example there I think.

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

- Did you have to put it off in a seperate .sqs or is that just your style?<span id='postcolor'>

I'm not sure by what you mean by 'it', but PublicVariable works in triggers also. (my style and clearer logic)

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

- Can i enumerate a "Group" like i can an array?

<span id='postcolor'>

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

Operand types:

grp: Group

Type of returned value:

Array

Description:

Arrays of all units in the group.

Example:

player in units group player

<span id='postcolor'>

Looks like you can.

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">Can I manipulate global objects from just the host machine? Like '?(local server) : "_x AddWeapon ""HK""" forEach <Public Group>'

<span id='postcolor'>

Yes, as far as I remember that's actually the best way of doing it. (hopefully what we think is global really is) smile.gif

Share this post


Link to post
Share on other sites

Thanks a lot bn88 smile.gif .

I will be able to experiment a little, now that I have a much more narrow range to experiment in. Thanks.

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  

×