Home   Help Search Login Register  

Author Topic: arGh why the **** this doesnt work?!?!  (Read 1018 times)

0 Members and 1 Guest are viewing this topic.

mcnils

  • Guest
arGh why the **** this doesnt work?!?!
« on: 31 Jan 2003, 21:01:54 »

Im editing a mission, i have invested much time in this one, its a coop.
It starts (teoretically) with a team of blackop players falling from the sky - doing a HALO.

The mission triggers and all that work just fine, the only dammit problem is that this HALO script (witch i hawe customized alot) doesnt work! and now since im not a scripting ace like some of you here are, i ask help here.

This is my last hope of not wasting HOUERS AND HOUERS of editing, because without the halo droop my mission is only the half of that i wanted to create.

Thats the code, ill quote it so you'll see how i customized it,
This script works just fine in singleplayer or non online multiplayer game, but NOT if its online on a server, players just sta on the ground and nothing happens... but take a look yourselves if you want to help me..



;;;Getpos all players at about 2000 meters altitude
AP1 setpos [getpos AP1 select 0, getpos AP1 select 1, (getpos AP1 select 2)+2010]
AP2 setpos [getpos AP2 select 0, getpos AP2 select 1, (getpos AP2 select 2)+2012]
AP3 setpos [getpos AP3 select 0, getpos AP3 select 1, (getpos AP3 select 2)+2014]
AP4 setpos [getpos AP4 select 0, getpos AP4 select 1, (getpos AP4 select 2)+2016]

;;;Set the altitude from the dummy chopper for the chute deployment
UH setpos [500,500,2900]

;;;Time during the players fall from the sky - then the chute opens
~27.8

;;;Get the positions of players
_aPchutepos = getpos AP1
_aPchx = _aPchutepos select 0
_aPchz = _aPchutepos select 1
_aPchy = _aPchutepos select 2

_aP2chutepos = getpos AP2
_aP2chx = _aP2chutepos select 0
_aP2chz = _aP2chutepos select 1
_aP2chy = _aP2chutepos select 2
_aP3chutepos = getpos AP3

_aP3chutepos = getpos AP3
_aP3chx = _aP3chutepos select 0
_aP3chz = _aP3chutepos select 1
_aP3chy = _aP3chutepos select 2

_aP4chutepos = getpos AP4
_aP4chx = _aP4chutepos select 0
_aP4chz = _aP4chutepos select 1
_aP4chy = _aP4chutepos select 2

;;;this is a sistem i figured out to make the script find out if given unit
;;;is in game or not, if its not in game the script wont execute
;;;the part of the not present unit - this is to avoid
;;;any error message executing the script with 2 players at the place of 4 (only for ex.).
;;;If unit is in game a barrel (for example ZZK) will be "killed"
;;;- giving the script the infos it needs.
?!(!not alive ZKK): goto "chute1"
goto "chute2"

;;;Dummy chopper teleports and ejects players - chute opens
#chute1
UH setpos [_aPchx, _aPchz, _aPchy]
AP1 moveincargo UH
AP1 action ["EJECT",UH]
AP1 setbehaviour "AWARE"

?!(!not alive ZKK2): goto "chute2"
goto "chute3"

#chute2
?!(!alive ZKK2): goto "chute3"
UH setpos [_aP2chx, _aP2chz, _aP2chy]
AP2 moveincargo UH
AP2 action ["EJECT",UH]
AP2 setbehaviour "AWARE"

?!(!not alive ZKK3): goto "chute3"
goto "chute4"

#chute3
?!(!alive ZKK3): goto "chute4"
UH setpos [_aP3chx, _aP3chz, _aP3chy]
AP3 moveincargo UH
AP3 action ["EJECT",UH]
AP3 setbehaviour "AWARE"

?!(!not alive ZKK4): goto "chute4"
goto "cont"

#chute4
?!(!alive ZKK4): goto "cont"
UH setpos [_aP4chx, _aP4chz, _aP4chy]
AP4 moveincargo UH
AP4 action ["EJECT",UH]
AP4 setbehaviour "AWARE"
goto "cont"

;;;Unassign players from the chopper
#cont
unassignvehicle AP1
unassignvehicle AP2
unassignvehicle AP3
unassignvehicle AP4

;;;Puts the chopper away
UH setpos [getpos UH1 select 0, getpos UH1 select 1, (getpos UH1 select 2)+0]


