Home   Help Search Login Register  

Author Topic: Ejection Script Help  (Read 910 times)

0 Members and 1 Guest are viewing this topic.

Iwesshome

  • Guest
Ejection Script Help
« on: 06 Mar 2003, 23:56:47 »
This is an ejection script from the OPFEC site that I am using to help learn basic scripting....

Original Script

Quote
; AIRBONE PARADROP SCRIPT
; Modified From Rapple.sqs by: Mustang60348
; Modified by: the[]coyote
;
; This script calls two parameters: the name of the group to paradrop
; and the name of the helicopter to paradrop from. Syntax is:
;
; [groupname, heliname] exec "Paradrop.sqs"
;
; In order to use the script, place a trigger where you want to paradrop to start from.
; In the Actvation field type: [groupname, heliname] exec "Paradrop.sqs"
; Once the trigger is activated, the helicopter will drop one paratrooper per second until
; all units in the group are in the skies. Personally, I make the helo stay at limited
; speed and no less than 100 height for safety of the paratroops.

_Group = _this select 0
_Vehicle = _this select 1


_listunits = units _Group

_A = 0
_B = count _listunits
#KEEPSENDING
_listunits select _A action ["EJECT", _vehicle]
Unassignvehicle (_listunits select _A)
_A=_A+1
~1
?_B >_A:goto "KEEPSENDING"
~1
MoveNext = TRUE

Question 1

Using the script above using grp1 for group and heli for vehicle did I change everyhting correctly?

Quote
_grp1 = _this select 0
_heli = _this select 1


_listunits = units _Group

_A = 0
_B = count _listunits
#KEEPSENDING
_listunits select _A action ["EJECT", _heli]
Unassignvehicle (_listunits select _A)
_A=_A+1
~1
?_B >_A:goto "KEEPSENDING"
~1
MoveNext = TRUE

Question 2

How do I change the time from one second to three?
« Last Edit: 06 Mar 2003, 23:57:19 by Iwesshome »

Saintaw

  • Guest
Re:Ejection Script Help
« Reply #1 on: 07 Mar 2003, 01:12:33 »
Howdy,

This is comming from a total Noob, so... don't listen, I'm just thinking aloud :)

"~1"  means it will wait for 1 second, replace it with  "~3" here, try with both I guess  :-X

Also, another note (Disclaimer: I don't know what I'm saying realy)
Since you changed your variable names :
Code: [Select]
_grp1 = _this select 0
_heli = _this select 1
_listunits = units _Group ;/* I gather this units is some sort of class ??? */
I would change it to:
Code: [Select]
_grp1 = _this select 0
_heli = _this select 1
_listunits = units _grp1 ;/* Same name as your group */

Again, I don't know about this, but scriptingwise... it looks logical to me.

« Last Edit: 07 Mar 2003, 01:13:41 by Saintaw »

Uberminch

  • Guest
Re:Ejection Script Help
« Reply #2 on: 07 Mar 2003, 15:13:11 »
I don't see why the changes wouldn't be correct.

Go ahead and see.  :beat:

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Ejection Script Help
« Reply #3 on: 07 Mar 2003, 18:31:53 »
Original ScriptQuestion 1

Using the script above using grp1 for group and heli for vehicle did I change everyhting correctly?

First, why don't you just test it in the game and see what happens?  That's the fastest, easiest way to see if you did it right.  Throw in hint commands in various places to help with error-checking.  You aren't going to destroy you copy of the game by experimenting.

Second, no, that is not correct.  I have no idea why you even want to change the local variable names, as there's no real point to it.  But, even if you did want to do so, you need to change every instance of that local variable to the new name.  You changed the _Vehicle variable to _Heli just fine, but you missed one instance of _Group.  If you ever need to know if there are any instances left of an old variable name, simply do a search with Notepad!  Simple to do.

Quote
Question 2

How do I change the time from one second to three?

As was already stated, just change the 1 to 3.

Refer to the Command Reference for how these commands work if you have questions of this caliber.
Ranger

Iwesshome

  • Guest
Re:Ejection Script Help
« Reply #4 on: 07 Mar 2003, 19:19:05 »
Ranger,

That is why I am asking for your help... total newbie when it comes to scripting. What I am failing to understand is why you would not have to change the local variable names to make the script work?

How does OFP know when I use this script.... [groupname, heliname] exec "Paradrop.sqs" and change groupname to grp1 and heliname to helo1 it is to work correctly for this script.

Appreciate your help

IW

Saintaw

  • Guest
Re:Ejection Script Help
« Reply #5 on: 07 Mar 2003, 19:33:05 »
<--- Still trying :D

To answer your last question, the variable names exist only in the scope of the script, you are only using a reference to them...

let me try this in english :)
Code: [Select]
_grp1 = _this select 0 ; 1st argument
_heli = _this select 1; 2nd argument
; here comes your script that will effect both these elements.

Now, lets say you have two Infantry groups, and two choppers in your mission.

Inf_A //name of Your 1st Infantry group
Inf_B //name of Your 2nd Infantry group
Helo_A //name of Your 1st Helicopter
Helo_B //name of Your 2nd Helicopter

On you trigger (or whatever method you launch your script), for your 1st group should be something like:
[Inf_A, Helo_A] exec "myscript.sqs";

For your 2nd group, it will be:
[Inf_B, Helo_B] exec "myscript.sqs";

Both will still be related to "_grp1" and "heli1", they will just represent the variables sent to them.

Dammit, you'd think explaining something like this is easy...  :tomato:
Appologies if I confused more !


Iwesshome

  • Guest
Re:Ejection Script Help
« Reply #6 on: 07 Mar 2003, 22:30:55 »
No its making more sence now.... so pretty much the script is the code and the game already know how to match the script to the actual game characters?

Thanks,

IW

Saintaw

  • Guest
Re:Ejection Script Help
« Reply #7 on: 08 Mar 2003, 08:21:07 »
Well, it's YOU (as mission designer), not the game who assigns this or that action to this or that character.

Just imagine a function like this...
_person = _this select 0
_vehicle = _this select 1
_location = _this_select 2
;blah blah...

Now, when you call your script you can call it like:
[Wife, car, CityHall] exec "script.sqs" ; your wife will drive a car to the CityHall
[neighbour, truck,work] exec "script.sqs" ; your neighbour goes to work with a truck
[Player, Jeep, Castle] exec "script.sqs"; you(assuming you're called player) go to a castle in a jeep.

better?

Iwesshome

  • Guest
Re:Ejection Script Help
« Reply #8 on: 08 Mar 2003, 18:37:52 »
Now I am confused....

I created a stupid little mission using the above script without changing any of the variables...

group = grp1
Chopper = helo1

Both groups have their name and are spelt right... I created a trigger detected by west and in the activation field I put [grp1,helo1] exec "Paradrop.sqs"

I extracted the demo to my mission folder and placed the script also in the mission folder with it. Received this in the game.

error Paradrop.sqs not found.... place the script in both add-on folders and still the same error. What am I missing?

Iwesshome

  • Guest
Re:Ejection Script Help
« Reply #9 on: 09 Mar 2003, 00:18:53 »
I finally figured it out and got it to work.... Thank you all for your help in which you provided to me.

IW