OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Aron on 30 Aug 2008, 10:10:59
-
I'm editing a MFCTI and heres the scripts
To build crate
;Last modified 2/19/4
;Only execute this on the server.
? !(Local LocalServerObject):Exit
_side = _this Select 0
_type = _this Select 1
_destination = _this Select 2
_direction = _this Select 3
_sideText = "West";_sideText1 = "W"
? (_side == east):_sideText = "East";_sideText1 = "E"
? (publicServer):goto "InitPublicServer"
#Init
? (_type == weaponsCrateType):_name = Format["C8X_usmcbox",_sideText]
? (_type == ammoCrateType):_name = Format["MFCTI116%1AmmoCrate",_sideText]
? (_type == heavyWeaponsCrateType):_name = Format["MFCTI116%1HeavyWeaponsCrate",_sideText]
? (_type == heavyAmmoCrateType):_name = Format["MFCTI116%1HeavyAmmoCrate",_sideText]
goto "CreateCrate"
#InitPublicServer
? (_type == weaponsCrateType) || (_type == heavyWeaponsCrateType):_name = Format["ReammoBox%1",_sideText]
? (_type == ammoCrateType) || (_type == heavyAmmoCrateType):_name = Format["AmmoBoxAdd%1",_sideText1]
#CreateCrate
;Create building, props, gun, & gunner.
_crate = _name CreateVehicle _destination
_crate SetDir _direction
_crate SetPos _destination
_crate SetPos [(_destination Select 0)+((sin _direction)*0.5),(_destination Select 1)+((cos _direction)*.5),(_destination Select 2)]
? (_side == east):goto "AddCrateToEast"
#AddCrateToWest
;Send the new building to other players.
westBuildingBuiltMP = _crate;PublicVariable "westBuildingBuiltMP"
westBuildingBuiltTypeMP = _type;PublicVariable "westBuildingBuiltTypeMP"
Exit
#AddCrateToEast
;Send the new building to other players.
eastBuildingBuiltMP = _crate;PublicVariable "eastBuildingBuiltMP"
eastBuildingBuiltTypeMP = _type;PublicVariable "eastBuildingBuiltTypeMP"
To load crate
;Last modified 3/19/4
;Adds equipment to a crate on the client's side.
;Script Usage:[Side,Crate,CrateType] Exec "EquipCrate.sqs"
_side = _this Select 0
_crateType = _this Select 1
_crate = _this Select 2
? !(publicServer):Exit
ClearMagazineCargo _crate
ClearWeaponCargo _crate
? (_side == east):goto "EquipEastCrate"
#EquipWestCrate
? (_crateType == weaponsCrateType):goto "EquipWestWeaponsCrate"
? (_crateType == ammoCrateType):goto "EquipWestAmmoCrate"
? (_crateType == heavyWeaponsCrateType):goto "EquipWestHeavyWeaponsCrate"
? (_crateType == heavyAmmoCrateType):goto "EquipWestHeavyAmmoCrate"
Exit
#EquipEastCrate
? (_crateType == weaponsCrateType):goto "EquipEastWeaponsCrate"
? (_crateType == ammoCrateType):goto "EquipEastAmmoCrate"
? (_crateType == heavyWeaponsCrateType):goto "EquipEastHeavyWeaponsCrate"
? (_crateType == heavyAmmoCrateType):goto "EquipEastHeavyAmmoCrate"
Exit
#EquipMiscCrate
_crate AddMagazineCargo ["Mine",50]
_crate AddMagazineCargo ["Pipebomb",1]
_crate AddMagazineCargo ["Handgrenade",10]
_crate AddMagazineCargo ["SmokeShell",0]
_crate AddMagazineCargo ["SmokeShellRed",0]
_crate AddMagazineCargo ["SmokeShellGreen",0]
Exit
#EquipWestWeaponsCrate
_crate AddWeaponCargo ["C8XM16acog",5]
_crate AddWeaponCargo ["C8XM16M203acog",5]
_crate AddWeaponCargo ["C8XM249PARAcco",5]
_crate AddWeaponCargo ["HK",5]
_crate AddWeaponCargo ["LSR_m82a1",5]
_crate AddWeaponCargo ["MM1",2]
Exit
#EquipWestAmmoCrate
_crate AddMagazineCargo ["C8xm16mag",12]
_crate AddMagazineCargo ["LSR_m82a1magIT",12]
_crate AddMagazineCargo ["LSR_m82a1magAP",12]
_crate AddMagazineCargo ["Steyrmag",6]
_crate AddMagazineCargo ["G36aMag",6]
_crate AddMagazineCargo ["M4",6]
_crate AddMagazineCargo ["MM1magazine",4]
_crate AddMagazineCargo ["c8xM203Vest",12]
_crate AddMagazineCargo ["c8xm203grenade",12]
Exit
#EquipWestHeavyWeaponsCrate
_crate AddWeaponCargo ["SUCHsmawLauncher",5]
_crate AddWeaponCargo ["SUCHJavelinLauncher",5]
_crate AddWeaponCargo ["AALauncher",5]
goto "EquipMiscCrate"
#EquipWestHeavyAmmoCrate
_crate AddMagazineCargo ["SUCHsmawATHE",12]
_crate AddMagazineCargo ["SUCHJavelinMag",12]
_crate AddMagazineCargo ["SUCHsmawAT",12]
_crate AddMagazineCargo ["AALauncher",12]
Exit
#EquipEastWeaponsCrate
_crate AddWeaponCargo ["AK74",2]
_crate AddWeaponCargo ["AK74GrenadeLauncher",2]
_crate AddWeaponCargo ["PK",2]
_crate AddWeaponCargo ["Bizon",2]
_crate AddWeaponCargo ["SVDDragunov",2]
_crate AddWeaponCargo ["6g30",2]
Exit
#EquipEastAmmoCrate
_crate AddMagazineCargo ["AK74",20]
_crate AddMagazineCargo ["PK",6]
_crate AddMagazineCargo ["BizonMag",12]
_crate AddMagazineCargo ["SVDDragunov",20]
_crate AddMagazineCargo ["6g30Magazine",8]
_crate AddMagazineCargo ["GrenadeLauncher",6]
Exit
#EquipEastHeavyWeaponsCrate
_crate AddWeaponCargo ["RPGLauncher",2]
_crate AddWeaponCargo ["AT4Launcher",2]
_crate AddWeaponCargo ["9K32Launcher",2]
goto "EquipMiscCrate"
#EquipEastHeavyAmmoCrate
_crate AddMagazineCargo ["RPGLauncher",12]
_crate AddMagazineCargo ["AT4Launcher",6]
_crate AddMagazineCargo ["9K32Launcher",6]
Exit
Now the problem is, the c8x USMC crate works fine, its built.. but the crate has orginal weapons in it, instead of the weapons I defines in the loadout. Whats wrong?!?
Note: I know only one c8x crate is there.
-
I am not good or should I say I stink at scripting. :-[
I just go to the Editors Depot and use OFP script editor by Chris Henderson. He also has one exactly like it for Arma.
Using this for crates will call a script load out from ammo box, its done.
Now, you just got to worry about if your crates are put/called to the right area.
Hopefully this helps :dunno: