Jump to content
Sign in to follow this  
aiki

Addaction (mp v 1.75)

Recommended Posts

I have a little problem with "addaction"

I have 3 guys in Group.

I add an action "DoIt" (same name for each) by 3 different scripts (DoItP1.sqs...DoItP3.sqs)

No problem in this matter.

but, when this guy are close, the item "DoIt" (and attached script i think too) is repeated 3 times in the action menu.

look messy, confuse and may be dangerous with RemoveAction

need it.

NB: This problem not exist with a certain distance between the 3 guys.

Is it a way to clean up that ?

Thanks.

Share this post


Link to post
Share on other sites

Could you use some kind of variables to indicate

whether you have already added that action to a specific

soldier/player?

Like

DoItAddedtoP1 and so on?

Share this post


Link to post
Share on other sites

If you are using add action to an object, not the players, I think you should add it to the object once. Then in one script you can decide who used the action.

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 (aiki @ Aug. 09 2002,14:05)</td></tr><tr><td id="QUOTE">I have 3 guys in Group.

I add an action "DoIt" (same name for each)  by 3 different scripts (DoItP1.sqs...DoItP3.sqs)

but, when this guy are close, the item "DoIt" (and attached script i think too)  is repeated 3 times in the action menu.<span id='postcolor'>

What you see is that you are able to see (and probably also to activate) not only "your" DoIt, but also "DoIt" of other people - because addAction is executed on all computers. To prevent this you can choose in script if you want to use addAction or not based on who is local and who not (in your situation I suppose you want to use unit AddAction [...] only when unit is local ("local unit" is true).

Share this post


Link to post
Share on other sites

If you are doing a multiplayer mission, you can do "player addAction ["blaa","something.sqs"]" to get an action for all players without having this multi-action problem when players are close to each other.

Share this post


Link to post
Share on other sites

Thanks,

I was not specific enough (and my english is gone long time ago ! )

This is the context :

MP CO_OP (v 1.75)

P1 to P3 are player.

P1 to P3 are in a group named Grp1.

P1 is Leader

P1 init field : ...this addaction ["DoIt","DoItP1.sqs"]

P2 init field : ...this addaction ["DoIt","DoItP2.sqs"]

P3 init field : ...this addaction ["DoIt","DoItP3.sqs"]

(Or by a script for do that, the result is the same)

it's working, i find "DoIt" in the first slot of actions menu :

DoIt

Blah

Blah

...

But, in game, when P1 and/or P2 and/or P3 are close (few meters between players) this list, for each players (P1 to P3), become :

2 guy close :

DoIt

DoIt

Blah

Blah

3 guy close :

DoIt

DoIt

DoIt

Blah

Blah

And when the players are not too close, this list is clean :

DoIt

Blah

Blah

wink.gif

Share this post


Link to post
Share on other sites

biggrin.gifbiggrin.gif

This is a good one. Too funny.

use the local scheck like Suma said.

EDIT: I think you will still see the multiple actions! No?

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 (aiki @ Aug. 09 2002,15:40)</td></tr><tr><td id="QUOTE">P1 init field : ...this addaction ["DoIt","DoItP1.sqs"]

P2 init field : ...this addaction ["DoIt","DoItP2.sqs"]

P3 init field : ...this addaction ["DoIt","DoItP3.sqs"]<span id='postcolor'>

What I suggested was moving this part to init.sqs and to do it this way:

local P1 ? P1 addaction ["DoIt","DoItP1.sqs"]

local P2 ? P2 addaction ["DoIt","DoItP2.sqs"]

local P3 ? P3 addaction ["DoIt","DoItP3.sqs"]

Kegetys is suggesting this (can be executed from init.sqs or from any init field):

player addaction ["DoIt","DoItP1.sqs"]

(This will bind DoItP1 script to action DoIt for all human players in MP).

Share this post


Link to post
Share on other sites

Multiplayer !!!

That is it !!!

Sometime, my brain gone in my shoes.

thanks for all.

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 (Suma @ Aug. 09 2002,15:45)</td></tr><tr><td id="QUOTE">What I suggested was moving this part to init.sqs and to do it this way:

local P1 ? P1 addaction ["DoIt","DoItP1.sqs"]

local P2 ? P2 addaction ["DoIt","DoItP2.sqs"]

local P3 ? P3 addaction ["DoIt","DoItP3.sqs"]<span id='postcolor'>

Beware:

even test "local" may be not what you want to get. When P2 or P3 will be AI controlled, they may be local even when they are not players.

Version that may suit you better is:

local P1 and P1 == player ? P1 addaction ["DoIt","DoItP1.sqs"]

local P2 and P2 == player ? P2 addaction ["DoIt","DoItP2.sqs"]

local P3 and P3 == player ? P3 addaction ["DoIt","DoItP3.sqs"]

Share this post


Link to post
Share on other sites

@suma

Hi,

When i make addaction in init.sqs, the guy respawn without this action, no problem with init field.

Thanks again.

PS: can you implement a new command (recurse) to give to the players a drink in the CDROM caddy ? wink.gif

Share this post


Link to post
Share on other sites

I am not sure what Suma will suggest but probably not this:

create a script called onPlayerrespawnOtherUnit.sqs in your mission folder.

Then add this inside </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_player = _this select 0

_killer = _this select 1

_new = _this select 2

;init

_camera = "camera" camCreate [9578.59,3540.29,1.66]

_camera cameraEffect ["internal","back"]

titleCut["","BLACK IN",1]

;=== 14:54:42

_camera camSetTarget _player

_camera camSetRelPos [0.20,0.39,1.86]

_camera camSetFOV 0.143

_camera camCommit 0

@camCommitted _camera

;=== 14:55:14

_camera camSetRelPos [-0.07,7.96,3.48]

_camera camSetFOV 0.7

_camera camCommit 5

@camCommitted _camera

;=== 14:55:34

_camera camSetTarget _new

_camera camSetRelPos [10.49,0.61,3.48]

_camera camSetFOV 0.7

_camera camCommit 5

@camCommitted _camera

;0 fadeMusic 0.3

;playMusic "Flashpoint1985"

;=== 14:56:09

_camera camSetRelPos [-0.82,-3.12,3.38]

_camera camSetFOV 0.044

_camera camCommit 3.5

@camCommitted _camera

;exit

_new switchCamera "INTERNAL"

_new cameraEffect ["terminate","back"]

camDestroy _camera

exit

<span id='postcolor'>

Before the exit put in the lines that add the action.

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  

×