Home   Help Search Login Register  

Author Topic: Some questions about scripts execution in MP  (Read 4185 times)

0 Members and 1 Guest are viewing this topic.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Some questions about scripts execution in MP
« Reply #15 on: 10 Feb 2008, 11:18:11 »
Yep, the code executed via action menus is always executed locally (for the player or unit that activated the action).

On the other side, trigger's code is executed everywhere.

For example:
the code of your action would have only: action_activator = _this select 1;
the condition of a new trigger: !isNull action_activator
the code of your trigger: res = [action_activator]execVM"computer.sqf"

computer.sqf will be executed everywhere once action_activator has the unit that activated the action, and inside computer.sqf you will to check locallity of the passed unit to make sure the switchmove is executed only when local (_this select 0), as switchMove and playMove works only when passed unit is local.


Offline Carroll

  • Members
  • *
  • Mission Designer (MP-"well tryin to capiche"
Re: Some questions about scripts execution in MP
« Reply #16 on: 10 Feb 2008, 14:45:05 »
Thanks Mandoble for the insight...however i am not entirely sure what i need to do  ???
I am guessing that in laymans terms i do not need to have a GameLogic named Server or have !?(Local Server):exit at the beginning of my script?

Please forgive my ignorance but i literaly have no idea how to interpret your answer, sorry but i'm realitively slow at picking things up

From what i can gather i need to check in my script when the Action has been activated with a trigger?
« Last Edit: 10 Feb 2008, 14:48:20 by Carroll »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Some questions about scripts execution in MP
« Reply #17 on: 10 Feb 2008, 17:16:04 »
The action script attached to your computer:
Code: [Select]
// computer_action.sqf
(_this select 0) removeAction (_this select 2);
action_activator = _this select 1;

Then you add a trigger to your map, condition:
Code: [Select]
!isNull action_activator
OnAct.:
Code: [Select]
res = [action_activator]execVM"gettingcomputerhd.sqf"


Code: [Select]
// gettingcomputerhd.sqf
// _unit is who activated the action
_unit = _this select 0;
// whatever you already have there
// In some cases use
if (local _unit) then
{
   switchMove whatever;
};

Offline Carroll

  • Members
  • *
  • Mission Designer (MP-"well tryin to capiche"
Re: Some questions about scripts execution in MP
« Reply #18 on: 10 Feb 2008, 18:17:03 »
Oh yes now i see it, thanks for taking the time to clear that up for me..my head gets easily confused when i see pieces of code i have never used before...but it makes sense to me now, cheers mate  :good: