guziczek101 11 Posted November 25, 2011 I wrote a script and (if you watch Band of brothers in 2nd period is a scene of destroying of the guns ) i have a problem I'm at work and don't really have time to describe it, but prepared a demo of the problem (do not need anything besides the original OFP) http://www.gamefront.com/files/21024045/test.intro.zip Share this post Link to post Share on other sites
ProfTournesol 956 Posted November 25, 2011 guziczek101 said: I wrote a script and (if you watch Band of brothers in 2nd period is a scene of destroying of the guns ) i have a problem I'm at work and don't really have time to describe it, but prepared a demo of the problem (do not need anything besides the original OFP) http://www.gamefront.com/files/21024045/test.intro.zip Don't see any problem... Share this post Link to post Share on other sites
guziczek101 11 Posted November 25, 2011 the problem is in that the works even if you do not have grenades Share this post Link to post Share on other sites
ProfTournesol 956 Posted November 25, 2011 guziczek101 said: the problem is in that the works even if you do not have grenades Yep, i see. This works (instead of your checkAA.sqs) _Flak = _this select 0 @(({_x == "handgrenade"} count magazines player)>=1) _Flak addaction ["Destroy AA-Gun","stickyBomb.sqs"] exit Share this post Link to post Share on other sites
guziczek101 11 Posted December 9, 2011 (edited) Mission Test I improved this simple script and he add Action if you have two conditions you must be closer than X meters (u can change distance) and u must have at least one grenade in your inventory Check.sqs [Target,Distance] exec "Check.sqs" Reveal hidden contents _gun = _this select 0 _dis = _this select 1 _checkarray = [] #loop @(({_x == "handgrenade"} count magazines Player)>=1) ?(player distance _gun) < _dis && !(_gun in _checkarray): destroy = _gun addaction ["Place Charge","stickyBomb.sqs"]; _checkarray = _checkarray + [_gun] ?(player distance _gun) > _dis : _gun removeaction destroy; _checkarray = _checkarray - [_gun] ?!(alive player): exit ~0.5 goto "loop" and the stickybomb.sqs isn't mine i found it on Ofpec stickybomb.sqs Reveal hidden contents ;myTank addAction ["Attach Sticky Bomb","scripts\stickyBomb.sqs"] ;stickyBomb.sqs ;Tank that the action is attached to. _tank = _this select 0 ;Action number to remove _indexNumber = _this select 2 player RemoveMagazine "handgrenade" ;Give the player 10 seconds to run away. ~10 ;Get the position of the tank _tankPos = getPos _tank _tankX = _tankPos select 0 _tankY = _tankPos select 1 ;Create a large explosion at the tank. _stickyBomb = "Shell73" camCreate [_tankX,_tankY,1] ;Make sure he's dead :) if (alive _tank) then {_tank setDammage 1} ;Remove the now redundant action _tank removeAction _indexNumber ;exit script exit Sorry for double post Edited December 9, 2011 by guziczek101 xXx Share this post Link to post Share on other sites
nikiller 18 Posted December 9, 2011 (edited) hi, I suggest you to check if _gun is alive in your check.sqs or your loop will run forever even if the gun was destroyed and it's not a good thing for performance. Your condition should be like this: ? !(alive player) || !(alive _gun): exit I also suggest to make player play animation PutDown, say "look out!" and group chat "look out!" in your stickybomb.sqs. IMHO it will add to mission atmosphere and show to player that he's putting a bomb. Add those lines in stickybomb.sqs just after you remove handgrenade: player playMove "PutDown" player say "ENG29" player groupChat "Look out!" cya. Nikiller. Edited December 9, 2011 by Nikiller Share this post Link to post Share on other sites
guziczek101 11 Posted December 12, 2011 Thanks Nikiller I'm a beginner in scripting so I really thank you for identifying bugs Share this post Link to post Share on other sites
guziczek101 11 Posted January 5, 2012 (edited) I worked a little with this system and I reached the conclusion: 1. does not have to check if player has grenade's/satchels because inventory of player is a little too small (need to have grenades at the expense of ammunition) 2. Tank does not have to be destroyed, enough to be immobilized 3. Crew can die from the overloading of explosion strength even if tank is not destroyed 4. Time is displayed for an explosion (in upper right corner)* I a little worked on this system and i present this: Check.sqs Reveal hidden contents ; ***************************************************** ; ** Check.sqs this script will check distance player and object to blow up ; ** Written by guziczek101 for Operation "Neptune" mission ; ** [object,distance,true/false] exec "Skrypty\Efekty\Check.sqs" ; ***************************************************** _gun = _this select 0 _dis = _this select 1 _random = _this select 2 _checkarray = [] #loop ?(player distance _gun) < _dis && !(_gun in _checkarray): destroy = _gun addaction ["Place Charge","stickybomb.sqs"]; _checkarray = _checkarray + [_gun] ?(player distance _gun) > _dis : _gun removeaction destroy; _checkarray = _checkarray - [_gun] ?(!(alive player) || !(alive _gun)) : exit ~0.5 goto "loop" Stickybomb.sqs Reveal hidden contents ; ***************************************************** ; ** Stickybomb.sqs this script will blow up the object ; ** Written by guziczek101 for Operation "Neptune" mission ; ** Script is called from Check.sqs ; ***************************************************** _gun = _this select 0 ?(!(alive _gun)) : exit TimeisUp = FALSE _dam = Getdammage _gun player switchmove "CombatToMedic" ~5 player say "Eng29" player sidechat "Lookout" player switchmove "MedicToCombat" [] exec "CountD.sqs" ~10 ?TimeIsUp : goto "RDamage"; #RDamage _nrand = random(10) ?_nrand >= 7: goto "KILL2" ?_nrand >= 3: goto "KILL3" ?_nrand >= -10: goto "KILL1" #kill1 _gun setdammage (_dam + 0.5) playsound "Explo" goto "fire" exit #kill2 _gun setdammage (_dam + 1) playsound "Explo" goto "fire" exit #kill3 _gun setdammage (_dam + 0.7) playsound "Explo" goto "fire" exit #fire _smoke= "SmokeShell" CamCreate [0,0,0] _smoke setpos getpos _gun _color2 = [0.009, 0.00,0,0.99] _whitereal = [0,0,0,0] _shell = "Shell105" CamCreate [0, 0, 0] _shell setpos getpos _gun drop ["cl_basic", "", "Billboard", 1, 5, [0,3,0], [0,0,0], 0, 1.1, 1, 0.5, [Random 7, 9, 15],[_color2, _color2, _color2, _whitereal],[0],0.2,0.6,"","",_shell] ~3 deletevehicle _smoke goto "Randomkill" #Randomkill _random = true _maxkills = 3 ?count _this == 2: _random = _this select 2; _maxkills = 4 ?count _this == 3: _random = _this select 2; _maxkills = _this select 3 ; now the randomkills _crew = crew _gun _c = count _crew _i = 0 _kills = 0 #crew _unit = _crew select _i ?random 1 > 0.8 && _unit != player : _unit setdammage (random 1) ?random 1 > 0.8 && _unit != player && _kills < _maxkills : _unit setdammage 1; _kills = _kills + 1 _i = _i + 1 ?_i < _c : goto "crew" exit CountD.sqs Reveal hidden contents ; ***************************************************** ; ** CountD.sqs ; ***************************************************** Counting=true _timeRSC = 10 #COUNTDOWN ?_timeRSC >= 100 : TitleRSC [format ["%1",_timeRSC],"PLAIN"] ?_timeRSC < 100 && _timeRSC >= 10 : TitleRSC [format ["0%1",_timeRSC],"PLAIN"] ?_timeRSC < 10 : TitleRSC [format ["00%1",_timeRSC],"PLAIN"] _timeRSC = _timeRSC - 1 ?_timeRSC == 010 : _timeRSC = 000 ?_timeRSC == -1 : TimeIsUp = True; Exit ~1 ?alive player and Counting : Goto "COUNTDOWN" Exit Demo Mission * The countdown script is not mine it's from the CSLA 2 mission Poison Island (I hope this is not offended anyone, but really wanted to have the counter to keep the climate,yet it is not what I wanted, watch such as in Call of Duty 2 / Medal of Honor ) Edited January 5, 2012 by guziczek101 i forgot something Share this post Link to post Share on other sites