Jump to content

Help with DZMS


sego

Recommended Posts

So I have a Computer Science Bachlors and a friend asked if i could write him some code.  I started by looking at the DZMS custom AI missions.  I changed one and create my "own" mission.  Just kind of testing them i understand the language.  Below is the code.  I think i need to add a my new element to the DZMS Major array with the name of that new file (SG1).  << is this correct.  Also i just have the game and have no clue what i need to do to test if it works since i have never hosted or done anything with my own server.

 

/*
Outpost by Sego
Updated to new format by Vampire
*/
private ["_missName","_coords","_base","_base1","_veh1","_vehicle","_crate","_crate1"];

//Name of the Mission
_missName = "Bandit Outpost";

//DZMSFindPos loops BIS_fnc_findSafePos until it gets a valid result
_coords = call DZMSFindPos;

[nil,nil,rTitleText,"Bandits have set up a Outpost!\nThey will defend it at all cost!", "PLAIN",10] call RE;

//DZMSAddMinMarker is a simple script that adds a marker to the location
[_coords,_missName] ExecVM DZMSAddMajMarker;

//We create the scenery
_base = createVehicle ["TK_WarfareBBarracks_EP1",_coords,[], 0, "CAN_COLLIDE"];
_base setDir 152.66766;
_base setPos _coords;

_base2 = createVehicle ["Land_Fort_Watchtower_EP1",[(_coords select 0) - 5.4585, (_coords select 1) + 2.885,0],[], 0, "CAN_COLLIDE"];
_base2 setDir -21.45
_base2 setPos [(_coords select 0) + 8.4585, (_coords select 1) - 2.885,0];

_trk1 = createVehicle ["Land_Ural_Wrecked",[(_coords select 0) + 8.4585, (_coords select 1) - 2.885,0],[], 0, "CAN_COLLIDE"];
_trk1 setDir 120.45
_trk1 setPos [(_coords select 0) + 8.4585, (_coords select 1) - 2.885,0];


//DZMSProtectObj prevents it from disappearing
[_base] call DZMSProtectObj;
[_base2] call DZMSProtectObj;
[_trk1] call DZMSProtectObj;

//We create the vehicles
_veh1 = ["large"] call DZMSGetVeh;
_vehicle = createVehicle [_veh1,[(_coords select 0) - 10.6206, (_coords select 1) - 0.49,0],[], 0, "CAN_COLLIDE"];

_veh2 = ["large"] call DZMSGetVeh;
_vehicle2 = createVehicle [_veh2,[(_coords select 0) - 13.6206, (_coords select 1) - 0.49,0],[], 0, "CAN_COLLIDE"];

//DZMSSetupVehicle prevents the vehicle from disappearing and sets fuel and such
[_vehicle] call DZMSSetupVehicle;
[_vehicle2] call DZMSSetupVehicle;

//We create and fill the crate
_crate = createVehicle ["USBasicAmmunitionBox",[(_coords select 0) + 0.7408, (_coords select 1) + 1.565, 0.10033049],[], 0, "CAN_COLLIDE"];
[_crate,"money"] ExecVM DZMSBoxSetup;
[_crate] call DZMSProtectObj;
_crate1 = createVehicle ["USBasicAmmunitionBox",[(_coords select 0) - 0.2387, (_coords select 1) + 1.043, 0.10033049],[], 0, "CAN_COLLIDE"];
[_crate1,"weapons"] ExecVM DZMSBoxSetup;
[_crate1] call DZMSProtectObj;
_crate2 = createVehicle ["USBasicAmmunitionBox",[(_coords select 0) - 0.7408, (_coords select 1) + 2.565, 0.10033049],[], 0, "CAN_COLLIDE"];
[_crate2,"money"] ExecVM DZMSBoxSetup;
[_crate2] call DZMSProtectObj;

//DZMSAISpawn spawns AI to the mission.
//Usage: [_coords, count, skillLevel, unitArray]
[[(_coords select 0) - 4.0796, (_coords select 1) - 11.709,0],6,2,"DZMSUnitsMinor"] call DZMSAISpawn;
sleep 3;
[[(_coords select 0) + 2.8872, (_coords select 1) + 18.964,0],6,3,"DZMSUnitsMinor"] call DZMSAISpawn;
sleep 3;
[[(_coords select 0) + 28.8872, (_coords select 1) + 28.964,0],2,2,"DZMSUnitsMinor"] call DZMSAISpawn;
sleep 3;
[[(_coords select 0) - 28.8872, (_coords select 1) + 28.964,0],2,2,"DZMSUnitsMinor"] call DZMSAISpawn;
sleep 3;
[[(_coords select 0) + 28.8872, (_coords select 1) - 28.964,0],2,2,"DZMSUnitsMinor"] call DZMSAISpawn;
sleep 3;
[[(_coords select 0)  -.8872, (_coords select 1) - 28.964,0],2,2,"DZMSUnitsMinor"] call DZMSAISpawn;
sleep 3;

//Wait until the player is within 30 meters and also meets the kill req
[_coords,"DZMSUnitsMinor"] call DZMSWaitMissionComp;

//Call DZMSSaveVeh to attempt to save the vehicles to the database
//If saving is off, the script will exit.
[_vehicle] ExecVM DZMSSaveVeh;
[_vehicle2] ExecVM DZMSSaveVeh;

//Let everyone know the mission is over
[nil,nil,rTitleText,"The Outpost has been captured!", "PLAIN",6] call RE;
diag_log text format["[DZMS]: Major SG1 Outpost Ended."];
deleteMarker "DZMSMajMarker";
deleteMarker "DZMSMajDot";

//Let the timer know the mission is over
DZMSMinDone = true;
 

Link to comment
Share on other sites

Fixed those.  Is there a way to test this without setting the server stuff up.  I started to do it but i never connect it to MySQL so when i try to run it leaves me in the lobby cause it cant connect to the SQL server

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...