exit


What i do wrong here???
i hawe a gamelogic that executes the script at its initialization.
please help me if you get an idea what i do wrong cuz i cant figure out what it is, im a bloody scripting beginner O_O

(well, some months ago i was a total NewB)

thx for reading :-\

mcnils

  • Guest
Re:arGh why the **** this doesnt work?!?!
« Reply #1 on: 31 Jan 2003, 21:35:25 »


This would fit more in the multiplayer scripting section.. err..
sorry my brain is outburned............. pfff..  ???

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:arGh why the **** this doesnt work?!?!
« Reply #2 on: 31 Jan 2003, 22:08:12 »
Below, I've pasted the same reply I gave to someone else regarding multiplayer HALO parachute jumping.  Hopefully, this will give you some insight as to part of your problem.

However, before you read that, I have some other questions about your script.

1. Why do you destroy a barrel if the unit is "in game"?  What does this accomplish?  Seemingly nothing as far as I can tell.

2. What do you mean by "in game", anyway?

3. It looks like you can remove a lot of fluff from your code to streamline it.  For example, your code has the following lines:

Code: [Select]
?!(!not alive ZKK2): goto "chute2"
goto "chute3"

#chute2
?!(!alive ZKK2): goto "chute3"
UH setpos [_aP2chx, _aP2chz, _aP2chy]

Isn't this the same thing as:

Code: [Select]
? (not alive ZKK2): goto "chute2"
goto "chute3"

#chute2
UH setpos [_aP2chx, _aP2chz, _aP2chy]

First, I removed the two ! where you had them, since ! is the same as not, and two ! should cancel out each other.  Second, I removed the check if ZKK2 is alive, since this boolean is already covered when you check if it's not alive in the previous lines.

4. You did a lot of things the hard way. You can apply the same command to multiple units with the forEach command.  C.f. the ComRef for usage.


--- BEGIN ANSWER ---

I had some nasty problems with parachuting in multiplayer missions as well.  I made one where you perform a halo jump from a C-130, but had a lot of problems getting the ejection from the plane to work, as well as the actual parachuting.

Here are my findings:

1. You cannot use the action ["eject",player1] command in a script to force client-controlled players to eject.

2. You cannot spawn parachutes and move AI into the parachutes.  Doing so causes the AI to stop functioning after the unit has landed.  They'll move a little bit, but they will no longer follow the leader, and won't take any orders.

3. You cannot setPos a player-controlled unit out of a vehicle, otherwise he will be unable to use LAW/RPG/AT launchers.  I originally used setPos to get the units (player and AI) out of the C-130 so that they would free-fall until it was time to open the chute, but I found that I could no longer use a LAW launcher.

The solution:

In your script, add code that checks if the unit is a player or AI.  If the unit is a player, do what you've done: spawn a parachute and move the player into the driver position.

If the unit is AI, you'll have to do the lame, but operational instantaneous-move-chopper-then-eject method.  That is, place a flying friendly chopper somewhere in a remote corner of the map.  When it comes time for the AI unit to open his chute, use setPos to move the chopper to the unit's position, move the unit into the chopper's cargo, then force the unit to eject.  Next, move the chopper back to the remote corner.  When all units are done parachuting, delete the chopper and its crew to reduce some overhead.

As a side note, in the event that you are making these units "jump" out of a vehicle at the start (instead of simply starting in mid-air free-falling), the only way I could get around problem #3 above was to delete the aircraft.  Lame, but at least the jump works.
Ranger

mcnils

  • Guest
Re:arGh why the **** this doesnt work?!?!
« Reply #3 on: 31 Jan 2003, 22:31:14 »

As i sayd im a scripting beginner, so i make mutch faults or i doo things in
a more complicated way cuz i dont know how its done right.

Now, ill explain bether the barrel thing:

'ill start at the beginning,
the script executed without this "alive barrel detection" sistem produces error messages in multiplayer because, if for example there's no 2nd player, the script has no coordinates to teleport the dummy chopper (_aP2chx, _aP2chz, _aP2chy), it produces an error message like i sayd more up, this is only a estetic thing, only to prevent the message. Now it works like this:

AP1 has this in its init field: ZK = true
AP2 this: ZK2 = true
..and so on.

..now, for each player i place a barrel.
for AP1 i place a barrel named ZKK
for AP2 one named ZKK2

