Spoor 23 Posted November 27, 2017 Gents, noob here but have an other question = how can I make a vehicle being a part of the ticket system ?? what I would like to do is when a vehicle is being destroyed a certain number of tickets will be deducted from the tickets - ideas please - thanks Share this post Link to post Share on other sites
pierremgi 4916 Posted November 27, 2017 For the vehicle itself, it's simple, you have a "tickets" field in the module (or param in my script); For punishing a player, you need to add a little code in the field of each vehicle you would like to protect with that: this addMPEventHandler ["MPkilled", { [(_this select 2),-1,true] call BIS_fnc_respawnTickets}]; You can change the -1 value with the penalty you want. 1 Share this post Link to post Share on other sites
Spoor 23 Posted November 28, 2017 @pierremgi - thanks yr info checking this after and let y know when succeeded Edit: Just checked - Srry but I did forget to tell that I don't want to use vehicle respawn module .... ideas ?? Share this post Link to post Share on other sites
pierremgi 4916 Posted November 28, 2017 This code works as soon as a vehicle as destroyed by a unit, independently of respawning or not. Killer is punished (for this vehicle). You can script some conditions. You can also have a respawn vehicle system, apart, like this one. Share this post Link to post Share on other sites
Spoor 23 Posted November 28, 2017 @pierremgi - just tested again, min ago ... WORKS !!!! - but would like to get a ticket deducted from the side the vehicle belongs, is that possible ?? - looking to yr script now - thanks Share this post Link to post Share on other sites
pierremgi 4916 Posted November 29, 2017 Sure! do what you want. in the init field of some vehicle you like: this addEventHandler ["killed",{ params ["_killed","_killer","_instigator","_side"]; if (count crew _killed >0) then { _side = [_killed,false] call bis_fnc_objectSide } else { _side = [_killed,true] call bis_fnc_objectSide }; [_side,-1,false] call BIS_fnc_respawnTickets }]; For example, if the vehicle (empty or not) is a WEST model, the WEST side will loose one point. But, If EAST unit(s) are inside a WEST made hunter (as crew), the point is subtracted to EAST. 1 Share this post Link to post Share on other sites
Spoor 23 Posted November 29, 2017 Fabulous!! , thanks again man - testing this p.m. Share this post Link to post Share on other sites
Spoor 23 Posted November 30, 2017 @pierremgi - it works like a charm only have the following error, could you plz have a look, I have no clue - thanks Edit: understand it's an ACE thing, afraid we have to wait Share this post Link to post Share on other sites
Spoor 23 Posted February 6, 2018 @pierremgi - need a little help again from y if you dont mind. I want to punish a player/side with bleeding tickets when they kill a civilian. Been trying to do it myself but dnt succeed - thanks Share this post Link to post Share on other sites
pierremgi 4916 Posted February 6, 2018 civilian men? I can't test it but try: this addEventHandler ["killed",{ params ["_killed","_killer","_instigator","_side"]; if (([_killed,true] call bis_fnc_objectSide == civilian or captive _killed) && !isnull _instigator) exitWith { [side _instigator,-1,false] call BIS_fnc_respawnTickets }; if (count crew _killed >0) then { _side = [_killed,false] call bis_fnc_objectSide } else { _side = [_killed,true] call bis_fnc_objectSide }; [_side,-1,false] call BIS_fnc_respawnTickets }]; The problem is what you want to protect with that. I guess you can't copy/paste this code in all init fields of the units/vehicles. So you can define an array of units. Never mind the method, just think about edited (3den) or spawned (in game). The second case needs a loop to refresh the array but, without treating the former units again and again. First, the code is: { _x addEventHandler [.....] } foreach AnArrayOfUnits; // can be [bob1,bob2,bob3] but also allUnits for example (men only), or vehicles (as written) or allUnits + vehicles Second, if you spawn some new units, you need to track the new units and "treat" them with EH. Two ways: You treat them, immediatly once they spawn (I kept the case of an array here): { _x addEventHandler [....] } forEach arrayOfNewSpawnedUnits; // just after spawning code or make a loop in init.sqf, waiting for some new arrival, considering general arrays like allUnits or vehicles: [] spawn { while {true} do { { _x setVariable ["treated",true]; _x addEventHandler [....] } forEach AnArrayOfUnits select { !(_x getVariable ["treated",false]) }; // works fine with allUnits or vehicles } }; . Share this post Link to post Share on other sites
Spoor 23 Posted February 7, 2018 Thanks will test first thing in the mrng. I will use this in a TvT mission where towns are populated with civilians (AI). When a player/side kills a civi his side will be heavely punished with bleeding-out tickets. Share this post Link to post Share on other sites
Spoor 23 Posted February 15, 2018 @pierremgi - srry for late reply, again works perfectly - thanks Share this post Link to post Share on other sites
Spoor 23 Posted February 27, 2018 @pierremgi - would like to have one more vafor from you; I need an invisable sector (have done this by a triggers) which works more or less like the vanilla sector control module. What I did is placing 2 triggers over each other and a marker somewhere on the map which changes colour when the trigger is activated by either side. I placed the fllw in the trigger/On Activation - "marker name" setMarkerColor "ColorRed"; hint "The platform is controlled by Opfor"; - and visa versa. I would like to add tickets (repeatable) to the faction who has captured the trigger area - could you please help me out - thanks Share this post Link to post Share on other sites
pierremgi 4916 Posted February 27, 2018 @Spoor We are a little bit far from the topic. If you need some more help with the respawn ticket, you should open another thread, useful for other readers. You problem is just question to select who triggered your trigger(s), so how do you wrote them. After that, your choice is simple. Please open another thread, if you can't find some topic about about triggers. Share this post Link to post Share on other sites
Spoor 23 Posted February 28, 2018 @pierremgi - srry for that. Im really a noob as regards to scripting etc but because of yr hint I fixed it - thanks Share this post Link to post Share on other sites
Lbbde 28 Posted November 30, 2018 Since everyone seems to have more idea than me, I have a question: what exactly do I have to write in the expression field in the respawn module menu, so that the vehicle respawns exactly as it was before (camouflage, components and most importantly the loadout of aircraft) ? There is only written that an array is passed with the new and the old vehicle. How exactly do I use this? Can someone please write the code for this here? Share this post Link to post Share on other sites
davidoss 552 Posted November 30, 2018 Well it easy but first write how you get the vehicle at start as (camouflage, components and most importantly the loadout of aircraft) Share this post Link to post Share on other sites
pierremgi 4916 Posted November 30, 2018 23 minutes ago, Lbbde said: Since everyone seems to have more idea than me, I have a question: what exactly do I have to write in the expression field in the respawn module menu, so that the vehicle respawns exactly as it was before (camouflage, components and most importantly the loadout of aircraft) ? There is only written that an array is passed with the new and the old vehicle. How exactly do I use this? Can someone please write the code for this here? I took time to write a script because the respawn module is limited. Share this post Link to post Share on other sites
Lbbde 28 Posted November 30, 2018 24 minutes ago, davidoss said: Well it easy but first write how you get the vehicle at start as (camouflage, components and most importantly the loadout of aircraft) The vehicles are placed in the editor and configured there via the corresponding functions (Edit appearance and pylons) Share this post Link to post Share on other sites
davidoss 552 Posted December 1, 2018 editor vehicle init field: if (isServer) then { this setVariable [ "veh_customs", [ [this,typeOf this] call BIS_fnc_getVehicleCustomization, [getWeaponCargo this,getMagazineCargo this,getItemCargo this,getBackpackCargo this], getpos this, direction this ],false]; }; editor vehicle respawn module expression field: params [["_newVeh",objNull,[objNull]],["_oldVeh",objNull,[objNull]]]; private _paramcheck = (_oldVeh getVariable ["veh_customs",[]]) params [["_customs",[],[[]]],["_inventory",[],[[]]],["_position",[],[[]]],["_direction",0,[0]]]; if (!_paramcheck) exitWith {deleteVehicle _oldVeh}; _customs params [["_texture",[],[[]]],["_anime",[],[[]]]]; _inventory params [["_guns",[],[[]]],["_mags",[],[[]]],["_items",[],[[]]],["_backpack",[],[[]]]]; deleteVehicle _oldVeh; [_newVeh, _texture, _anime, true] call BIS_fnc_initVehicle; _newVeh setPos _position; _newVeh setDir _direction; clearWeaponCargoGlobal _newVeh; clearMagazineCargoGlobal _newVeh; clearItemCargoGlobal _newVeh; clearBackpackCargoGlobal _newVeh; for "_i" from 0 to ((count (_guns select 0)) -1) do {_newVeh addWeaponCargoGlobal [((_guns select 0) select _i),((_guns select 1) select _i)]}; for "_i" from 0 to ((count (_mags select 0)) -1) do {_newVeh addMagazineCargoGlobal [((_mags select 0) select _i),((_mags select 1) select _i)]}; for "_i" from 0 to ((count (_items select 0)) -1) do {_newVeh addItemCargoGlobal [((_items select 0) select _i),((_items select 1) select _i)]}; for "_i" from 0 to ((count (_backpack select 0)) -1) do {_newVeh addBackpackCargoGlobal [((_backpack select 0) select _i),((_backpack select 1) select _i)]}; editor vehicle respawn module parameter "wreck" set to "preserve". Wreck will be deleted by the code 4 Share this post Link to post Share on other sites