Home   Help Search Login Register  

Author Topic: Lazy, Horrible, inefficent.  (Read 888 times)

0 Members and 2 Guests are viewing this topic.

Isaioux2x

  • Guest
Lazy, Horrible, inefficent.
« on: 05 May 2004, 06:31:30 »
Welcome to my first semi useful script  ;D

_group1 = _this select 0
_vehicle1 = _this select 1
_vehicle2 = _this select 2
_a = 0
_b = 0
_grouper = units _group1
_countgrouper = count _grouper
#loop
_getxzy = getpos (_grouper select _a)
_getheight = _getxzy select 2
deletevehicle _vehicle1
?_getheight <= 300 : goto "eject"
goto "loop"
#eject
_vehicle2 setpos [getpos (_grouper select _b) select 0,getpos (_grouper select _b) select 1,getpos (_grouper select _b) select 2]
(_grouper select _b) moveincargo _vehicle2
(_grouper select _b) action ["EJECT",_vehicle2]
_b = _b + 1
?(_b >= countgrouper) goto "exit"
goto "eject"
#exit
deletevehicle _vehicle2
exit


Aye, you wouldn't believe i'm actually quite good/neat with C :P
It's times like this when I ask myself "Do I know what i'm doing?" Obviously not. Any suggestions? It seems to error up but it still works.

Oh, I wanted something that would eject you from a helo and let you free-fall to a set height and then deploy the chutes :P  Probably already figured that out.

j-man

  • Guest
Re:Lazy, Horrible, inefficent.
« Reply #1 on: 05 May 2004, 07:21:17 »
I havn't tried out the script yet. But it looks good.

Nice work :thumbsup:

PsyWarrior

  • Guest
Re:Lazy, Horrible, inefficent.
« Reply #2 on: 05 May 2004, 13:41:58 »
Greetings,

Quote
It seems to error up

What error are you getting?

My understanding: when the chopper gets to a certain height, you want all units in a group to bail?

First, you can get rid of the _getxyz variable, and change _getheight to:

_getheight = getpos (_grouper select _a) select 2

Which means one variable less to take care of.

However, I am confused: What do you pass to the script? For instance, what are _vehicle1 and _vehicle2?

Quote
you wouldn't believe i'm actually quite good/neat with C
C != sqs

