OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: Maverick2002 on 17 Feb 2007, 00:29:20
-
Hi!
I`m not a guru when it comes to scripting, so i wonder if anyone can help me with a few things..
1 problem:
I want spesific soldiers in a group (playable in MP) only to be able to pick up spesific weapons from crates. Like the sniper will only be able to pick up M24 and MK12 from ammo crates, the machinegunner can just pick M249 and so on...i guess i need a script?
2 problem:
In a group of 10 (also playable in MP) i want only 2 soldiers(pilots) to be able to mount helicopters as pilots. The 8 other soldiers in the group should be restricted to fly helicopters (mount them as pilots).
I have an alternative solutions, with simple triggers and "setvehiclelock" for the choppers, but it only works like 80% of what i want..
Thank you!
-
i can give you an answer for the pilot thing....
- give each chopper a unique name.
- create a trigger close to it.
- set the condition to this: typeOf (driver helochopter) != 'SoldierWPilot'
- onActivation: (driver helochopter) action ['Eject', helochopter]
basically it just makes him eject after trying to mount
-
Thanks!
So now only pilots can mount the chopper as pilot, and denies regular soldiers?
And i guess "activation" should be set to "none" in the triggers?
-
Sorry, but can anyone describe littlebit more how that works?
What is SoldierWPilot and how do i decides who can be the pilot?
-
You did read the post by Cory B?
Give the chopper a name in its name field via the unit placement dialog.
Create a trigger close to it.
The condition that will activate the trigger: typeOf (driver helochopter) != "SoldierWPilot" ...helochopter presumably represents the name of the chopper given in the first step. "SoldierWPilot" is the classname of the pilot model. So this line is checking if whoever gets in the chopper is a pilot or not.
Presuming the condition is true and the person getting in the pilots seat is not "SoldierWPilot", then the OnActivation line will run:
(driver helochopter) action ["Eject", helochopter] ... Which means he is automatically ejected.
If on the other hand the person getting into the pilots seat is "SoldierWPilot" then the trigger will not fire.....Hopefully :dunno: :D
Unfortunately it doesn't seem to work.
Planck
-
hmm....it should work.
make sure your pilot guy is in fact a 'SoldierWPilot'. also make sure the chopper is named according to the commands in the trigger.
i used 'SoldierWPilot' in the example because i am assuming that you are on the west team? (usa)
-
No, didnt work! But this did:
Condition: !isNull driver heli1
On Activation: if(typeOf driver heli1 != "SoldierWPilot" )then{driver heli1 action["Eject",heli1]};
But thanks anyway, you got me close enough! :)
-
oh ... haha i know why it wasn't working. if there was no driver, the trigger was active because the driver (objNull) is not the soldier.
so umm.... yeah you got it.
-
Ok, 1 problem solved, 1 to go! :laugh:
Anyone have ideas how i can define what weapons the different soldiers can pick up?
It`s important for my missions, that the players have regular roles in the team. I don`t want my machinegunner suddenly running around with a M24! 8)
-
Hi all.
Condition: !isNull driver heli1
On Activation: if(typeOf driver heli1 != "SoldierWPilot" )then{driver heli1 action["Eject",heli1]};
One problem with this one; afer the helicopter has respawned, this does not work anymore. Everybody can then fly the helicopter.
Can someone please assist on how to solve that issue? Thanks in advance.
-Rawhide
-
the helicopter has respawned
??? is dat MP tingy ?
nywayz.... try 2 set da triger 2 repeadetly
LCD OUT
-
Thanks, but it's already set to "Repeatedly". Any solution?
-Rawhide
-
When the helicopter respawns the new chopper no longer has the name you gave the original. How are you respawning the helicopter?
-
I'm using two different respawn scripts, for different purposes.
The two helicopters, mh6a and mh6b, uses the first one called vehiresespawn.sqs.
The Harrier uses the harrier_vrs.sqf.
The helicopters respawn script:
?! (local server): exit
~3
_vehicle = _this select 0
_delay = _this select 1
_empty = true
_disabled = false
_moved = false
_startpos = getpos _vehicle
_startdir = getdir _vehicle
_type = typeof _vehicle
#waiting
~2
_newpos = getpos _vehicle
?! (_newpos select 0 in _startpos) or not (_newpos select 1 in _startpos): _moved = true
?! (isnull driver _vehicle) or not (isnull gunner _vehicle) or not (isnull commander _vehicle): _empty = false
? (isnull driver _vehicle) and (isnull gunner _vehicle) and (isnull commander _vehicle): _empty = true
?! (canmove _vehicle) or (canfire _vehicle): _disabled = true
? (canmove _vehicle) and (canfire _vehicle): _disabled = false
? (_disabled) and (_empty): goto "spawn"
? (_moved) and (_empty): goto "spawn"
goto "waiting"
#spawn
~_delay
?! (isnull driver _vehicle) or not (isnull gunner _vehicle) or not(isnull commander _vehicle): _empty = false
?! (_empty): goto "waiting"
deletevehicle _vehicle
~0.5
_newveh = _type createvehicle _startpos
_newveh setpos _startpos
_newveh setdir _startdir
[_newveh, _delay] exec "vehirespawn.sqs"
exit
The Harrier, har1, respawnscript:
//BEGIN vrs.sqf
//By KaRRiLLioN
//IMPORTANT: ADD A GAMELOGIC NAMED Server
//to the mission to prevent multispawn
private ["_vcl","_respawndelay","_dir","_pos","_type","_run","_crewWait","_wait","_delay"];
if (!local Server) exitWith {};
_vcl = _this;
_respawndelay = 10;
_dir = Getdir _vcl;
_pos = Getpos _vcl;
_crewWait = 30;
_wait = 0;
_type = typeOf _vcl;
_run = TRUE;
sleep 1;
for [{}, {_run}, {_run}] do
{
while {canMove _vcl && count crew _vcl < 1} do
{
_wait = Time + _crewWait;
sleep 1;
};
while {Count crew _vcl > 0 && Alive _vcl} do
{
_wait = Time + _crewWait;
sleep 1;
};
while {canMove _vcl && count Crew _vcl < 1 && Time < _wait} do
{
sleep 1;
};
_delay = Time + _respawnDelay;
while {!canMove _vcl && count Crew _vcl < 1 && Time < _delay} do
{
sleep 1;
};
if (count Crew _vcl < 1) then
{
deleteVehicle _vcl;
_vcl = _type createVehicle _pos;
_vcl setdir _dir;
sleep 1;
_vcl setvelocity [0,0,0];
_vcl setpos _pos;
sleep 1;
_vcl setvelocity [0,0,0];
//code to remove bombs and fuel following respawn
_vcl setFuel 0.1;
_vcl removeMagazine "6Rnd_GBU12_AV8B";
_vcl removeMagazine "300Rnd_25mm_GAU12";
};
};
And thanks for your interest.
-Rawhide
-
Today someone posted a similar question, or at least an option to solve the issue by bringing the name of the vehicles and the data in the initialization field to the respawned vehicle. I posted my question there as well.
Link: http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=c62af801a454cd378c48401621ce51bf;act=ST;f=71;t=66937;st=15;r=1;&#entry1137025
-Rawhide
-
When respawning via a script the vehicleVarName and setVehicleVarName commands are your best friends.