Home   Help Search Login Register  

Author Topic: MP Player-controlled Spawning (Also making actions appear to a specific player)  (Read 1425 times)

0 Members and 1 Guest are viewing this topic.

Offline Kaio23

  • Members
  • *
  • I'm a llama!
Hi guys,

I haven't done any OFP editing in years, and I'm just trying to begin doing some ArmA tweaks to levels. I used to be somewhat proficient at scripting but it's all slipped away by now. I arrogantly thought I could create a script without help for my latest project but no luck...

What I am trying to do is, in a multiplayer map, have a "instructor" character played by a person for a training exercise who can spawn infantry or armour at specific locations we've set in the editor (easily done with an invisible marker). It's basically trying to emulate what VBS2 can do with real-time editing, which is creating pre-determined spawn points and creating OPFOR as they see fit if the exercise calls for it (Keeping troops on their toes). What I was thinking was this could be achieved by having it accessible through the action menu, but I am having trouble figuring out how to make the action only appear to the instructor (It would completely ruin the surprise if the entire force knew about it). I haven't even GOTTEN to making the script to make the infantry squads spawn at the markers.

I was hoping for four choices:

Spawn Infantry At *marker1*
Spawn Armour At *marker2*
Spawn Armour+Infantry Counter-Attack At *marker3* on *marker4* (the city)
Spawn Ambush At *marker5*

If anyone can assist me in this I would deeply appreciate it. I really wish I hadn't stopped editing OFP or I would have gotten these things by now.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
I moved the topic here because it can derive into a more specific MP discussion. But ATM, your question seems valid for MP or SP.
Lets say your instructor unit is named "instructor".
Now lets go to the init.sqf file of your mission:
Code: [Select]
// init.sqf
// Add here whatever other initialization you need
Sleep 4;
if (player == instructor) then
{
   player addAction ["Spawn Infantry At *marker1*", "spawninfantry1.sqf"];
   player addAction ["Spawn Infantry At *marker2*", "spawninfantry2.sqf"];
   player addAction ["Spawn armour+infantry", "spawnarmour1.sqf"];
   player addAction ["Spawn ambush", "spawnambush1.sqf"];
// Add more here if needed
};

Remember that the init.sqf script will be executed by the server and all the clients, even these that join the game later (JIP).

Offline Kaio23

  • Members
  • *
  • I'm a llama!
Thank you SO much, Mandoble. Hopefully that's the hard part out of the way. I'm sure spawning units at a marker and giving them waypoints has been done 5,000 times over. Still, since I was never THAT great of a scripter it's still gonna be a challenge. If anyone has any pointers on that, I would appreciate any help. I should be able to slug my way through it though over time.

On a side note, has a stable real time editor mod been released yet? That would make this whole process moot...I knew one was crawling around 6 months ago but it seemed very unstable and didn't work in MP. It's kind of ironic I'm using ArmA the way VBS is supposed to be used, as a military training simulator rather than a game.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
To create groups and units, look for createGroup, createUnit and, in case a particular side doesnt have any unit at mission startup, also createCenter command.

You will find several examples of usage of these commands in the forums.
Basically, you follow the sequence:
- Create group.
- Create any vehicle the group will use with createVehicle command
- Create units for the group, and if needed, "moveIn" them into the vehicles.
- Create waypoints for the group.
- Keep checking number of alive members of the group, as in case the group is anihilated you might want to create it again automatically.