Jump to content

Spriterfight

Member
  • Content Count

    171
  • Joined

  • Last visited

  • Medals

Everything posted by Spriterfight

  1. I have a question can i use foreach in a if statement or i have to use count?
  2. Yeah its easier but why dont you try something like a money system and you will gain money from kills and stuff
  3. I would advice a database like
  4. You will need profilenamespace to store information
  5. Spriterfight

    HELP ammo with forEach returns nothing

    Meanwhile i realised the rifle was not 1715_Seapat so i renamed it and now works.Thank you
  6. _all = {_x ammo "1715_Seapat"} forEach _musketers; hint format["%1", _all]; so i want the loaded ammo count for each unit from a gorup.If i loop throug them the script returns nothing but if i run the ammo code individually like this _ammocount = _musketer ammo "1715_Seapat"; it returns the loaded ammo.How can i return all the loaded ammo from a group?
  7. Spriterfight

    HELP ammo with forEach returns nothing

    my squad conatins two unit the player and the teammate.If i fire it retruns 0 but it sohuld return 1 because my teammate hasn't shot yet.The 1715_Seapat has only 1 round in the magazine.
  8. It is basically a custom spawn ai script that spawns ai on the nearest locations from the player,It is very custom and mission specific.But if i use this _locations = nearestLocations [ position player, ["Airport", "NameLocal", "NameVillage", "NameCity", "NameCityCapital","NameMarine"],worldsize*10]; _markerdist = 350; _locaiton = _locations select 0; while {true} do { { if (player distance getPos _x < player distance getPos _locaiton) then { _locaiton = _x; }; sleep 0.01; }foreach _locaitons; if (player distance getPos _locaiton < _markerdist) then { _locaiton call fnc_spawnai; } else {sleep 5;}; }; this script uses the first nearest location to player and spawns only one group of enemy unit.What i want is that if the player is close to several towns then in each settlement spawn an ai group. But to achieve this i need a change in the script to store the nearest locations from the player then call the spawn funciton on it.
  9. Spriterfight

    AI Following Player in Safe

    Please describe the problem detailed
  10. Spriterfight

    AI Following Player in Safe

    if it is the player s group _group = group player; _pos1 = getMarkerPos "yourvillagemarker"; _wp = _group addWaypoint [_pos1,0]; _wp setWaypointType "MOVE"; _wp setWaypointSpeed "Full"; _wp setWaypointBehaviour "SAFE"; _leader = leader _group; units _group doFollow leader _group; this in the init.sqf of the mission
  11. Spriterfight

    AI Following Player in Safe

    is the player in the same squad or separate?
  12. _locations = nearestLocations [ position player, ["Airport", "NameLocal", "NameVillage", "NameCity", "NameCityCapital","NameMarine"],600]; _markers = _locations; _markerdist = 500; while {true} do { { if ({player distance getPos _x < _markerdist} forEach _markers) then { hint "work"; { [_x] call fnc_detectai; } forEach _markers; } else {sleep 5;}; }; I have a problem.So i want that if the player is near multiple locations then the function will be activated.But when i go near a town it wont actiave the function.What is the problem?So i want that the funcion to be activated with each location where the player is close. For example my player is close to 2 location then the function have to be activated on each.
  13. Spriterfight

    HELP With ai detecting script

    Thank you.Just testing things around and i forget to change the names of the variables.If i use _loc = _locations apply {getpos _x}; it works
  14. So i have an array _array = ["myArray", "myArray1", "myArray2", "myArray3", "myArray4", "myArray5","myArray6", "myArray7", "myArray8"]; how can i select ex 4 random elements and loop through it because i dont want to loop thorug every element
  15. No because those elements are locations and i dont want the units to spawn every nearest location from the player so i want to select random locarions from this array with a limited number,If its duplicated then a group will be spawned twice at the same location
  16. Here is my code fnc_spawn = { _selectableunits = ["CUP_B_HIL_GL", "CUP_B_HIL_MMG", "rhsgref_hidf_marksman", "rhsgref_hidf_sniper", "rhsgref_hidf_teamleader", "rhsgref_ins_g_machinegunner", "rhsgref_ins_g_medic", "rhsgref_ins_g_rifleman_akm", "rhsgref_ins_g_rifleman", "rhsgref_ins_g_grenadier", "rhsgref_ins_g_rifleman_RPG26", "rhsgref_ins_g_rifleman", "I_L_Hunter_F", "I_L_Looter_SG_F", "I_L_Hunter_F", "CUP_I_PMC_Sniper", "CUP_I_PMC_Soldier_MG_PKM", "CUP_I_PMC_Soldier_GL_M16A2", "CUP_I_PMC_Pilot", "CUP_I_PMC_Sniper_KSVK", "CUP_I_PMC_Sniper", "CUP_I_PMC_Soldier_AT"]; _c = 5; _group = creategroup east; _pos = (trg1 getRelPos [(random ((triggerArea trg1) select 0)), random(360)]); for "_i" from 1 to _c do { _unit1 = _selectableunits call BIS_fnc_selectRandom; _unit = _unit1 createUnit [_pos, _group]; sleep 1; // it gives me generic erro in expression _unit addEventHandler ["Killed", { _corpse = _unit; _corpse spawn BIS_fnc_DeleteCorpseofSoldier; }]; }; }; Sleep command gives me generic error in expresion.If i remove it it dosent give me error.
  17. Spriterfight

    HELP With sleep inside function

    i made another script so it works but yours gives me error in line 36 between the function and the arrays
  18. Spriterfight

    HELP With sleep inside function

    invaild number in expression
  19. Spriterfight

    HELP With sleep inside function

    Now it says undefined variable in _unit also i dont use spawn because it messes with my character, it teleports somwhere on the edge of the map
  20. So i have a mp map where the ai respawns and have to move on a specified location. I want that if the ai respawns check if the waypoint is completed.If it is completed then copy the previous waypoints when they respawn. The problem was that if their waypoint is completed after respawn they dont have waypoint, Thew group's name is group1 and i tried copywaypoint but i cant do group1 cpyWaypoint group1;
  21. Spriterfight

    HELP With respawn waypoint

    Thanx, i think i will figure it out by myself
×