You'd probably do better with cpp files or ext files. They're more C like (although that doesn't help you with sqs, or at all as far as this problem is concerned ::)).

-Supreme Commander PsyWarrior
-Psychic Productions Studios

P.S. - Ah, noticed an error:
Quote
?(_b >= countgrouper) goto "exit"
Need a colon between the condition and the result (IF and THEN):
Code: [Select]
?(_b >= countgrouper): goto "exit"
« Last Edit: 05 May 2004, 13:44:57 by PsyWarrior »

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Lazy, Horrible, inefficent.
« Reply #3 on: 05 May 2004, 16:24:54 »
I think toadlife allready made something like this... Don't remember though.

:beat: *Gets Shot* :beat:

Isaioux2x

  • Guest
Re:Lazy, Horrible, inefficent.
« Reply #4 on: 05 May 2004, 18:30:34 »
Greetings,What error are you getting?

My understanding: when the chopper gets to a certain height, you want all units in a group to bail?

First, you can get rid of the _getxyz variable, and change _getheight to:

_getheight = getpos (_grouper select _a) select 2

Which means one variable less to take care of.

However, I am confused: What do you pass to the script? For instance, what are _vehicle1 and _vehicle2?C != sqs

You'd probably do better with cpp files or ext files. They're more C like (although that doesn't help you with sqs, or at all as far as this problem is concerned ::)).

-Supreme Commander PsyWarrior
-Psychic Productions Studios

P.S. - Ah, noticed an error:Need a colon between the condition and the result (IF and THEN):
Code: [Select]
?(_b >= countgrouper): goto "exit"

What I wanted was a bail out when I hit radio alpha and for you to free-fall to a set height before the chutes are deployed. And the error is "zero division" or "division zero" can't remember, just woke up :P I'll edit it when I have time to check.

Vehicle 1 is the helo you're flying in. It gets deleted causeing the free fall. (I couldn't think of another way of doing this..) Now that I think about it. I could probably just setPos the units behind the helo with a slight delay. Won't look as stupid as a helo getting deleted. When you hit a certain height. You get moved into / ejected from an empty helo placed on the map.
« Last Edit: 05 May 2004, 18:33:43 by Isaioux2x »

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:Lazy, Horrible, inefficent.
« Reply #5 on: 05 May 2004, 18:51:13 »
Look for realistic HALO script in editor depot.

Isaioux2x

  • Guest
Re:Lazy, Horrible, inefficent.
« Reply #6 on: 05 May 2004, 19:08:31 »
Meh, i'd rather use my own. Easier to learn things that way, for me at least.
Obviously, i'm not that great. But hey, i've got OP F running in the backround along with Notepad. Not exactly a bad combination.

Isaioux2x

  • Guest
Re:Lazy, Horrible, inefficent.
« Reply #7 on: 05 May 2004, 20:10:17 »
re-wrote it

;mainvar---------------
_group = _this select 0
_chop1 = _this select 1
_chop2 = _this select 2
;var2------------------
_cobgr = units _group
_cougr = count _cobgr
_nums1 = 0
_nums2 = 0
;Kickemout-------------
#out
~2
(_cobgr select _nums1) setPos [getpos _chop1 select 0,getpos _chop1 select 1, getpos _chop1 select 2]
?(_nums1 >= _cougr): goto "monitor"
_nums1 = _nums1 + 1
goto "out"
;monitorcondit---------
#monitor
_chop1 setdammage 1
_ejalt = getPos (_cobgr select _nums2) select 2
?_ejalt <= 100 : goto "chutes"
goto "montior"
;deploy----------------
#chutes
_nums2 = 0
_chop2 setPos [getPos (_cobgr select _nums2) select 0,getPos (_cobgr select _nums2) select 1,getPos (_cobgr select _nums2) select 2]
_cobgr select _nums2 moveincargo _chop2
_cobgr select _nums2 action ["EJECT",_chop2]
_nums2 = _nums2 + 1
?(_nums2 >= _cougr) exit
goto "chutes"



The empty helo seems to be on crack .
« Last Edit: 05 May 2004, 20:41:20 by Isaioux2x »

PsyWarrior

  • Guest
Re:Lazy, Horrible, inefficent.
« Reply #8 on: 06 May 2004, 12:11:44 »
Ah, the
ERROR: Zero Divisor
error.

That's strange, I don't see where that's coming from. The error should identify which line is erroring out, what does it say exactly?

Perhaps a more valid question, does the new script give the same error?

OK, you seem to know most of the commands well. However, I have a couple of suggestions:

You don't need to place a unit into an empty chopper, and then kick them out to deploy chutes. Simply create a new parachute when you want to deploy. Observe:

_chute = "ParachuteWest" createVehicle getpos _unit
_unit moveInCargo _chute

Where _unit is the person to move into the parachute. In your case probably
_chute = "ParachuteWest" createVehicle getpos _cobgr select _nums2

_cobgr select _nums2 moveInCargo _chute

createVehicle will spawn a new Parachute for the West side, and the unit will be moved into this parachute immediately after.

No guarantees on the above, but it should work.

-Supr. Cmdr. PsyWarrior
-Psychic Productions

P.S. - Another Error:
?(_nums2 >= _cougr) exit

1. Don' t forget that Colon between the condition and the result:
?(_nums2 >= _cougr): exit

2. The above will terminate the script as soon as _nums2 equals the number of people in the group. This will mean that the last person in the group will be missed out, and will plummet to his death...Which would be unfortunate...

Use the '>' operator on it's own, without the '='.
« Last Edit: 06 May 2004, 12:16:22 by PsyWarrior »

Unnamed

  • Guest
Re:Lazy, Horrible, inefficent.
« Reply #9 on: 06 May 2004, 15:16:28 »
The "Zero Divisor" error in OFP is down to selecting an element from an array that does not exist.

For example.

Code: [Select]
getpos _chop1 select 0
Should be:

Code: [Select]
(getpos _chop1) select 0
« Last Edit: 06 May 2004, 16:58:01 by Unnamed »

Isaioux2x

  • Guest
Re:Lazy, Horrible, inefficent.
« Reply #10 on: 06 May 2004, 21:19:09 »
Ahhh, thanks for all your help.

CrashnBurn

  • Guest
Re:Lazy, Horrible, inefficent.
« Reply #11 on: 07 May 2004, 01:56:21 »
Ah, the
ERROR: Zero Divisor
error.

That's strange, I don't see where that's coming from. The error should identify which line is erroring out, what does it say exactly?

Perhaps a more valid question, does the new script give the same error?

OK, you seem to know most of the commands well. However, I have a couple of suggestions:

You don't need to place a unit into an empty chopper, and then kick them out to deploy chutes. Simply create a new parachute when you want to deploy. Observe:

_chute = "ParachuteWest" createVehicle getpos _unit
_unit moveInCargo _chute

Where _unit is the person to move into the parachute. In your case probably
_chute = "ParachuteWest" createVehicle getpos _cobgr select _nums2

_cobgr select _nums2 moveInCargo _chute

createVehicle will spawn a new Parachute for the West side, and the unit will be moved into this parachute immediately after.

No guarantees on the above, but it should work.

-Supr. Cmdr. PsyWarrior
-Psychic Productions

P.S. - Another Error:
?(_nums2 >= _cougr) exit

1. Don' t forget that Colon between the condition and the result:
?(_nums2 >= _cougr): exit

2. The above will terminate the script as soon as _nums2 equals the number of people in the group. This will mean that the last person in the group will be missed out, and will plummet to his death...Which would be unfortunate...

Use the '>' operator on it's own, without the '='.


Um...that should be moveindriver, not moveincargo.

PsyWarrior

  • Guest
Re:Lazy, Horrible, inefficent.
« Reply #12 on: 07 May 2004, 10:36:35 »
Quote
Um...that should be moveindriver, not moveincargo.

Are you sure? I thought that chutes only had a cargo position, as it is impossible to 'drive' a chute (I.E. the player has absolutely no control over the descent of the parachute).

But I could be wrong... ::)
It's been a while since I wrote my HALO script.

Perhaps both work?

Quote
(getpos _chop1) select 0
Of course. Accursed brackets... I always miss errors out.

-Psy|W
« Last Edit: 07 May 2004, 10:40:08 by PsyWarrior »

Isaioux2x

  • Guest
Re:Lazy, Horrible, inefficent.
« Reply #13 on: 07 May 2004, 20:04:10 »
Yeah, I it's driver ... I think.