then for each barrel i place a trigger, that destroys the barrel:
for the ZKK barrel condition is ZK,
for the ZKK2 barrel condition is ZK2.

This hole thing is to detect if given player or AI is actually in game, if the unit is present and can give his coordinates to the script, with in game i mean simply "present" (in MP you can deactivate AI's you know).

Now i explain why i added a second alive check for the same barrel.
If barrel ZKK is not alive, this doesnt automaticly mean that barrel ZKK2 is, one player may choose AP3 and the other AP4 (hope you got the barrel alive detection thing first), so if the script skips the first chute and switches to the second i need another check or an error message will occur if there's no unit present in game (and the hole thing was for nothing)

?!(not alive ZKK): goto "chute1"
goto "chute3"

#chute2
?!(alive ZKK): goto "chute3"
UH setpos [_aP2chx, _aP2chz, _aP2chy]

?!(not alive ZKK): goto "chute2"
goto "chute3"

#chute2
?!(alive ZKK2): goto "chute3"
UH setpos [_aP2chx, _aP2chz, _aP2chy]


Ok now i will read the rest of your post,
many thanks for answering.

mcnils

  • Guest
Re:arGh why the **** this doesnt work?!?!
« Reply #4 on: 31 Jan 2003, 22:37:50 »

ok i hawe read it,
problem isnt that the chute does not open or anything, problem is that you start on the ground and not at 2000 meters altitude, its like the script isnt executed! strange because in the same gamelogic init field i hawe a playmusic and a hint box, and they work.



:(
« Last Edit: 31 Jan 2003, 22:44:45 by mcnils »

mcnils

  • Guest
Re:arGh why the **** this doesnt work?!?!
« Reply #5 on: 31 Jan 2003, 22:40:36 »

Another thing, maybe im too much stupid to understand that, but i think the "foreach" thing doesnt work in this case, i want each para drooped at his specific point, if i would do foreach they would getpos all in the same position crashing together at the landing...

oh well all the time i invested in this.. more than 48h in total, thats shure....... :(
« Last Edit: 31 Jan 2003, 22:41:50 by mcnils »

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:arGh why the **** this doesnt work?!?!
« Reply #6 on: 01 Feb 2003, 00:03:50 »
No problem for the answer--I'm happy to help.

First, try executing your script from the init.sqs script.  Oftentimes, scripts are executed only on the server and not on all clients.  Since init.sqs is executed on every computer, this particular problem won't exist.

Second, you can simplify your setPos commands as follows:

Code: [Select]
AP1 setpos [getpos AP1 select 0, getpos AP1 select 1, 2010]
AP2 setpos [getpos AP2 select 0, getpos AP2 select 1, 2012]
AP3 setpos [getpos AP3 select 0, getpos AP3 select 1, 2014]
AP4 setpos [getpos AP4 select 0, getpos AP4 select 1, 2016]

Since their starting altitude is 0 by default, there's no need to get each units' Z coordinate.  Simply, set the Z coordinate to your desired value.

In any case, when I get access to my computer later tonight, I'll send you my working multi-player version of a HALO script, which will probably solve most or all of your problems.  My script does not rely on the presence or absence of any unit, except the group leader, so you don't need this alive/dead barrel thingy.
Ranger

mcnils

  • Guest
Re:arGh why the **** this doesnt work?!?!
« Reply #7 on: 01 Feb 2003, 16:32:27 »

wowsa :)

this would be cool from you,
ill give you also credit in the briefing :)

mcnils

  • Guest
Re:arGh why the **** this doesnt work?!?!
« Reply #8 on: 01 Feb 2003, 16:34:47 »

Forgot to give you my icq contact;


177448696


 ::)

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:arGh why the **** this doesnt work?!?!
« Reply #9 on: 01 Feb 2003, 19:28:11 »
I sent you a PM with the appropriate code and all that.  I guess you didn't see it yet since you haven't responded via PM.  But in any event, check your messages.  I hope it solves your problems.
Ranger

mcnils

  • Guest
Re:arGh why the **** this doesnt work?!?!
« Reply #10 on: 01 Feb 2003, 22:30:45 »

PM? argh dont know whats that O_O
sorry if im stupid O_O

mcnils

  • Guest
Re:arGh why the **** this doesnt work?!?!
« Reply #11 on: 01 Feb 2003, 22:31:28 »

....Private message?

WOAH im a genius lolol *laughs at himself*