kevbaz 0 Posted July 17, 2009 Hi guys Currently trying to get a script that checks the players vehicle flying height and if its above a set limit i would like to have a weapon fire at it. need it to keep checking untill it reaches a certain waypoint. any ideas? many thanks ---------- Post added at 11:33 PM ---------- Previous post was at 09:46 PM ---------- answer to the first part of my question (getPos chop1 select 2) > 100 now to just figure out how to then create something to fire at the vehicle... Share this post Link to post Share on other sites
f2k sel 164 Posted July 17, 2009 Getpos is above ground GetposASL is above sea level I use this to obtain x,y,z of objects when creating a mission you could modify it for your needs. ;[this] exec "coords.sqs" _unit = _This Select 0; #loopit _xcoor = getPos _unit select 0; _ycoor = getPos _unit select 1; _zcoor = getPos _unit select 2; _dir = getdir _unit hint format ["X:%1 Y:%2 Z:%3 D%4", _xcoor, _ycoor, _zcoor, _dir]; ~2 goto "loopit" Share this post Link to post Share on other sites
kevbaz 0 Posted July 17, 2009 (edited) Hmm so far i have this in a trigger but no joy cond (getPos ap select 2) > 100 act sam = createVehicle ["stinger_pod", getpos player]; "RUS_Soldier2" createUnit [position sam, group red,"this moveingunner sam; sam dotarget ap; sam dofire ap"]; Edited July 17, 2009 by KEVBAZ Share this post Link to post Share on other sites
f2k sel 164 Posted July 18, 2009 Trigger Conditions are best left for simple true or false conditions. As for the code it's not right this part "this moveingunner sam; sam dotarget ap; sam dofire ap" is in "" for some reason so can't be right. You should look at calling a script it's much easier to see the problems. Share this post Link to post Share on other sites
kevbaz 0 Posted July 18, 2009 the condition works fine, i can get it to dispaly a hint etc, just having trouble spawning the vehicle when the player is anyone? Share this post Link to post Share on other sites
f2k sel 164 Posted July 18, 2009 (edited) Well I got a bit further, it does everything except fire at the target. It has ammo and it does track the target but won't shoot. // nul=[target] execVM"spawn.sqf" _target = _this select 0; _unit = "RUS_Soldier2"; mygroup = creategroup side player; _sam = createVehicle ["stinger_pod", getpos player,[],0,"fly"]; _unit createUnit [(getpos player), mygroup,"man=this;"]; _unit = man; _unit moveingunner _sam; _sam reveal _target; _sam dotarget _target; _sam dofire _target; Place nul=[ap] execVM"spawn.sqs" in the On act of the trigger and save the scrpit as spawn.sqf Edited July 18, 2009 by F2k Sel Share this post Link to post Share on other sites
kevbaz 0 Posted July 18, 2009 ah excellent, atleast now its spawning the unit, howefver is there a way of spawning it on the ground within a certain raduis of the players location? and theres still the issue of makin it fire Share this post Link to post Share on other sites
f2k sel 164 Posted July 18, 2009 It does spawn on the ground I just don't know the correct syntax. Share this post Link to post Share on other sites
kevbaz 0 Posted July 18, 2009 odd mine spawned ontop of my helo.... thanks Share this post Link to post Share on other sites
f2k sel 164 Posted July 18, 2009 (edited) The syntax is none,fly,form I was a ground unit so change it to none. I found the firing bug, I was on the same side as the target so it spawned a Russian as friend. I changed myself to Russian and it worked. It still spawns on the chopper though. Edited July 18, 2009 by F2k Sel Share this post Link to post Share on other sites
kevbaz 0 Posted July 18, 2009 (edited) ive changed it to none, yet it still spanws right on me is there a way of telling to get the players position then to -100 from the height? Edited July 18, 2009 by KEVBAZ Share this post Link to post Share on other sites
f2k sel 164 Posted July 18, 2009 Sorted it. // nul=[target,caller] execVM"spawn.sqf" _target = _this select 0; _caller = _this select 1; _temppos = 0; _unit = "RUS_Soldier2"; mygroup = creategroup side player; _temppos = [getpos _caller select 0,getpos _caller select 1, 0]; _sam = createVehicle ["stinger_pod",_temppos,[],0,"none"]; _unit createUnit [_temppos, mygroup,"man=this;"]; _unit = man; _unit moveingunner _sam; _sam reveal _target; _sam dotarget _target; _sam dofire _target; I've included another parameter to be passed "caller" who's doing the spawning. Set that to the name of the AI or player ie in your case Chop1 or player Share this post Link to post Share on other sites
kevbaz 0 Posted July 18, 2009 cant get it to do anything, ive tried _player and _ap yet still nothing spawns. this makes an east controlled stinger spawn and shoot the west player right? Share this post Link to post Share on other sites
f2k sel 164 Posted July 18, 2009 try without the _ you need [ap,chop1] east shoots west Share this post Link to post Share on other sites
kevbaz 0 Posted July 18, 2009 so.. [ap,chop1] = _this select 1; tried that but still nothing? // nul=[target,caller] execVM"spawn.sqf"_target = _this select 0; [ap,chop1] = _this select 1; _temppos = 0; _unit = "RUS_Soldier2"; mygroup = creategroup side player; _temppos = [getpos [ap,chop1] select 0,getpos [ap,chop1] select 1, 0]; _sam = createVehicle ["stinger_pod",_temppos,[],0,"none"]; _unit createUnit [_temppos, mygroup,"man=this;"]; _unit = man; _unit moveingunner _sam; _sam reveal _target; _sam dotarget _target; _sam dofire _target; Share this post Link to post Share on other sites
f2k sel 164 Posted July 18, 2009 (edited) No, in your trigger in the On Act box it should be nul=[ap,chop1] execVM"spawn.sqf" I forgot your using getpos in your trigger cond , I couldn't get it to work with that so I changed it to getposASL and it works well. Edited July 18, 2009 by F2k Sel Share this post Link to post Share on other sites
kevbaz 0 Posted July 18, 2009 hmm i have that set already, its just not spawning anything? Share this post Link to post Share on other sites
f2k sel 164 Posted July 18, 2009 Try this http://www.sendspace.com/file/pzvkmp unzip and place in your missions directory Share this post Link to post Share on other sites
kevbaz 0 Posted July 18, 2009 hmm your using gamelogics fr the spawn points, i cant as i dont know where on the map the player will be when he goes over his height limit? Share this post Link to post Share on other sites
f2k sel 164 Posted July 18, 2009 hmm your using gamelogics fr the spawn points, i cant as i dont know where on the map the player will be when he goes over his height limit? Logics work as well, I thought I'd removed them. This should be it. http://www.sendspace.com/file/qicuhe Share this post Link to post Share on other sites
kevbaz 0 Posted July 18, 2009 cool almost there with it. in my mission, you are the pilot, you are a us pilot in a cobra, if you fly to high iwant this script to kick in and punish you at the moment its spawning but not firing on me, i delted the russian chopper and soldier you had, made my pilot of the cobra and flew about, it spawned but as i said never fired? MANY thanks for your help though, so close to getting it working because of you thanks Share this post Link to post Share on other sites
f2k sel 164 Posted July 18, 2009 I'm a bit stuck now, if I change mygroup = creategroup side player; to mygroup = creategroup east; I get no error and the sam spawns but not the man and there are no error reported. ---------- Post added at 07:22 PM ---------- Previous post was at 06:13 PM ---------- Ok this is it, I found the problem. http://www.sendspace.com/file/e7hx2h For it to work it needs a Russian unit somewhere on the Island otherwise nothing will happen. There is a command to fix this called createcenter so you don't need the unit but I don't know how to implement it. Share this post Link to post Share on other sites