Home   Help Search Login Register  

Author Topic: [SOLVED]Staying still for just a second?  (Read 2689 times)

0 Members and 1 Guest are viewing this topic.

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
[SOLVED]Staying still for just a second?
« on: 08 Feb 2012, 12:57:32 »
I'm making one of my mission's intro, and I have multiple resistance running around, and killing multiple cops. Now I was wondering how I can get the different resistance groups to stay where they are, until indicated to move to their next waypoint in a script. Or could I use game logic, at the position of the current waypoint, and use the domove command in the script whenever I want them to take off?
« Last Edit: 11 Mar 2012, 04:32:34 by Mad Pup »
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad

Re: Staying still for just a second?
« Reply #1 on: 08 Feb 2012, 13:39:17 »
Hi Mad Pup!

   If there are not so many resistance units going around, you may try to give each one of them a name (es. res1, res2, res3, res4 etc.) and then, when you want them to stop doing anything, you may try to run this line:

Code: [Select]
{_x stop true} forEach [res1, res2, res3, res4]
Then, when you want resistance units to move again from where they previously left, you have to run this line:

Code: [Select]
{_x stop false} forEach [res1, res2, res3, res4]
Cheers!
? (this == thinkable) : this = scriptable

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
Re: Staying still for just a second?
« Reply #2 on: 08 Feb 2012, 21:26:30 »
Would I replace _x with something? or leave it?

Okay, so let me get this straight: Lets say res1 is running, and I want res2 and res3 to stop, the script would be:

Code: [Select]
{_x stop true} forEach [res2, res3]
like that?
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: Staying still for just a second?
« Reply #3 on: 08 Feb 2012, 21:44:46 »
That's correct pup. '_x' is used to select all units within an array. In this instance, the array is [res2, res3]. You could use the 'disableAI "move"' command as well I guess, if you want them to stop completely. Both commands should work fine.
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
Re: Staying still for just a second?
« Reply #4 on: 08 Feb 2012, 21:55:47 »
Alright.

Thank you both Gruntage, and Doktor Headshot!  :D

-Mad Pup

EDIT: It's not working for some reason, it's giving me an error
Code: [Select]
Uknown Opporator: stop
 ???
The script line was

Code: [Select]
{_x stop true} forEach [res1, res2, res3]
« Last Edit: 09 Feb 2012, 02:47:36 by Mad Pup »
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad

Re: Staying still for just a second?
« Reply #5 on: 09 Feb 2012, 10:51:17 »
Quote
Alright.

Thank you both Gruntage, and Doktor Headshot! :D

-Mad Pup

You're welcome! :)

Quote
EDIT: It's not working for some reason, it's giving me an error

Code: [Select]
Uknown Opporator: stop

???
The script line was

Code: [Select]
{_x stop true} forEach [res1, res2, res3]
Very weird, because script line is correctly written! Where are you running that script line from?
? (this == thinkable) : this = scriptable

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
Re: Staying still for just a second?
« Reply #6 on: 09 Feb 2012, 12:38:15 »
I was testing it out, I gave the player an action "STOP!"

Code: [Select]
init.sqs

stop = west1 addaction ["STOP!","stop.sqs"]

Code: [Select]
stop.sqs

{_x stop true} forEach [res1, res2, res3]
west1 removeaction stop
continue = west1 addaction ["Continue...","cont.sqs"]
exit

Code: [Select]
cont.sqs
{_x stop false} forEach [res1, res2, res3]
west1 removeaction continue
stop = west1 addaction ["STOP!","stop.sqs"]
exit

thats all I had.
EDIT: I'm running this mission in the Mission Editor, if that's what you meant.
« Last Edit: 09 Feb 2012, 12:43:53 by Mad Pup »
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: Staying still for just a second?
« Reply #7 on: 09 Feb 2012, 13:22:38 »
Sounds strange.

Try this:

Code: [Select]

{dostop _x} forEach [res1, res2]


Shouldn't matter where you put that it should work.
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Re: Staying still for just a second?
« Reply #8 on: 09 Feb 2012, 15:27:15 »
I found the error.

You assigned "wrong" name to the stopping action: as matter of fact, you called stopping action "stop" but OFP thinks that "stop" refers to stop command (which is the one you used before to stop resistance units) and not to a name of an action.

Solution is very simple: you just need to change the name of action from "stop" in something else (e.g. "freeze"). I attached a demo of your script finely working. You may want to check it to be sure about what I said.

Cheers  ;)
? (this == thinkable) : this = scriptable

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
Re: Staying still for just a second?
« Reply #9 on: 11 Feb 2012, 04:00:07 »
Does the SetWP command work for AI? Will the AI actually move to the waypoint, once the waypoint is moved in a script?

Thanks in advance!

-Mad Pup
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: Staying still for just a second?
« Reply #10 on: 11 Feb 2012, 09:52:59 »
If you mean 'setwppos' then yes it will work:

Code: [Select]
[_unit, _wpindex] setwppos _location
_unit = unit name
_wpindex = which waypoint it is, 1 is the first waypoint, 2 is the second, etc.
_location = where you want the waypoint to move to, can be used with GLs, markers etc.

If you plan on using this in your 'stop' script, you'll want to make sure that all units are 'stop false' before you use this command. They won't move anywhere otherwise (unless I'm mistaken).

Hope this helps

"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
Re: Staying still for just a second?
« Reply #11 on: 12 Feb 2012, 22:24:51 »
Mmmk I wasn't sure, tested it out once, and it didn't seem to work, but I think I had the script command wrong.

Also: For anyone who reads this, if you have an empty vehicle and put a soldier in it through script command, the stop command doesn't work.

Example:
If you have an empty green car named car1, and another soldier named sol1, with this in it's init field:

Code: [Select]
this moveindriver car1
and you try to use the stop command with sol1, it won't work. It will only work if sol1 is a vehicle unit.

-Mad Pup
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: Staying still for just a second?
« Reply #12 on: 12 Feb 2012, 22:52:04 »
Have you tried ordering the actual vehicle to stop? Rather than the unit occupying the vehicle?  :scratch:

So you would say:

Code: [Select]
car1 stop true
I've used the stop command with a vehicle before but that vehicle was the actual unit, rather than being empty with a guy driving it.

If it's for a cutscene, then you could just remove the fuel from the vehicle, forcing it to stop.
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
Re: Staying still for just a second?
« Reply #13 on: 12 Feb 2012, 23:01:08 »
Oh, I never thought of that. I guess you could do that.
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad