Home   Help Search Login Register  

Author Topic: New here, need help!  (Read 2058 times)

0 Members and 1 Guest are viewing this topic.

Offline PSPSoldier534

  • Members
  • *
New here, need help!
« on: 14 Dec 2008, 20:23:01 »
Hi, I've been browsing these boards since they came up, and I'm glad I joined up. I like making addons, and I'm making animations. But, how can I allow soldiers to shoot when playing a scripted animation? Any help is appreciated :).

Offline zwobot

  • Members
  • *
Re: New here, need help!
« Reply #1 on: 14 Dec 2008, 21:44:30 »
fire and doFire come into my mind. But I don't know if they work while an animatin is played via switchMove or playMove...
"Executing tactics in real combat is the hardest thing one can ever do...well I've never given birth but..well whatever."

Offline PSPSoldier534

  • Members
  • *
Re: New here, need help!
« Reply #2 on: 14 Dec 2008, 21:57:58 »
I know those commands, but I want to give the player an ability to shoot when say leaning (via SwitchMove or Playmove).

Offline zwobot

  • Members
  • *
Re: New here, need help!
« Reply #3 on: 14 Dec 2008, 22:01:56 »
So you are talking about animation packs which provide lean animations for the player (like in WGL or GRAA?). If this is the case you should contact for example Sanctuary; he seems to be very competent with animations. I'm sure he can tell you whats possible and what isn't.
"Executing tactics in real combat is the hardest thing one can ever do...well I've never given birth but..well whatever."

Offline PSPSoldier534

  • Members
  • *
Re: New here, need help!
« Reply #4 on: 15 Dec 2008, 02:09:25 »
Sorta. Like maybe a rappel animation where the player can shoot.

Edit: I know I got an addon pack that let me. Can't remember which though :(.
« Last Edit: 15 Dec 2008, 02:34:33 by PSPSoldier534 »

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: New here, need help!
« Reply #5 on: 15 Dec 2008, 06:25:18 »
You can script AI to shoot while moving by using UseWeapon command.  Attached is a sample mission with a script called shootAndMove.sqf. 

The core part of the script that controls shooting and moving is this:

Code: [Select]
  while { alive _foe and (_count < 25) and (_shooter distance _foe) > 10 and alive _shooter} do
      {
      _shooter reveal _foe;
      _shooter dotarget _foe;
      sleep (_delay + .3);
      // move and shoot occurs here
      _shooter playmove _move;
      sleep (_delay + ((random 3) * .2));   
      _gameLogic action ["useWeapon",_shooter,_shooter,0];
      //_shooter dotarget _foe;
      sleep (_delay + ((random 4) * .2));
      _gameLogic action ["useWeapon",_shooter,_shooter,0];
      sleep (_delay + ((random 3) * .2));
      _gameLogic action ["useWeapon",_shooter,_shooter,0];
      _count = _count + 1;
   };

El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Ext3rmin4tor

  • Members
  • *
Re: New here, need help!
« Reply #6 on: 15 Dec 2008, 16:00:46 »
Sorry for the OT but does the commands "sleep" and "waitUntil" work under OFP 1.96???
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!

Offline zwobot

  • Members
  • *
Re: New here, need help!
« Reply #7 on: 15 Dec 2008, 17:23:30 »
No they don't. See in the biki: http://community.bistudio.com/wiki/sleep and http://community.bistudio.com/wiki/waitUntil they are both available in Arma only.
You have to use ~ or @ in Ofp and they only work in SQS scripts, not SQF functions.
« Last Edit: 15 Dec 2008, 18:00:24 by bedges »
"Executing tactics in real combat is the hardest thing one can ever do...well I've never given birth but..well whatever."

Offline Ext3rmin4tor

  • Members
  • *
Re: New here, need help!
« Reply #8 on: 15 Dec 2008, 17:35:38 »
Thanks because I wrote a thread on how making those functions manually for OFP but noone replied. So somehow when you write scripts for OFP you're still bound to SQS syntax, right?
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!

Offline zwobot

  • Members
  • *
Re: New here, need help!
« Reply #9 on: 15 Dec 2008, 18:23:13 »
No, not really. You can use both SQS and SQF in Ofp. However there are subtle differences in syntax (from Ofp to Arma) and as said before some commands are not available in Ofp.
Functions in Ofp should be used for what their name suggests: functions. That means providing a very special task which is needed several times in a mission. You can really think of them as methods of functions you might know from "normal" programming.
Also the execution is different: Script execution and function execution (Arma specific)
"Executing tactics in real combat is the hardest thing one can ever do...well I've never given birth but..well whatever."

Offline Ext3rmin4tor

  • Members
  • *
Re: New here, need help!
« Reply #10 on: 15 Dec 2008, 18:29:01 »
Just as I thought, the problem is that SQF syntax lets you get rid of the horrible "spaghetti-code" you're forced to use (you use often the goto function) when programming with SQS syntax since it is line based and you can't write code blocks on multiple lines. In any case if you have time read the thread "SQF syntax in Operation Flashpoint" where I wrote some code that might help in suspending a script made in SQF syntax and tell me what you think.
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!

Offline PSPSoldier534

  • Members
  • *
Re: New here, need help!
« Reply #11 on: 20 Dec 2008, 22:17:11 »
Is it possible to give them cover nodes?

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: New here, need help!
« Reply #12 on: 26 Dec 2008, 23:50:31 »
Sorry guys, the example I posted was for ARMA not OFP...so that code may not be OFP compatible.  Not sure.

For cover nodes, you can create game logics as nodes, and have ai dotarget or dowatch the game logics.  Or AI can dowatch a position.  It requires scripting to achieve.
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Ext3rmin4tor

  • Members
  • *
Re: New here, need help!
« Reply #13 on: 29 Dec 2008, 11:04:55 »
It is not compatible with OFP if you look at my previous question
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!