Jump to content

cookies2432

Member
  • Content Count

    246
  • Joined

  • Last visited

  • Medals

Everything posted by cookies2432

  1. cookies2432

    Issues calling functions

    I'm still having issues when calling the functions, i have even replaced the functions code to a simple hint command to see if it was something wrong with the function. No luck tho. // Finds a mission location from 4 possible ones _fn_findMissionLocation = { private ["_convoy1", "_convoy2", "_convoy3", "_convoy4"]; _convoy1 = getMarkerPos "convoy1"; _convoy2 = getMarkerPos "convoy2"; _convoy3 = getMarkerPos "convoy3"; _convoy4 = getMarkerPos "convoy4"; [_convoy1, _convoy2, _convoy3, _convoy4] call BIS_fnc_selectRandom; }; // Creates a marker at "_location" _missionMarker = createMarker ["missionMarker", call _fn_findMissionLocation]; _missionMarker setMarkerShape "ELLIPSE"; _missionMarker setMarkerSize [200, 200]; _missionMarker setMarkerBrush "Solid"; _missionMarker setMarkerColor "ColorRed"; _missionMarker setMarkerText "Convoy taking a break"; // A function that spawns the ai and vehicles at the mission, both have a limit. _fn_spawnAiOnMission = { private ["_aiLimit", "_truckLimit"]; _aiLimit = _this select 0; //retrive the first parameter from the function call; _truckLimit = _this select 1; //retrive the second parameter from the function call; _aux = 0; //added a aux variable that I use as index for the while loop _alpha = createGroup west; //create a group that after the execution of this function will be automatically deleted while {_aux < _aiLimit} do { "B_Soldier_F" createUnit [getMarkerPos "missionMarker", group _alpha, setBehaviour "SAFE"]; _aux = _aux + 1; hint format ["There are %1 ai units in the mission area", _aiLimit]; sleep 5; }; //at this point _aux should be 10 _aux = 0; //again 0 while {_aux < _truckLimit} do { _veh = createVehicle ["B_MRAP_01_F", getMarkerPos "missionMarker"]; _aux = _aux + 1; }; //finish doing the same thing }; // Creates a timer for the mission, if time <= 1 then it will delete the marker and delete all units after 5 minutes (a hint tells everyone about it) // This is where i changed the code [] spawn { _fn_missionClock = { private ["_time"]; _time = 1200; if (1 + 1 == 2) do { while {_time >= 1} _time = _time - 1; }; if (_time <= 1) then { hint format["The convoy mission has ended. All vehicles and infantry will be deleted in 5 minute"]; deleteMarker "missionMarker"; sleep 300; }; call _fn_missionClock; }; [10, 2] call _fn_spawnAiOnMission; };
  2. cookies2432

    Issues calling functions

    Thanks for all the responses, will try them and see if i can get it working :)
  3. cookies2432

    Issues calling functions

    I know about local and global variables. _funnyVariable is a local variable funnyVariable is a global variable. How do i check the .rpt? I thought it was correct since it was working and i didn't need a variable. The Functions i'm in need of calling are: _fn_spawnAiOnMission and _fn_missionClock If there are any other script issues that people can find then please let me know, i'm fairly new to scripting.
  4. cookies2432

    addAction issues...

    Oh, thanks!
  5. So.. I'm trying to add an action to an ai character however, it doesn't seem to be working. This is my script: _buyHatchBack = carseller addAction ["Buy Hatchback",{call fn_carBuySystem}, [carID = C_Hatchback_01_F, carPrice = 200]6,false,false]]; My function call "fn_carBuysystem" is: fn_carBuySystem { carSpawn = carspawn; if (Money >= carPrice) then { Money = Money - carPrice; carID createVehicle setPos (getPos carSpawn); hint ["You have bought a %1 and you have %2 dollars left.", carName, Money]; } else { hint "You do not have enough money for this car"; }; What am i doing wrong? :)
  6. cookies2432

    addAction issues...

    I got more issues, YAY. :) So for some reason this doesn't seem to be working: "B_Soldier_F" createUnit [getMarkerPos "test", _group1]; But when i put it like this: "B_Soldier_F" createUnit [getpos player, group player]; I may be a total idiot for not knowing what's wrong but, i don't get it :mellow: . Proabably that damn "_this select 0" command agains isn't it? <_<
  7. cookies2432

    addAction issues...

    Ah thank, didn't know it could overwrite variables used by addons. :)
  8. cookies2432

    addAction issues...

    Thanks a ton!
  9. cookies2432

    addAction issues...

    I have another issue, i use the SetVehicleLock command, i can lock it but i can't unlock it for some reason. This is the function: fn_carBuySystem = { private ["_carID", "_carPrice", "_carName, _caller"]; _carID =(_this select 3) select 0; _carPrice = (_this select 3) select 1; _carName = (_this select 3) select 2; _carSpawn = carspawn; _caller = _this select 1; if (Money >= _carPrice) then { Money = Money - _carPrice; sleep 3; _veh = _carID createVehicle (getPos _carSpawn); _veh setVehicleLock "LOCKED"; _veh addAction ["Unlock Vehicle", {_veh setVehicleLock "UNLOCKED"}]; hint format ["You have bought a %1 and you have %2 dollars left.", _carName, Money]; } else { hint "You do not have enough money for this car"; }; };
  10. cookies2432

    addAction issues...

    Aha, yea i was thinking of the "this select 0 etc" command, wasn't just sure about it since i'm quite a "magic" variables. Thanks a ton for the help! :)
  11. Could someone be so kind as to explain exacly what "_this select 0" and (_this select 0) and select 0 means as well as _x? I've searched it up but seen different explenations all over, such as "It chooses an object from the array that it was exectued from" but after that i see "_this select 0" in the beginning of an init.sqf. _x i have no clue about. Thanks for reading and hopefully i can understand this.I'm just a new guy trying to learn scripting for arma :)
  12. cookies2432

    _this select and _x

    I don't take insult from it :). Thing is i understand variables in other scripting languages such as C++ with integeres (or however you spell them) but in arma "_x" and those other magic variables make it a bit confusing :mellow:
  13. cookies2432

    _this select and _x

    Thanks a lot! I think i understand now. I had trouble with those 2 variables for long, especially with the fact of them being in the middle of nowhere in a script, i didn't quite understand that but i think i do now. Thanks! :)
  14. cookies2432

    _this select and _x

    I understand that "_this select 0" and so on chooses an object from an array but what I don't understand is what it has to do with "_target, _caller and _object (I think)" as well as what it means when it's in the beginning of a script line where it looks like it and has no connection to any array. I didn't quite understand what "_x" does as well :(
  15. So.. I've been grinding my head about this for a couple of hours so i'll just see if i can get some help on here. :) I'm trying to make it so that a trigger will only go off if i have it detached inside of a trigger's radius. If possible also make it so that if you move the object away from the trigger's radius the timer will stop? And a last question would be how you could do a condition for an addAction that only allows you to do the addAction if you're let's say 4m from the object. Thanks for reading and i hope i can get help by someone! :D Also my friend got a question as to how you can increase the "Direct Channel" sound ingame more, even after putting it at max. Thanks! //Cookies
  16. cookies2432

    Basic Scripting help

    Oh i think i know what to do now, gonna try it!
  17. cookies2432

    Basic Scripting help

    I know of that but that'll delay the trigger from executing as well, which will just delay it all.
  18. cookies2432

    Basic Scripting help

    How can i upload it here, i can send my current mission but i don't know how.
  19. cookies2432

    Basic Scripting help

    I have tried it in the triggers' condition but it doesn't work however when i did so i used this: C4 distance vault <= 4; Which i belive is incorrect, or am i totally wrong here?
  20. cookies2432

    Basic Scripting help

    the _C4 and was supposed to refer to a game object called C4. With the distance i just can't get it to work, i use for example if ((C4 distance vault) <= 5) then { bla bla bla code here } But it never works. C4 and vault are game objects.
  21. cookies2432

    Basic Scripting help

    Oh. well i did not think that one through. How would i go on about doing it correct? I'm not very good at scripting. Also i'm having real difficulties with the "distance" command.
  22. cookies2432

    Basic Scripting help

    This is my script for it: publicVariable "_time"; _time = 20; _C4 = C4; _vault = vault; while {_time > 0} do { _time = _time - 1; hintSilent format["Time Left: \n %1", [((_time)/60)+.01,"HH:MM"] call BIS_fnc_timetostring]; sleep 1; }; if (_time < 1) then { bomb="M_Mo_82mm_AT_LG" createVehicle (getPos C4); deletevehicle C4; deleteVehicle _vault; };
  23. cookies2432

    Basic Scripting help

    i know that and i have done that, thing is that they can just run there with the object and then run off and the trigger will still go off, i don't want that to happend. i want it so that they have to drop the trigger and that it has to stay there for the whole countdown of the timer.
  24. cookies2432

    Basic Scripting help

    bump again :)
  25. cookies2432

    Basic Scripting help

    Basicly, I'm picking up a suitcase for example and I drop it inside of the area of a trigger. This starts a script, a timer. I want it so that the script stops if you move the suitcase outside of the triggers area.
×