Home   Help Search Login Register  

Author Topic: testing an attack script (help)  (Read 943 times)

0 Members and 1 Guest are viewing this topic.

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
testing an attack script (help)
« on: 10 Feb 2009, 10:14:46 »
Hi all, I'm trying to get the idea of scripting down, I really don't know how yet, but I have the idea of varialbes down I just don't know how to use them and command the script to do what I want it to do.

I know this is not correct but this is just an idea of an attack by a simple west soldier against and east soldier, this is what I want to happen..

Quote
_throw = _this select 0
_Detect = _this select 1
_Attack = _this select 2
_Soldier1 = _this select 3
_enemy1 = _this select 4

If _soldier1 detects _enemy1 then throw "grenade" at _enemy1 if _soldier1 is close enough to _enemy1

As you can see it's pretty straight forward, if west detects east then throw grenade if close enough.

Well I really don't know how to use this, anyone help and please keep it simple like this as close as you can or atleast so I can understand it and I really only know about variables and doing simple things with soldiers and stuff. 

thanks..




Who's hyped for Arma4, long live Arma!

Offline Rommel92

  • Members
  • *
Re: testing an attack script (help)
« Reply #1 on: 13 Feb 2009, 10:45:15 »
Code: [Select]
//execution: [<soldier1_unit>, <enemy_unit>] spawn compile preprocessfile "this_script.sqf"
_Soldier1 = _this select 0;
_enemy1 = _this select 1;

If (_soldier1 knowsAbout _enemy1) then {
if (_soldier distance _enemy1) then {
_soldier1 dowatch _enemy1;
sleep 2.667;
_soldier1 Fire ["throw","HandGrenade","GrenadeHand"];
//_soldier1 Fire ["throw","HandGrenadeTimed","GrenadeHandTimed"];
};
};

Hope that helps/works.