View Full Version : Multiple scripting questions. (Stance, extraction, win condition)
Okay, i'm making a COOP map and have run into some problems, the first is the script to make an AI stand up all the time. All sites and such say you need to use the:
this setunitpos "up"
Doesn't seem to work in Arma 2 though, how come? :o
----------------
Next point is for the end extraction, i have been using another sqs script which goes like this:
_chop = _this select 0
_gl = _this select 1
_player = player
_lead = leader _player
_gl setPos getPos _lead
~0.1
_chop setSpeedMode "LIMITED"
#CONTINUE
_chop move [((getpos _gl select 0) + 4),((getpos _gl select 1) + 4),0]
_chop FlyInHeight 50
? (_chop distance _gl < 100) : goto "END"
~10
_gl setPos getPos _lead
goto "CONTINUE"
#END
_chop setSpeedMode "LIMITED"
_chop FlyInHeight 0
? (((getpos _chop) select 2) < 2):[_lead] allowGetIn true;hint "Board";goto "VERYEND"
~0.01
goto "END"
#VERYEND
_lead assignAsCargo _chop
? (_lead in _chop):hint "OK";goto "EXIT"
~0.01
goto "VERYEND"
#EXIT
_chop domove [0,0,0]
_chop FlyInHeight 35
_chop setSpeedMode "FULL"
exit
The code works like a charm, except the fact that where i want it to land is really small, or rather, its not a desert like Arma1 could offer (was scripted for ama1)
This means that once it comes over my head it'll drop altitude really fast and slam into trees, hills or simply the flat ground. It doesn't slow down, meaning that it can land like 200 meters away easily, which is a problem.
What i want is a script like this, only where it will speed down to a stop and LAND right ontop of a H mark or simply beside the player, something you guys can help me with? :)
(The land that i want it to land on is maybe 20x20 meters, giving quite some space, just not enough for this script.
------------------
I want the mission to end and say completed once i get to a certain point with the chopper. (hangar carrier) I dont even want the chopper to land, only to get to a certain point. This i have tried with a trigger, but i',m quite the noob concerning triggers. I tried the End 1 and then Fade black + add text, but it didn't do anything. (triggered by blufor in the area obviously)
Should be a noobie question so this should be the easy one? :)
---------------------
Thanks in advance :)
Doesn't seem to work in Arma 2 though, how come? :o
Not able to test right now, but "up" should probably be "UP". I know that case makes a difference in a good number of the commands that require specific-string input.
What i want is a script like this, only where it will speed down to a stop and LAND right ontop of a H mark or simply beside the player, something you guys can help me with? :)
Get the chopper to move to the position you want it first, then change it's flyInHeight. You should avoid the problem that way.
I want the mission to end and say completed once i get to a certain point with the chopper. (hangar carrier) I dont even want the chopper to land, only to get to a certain point. This i have tried with a trigger, but i',m quite the noob concerning triggers. I tried the End 1 and then Fade black + add text, but it didn't do anything. (triggered by blufor in the area obviously)
That should work as intended, provided your conditions are set correctly. Alternatively, group the trigger to the chopper, and make sure it's activated by "Vehicle". Then, whenever the chopper enters the trigger, it should be activated.
FYI i didn't make the extraction script, since i'm a noob concerning scripts. (This is my real first mission where i actually make it worth playing. :P)
So i have some trouble reading and understanding excatly where to change the sqs, :o
Also the:
this setuntipos "UP"
Does not work sadly, says it's missing ; (like before)
EDIT: Also about the end condition, what should it actually say? i just assumed that End #1 was the ending and the "triggered by blufor" would be the condition. . . :o
FYI i didn't make the extraction script, since i'm a noob concerning scripts. (This is my real first mission where i actually make it worth playing. :P)
After a brief look at the script (no testing), it appears that it checks to see if the chopper is within 100m of the landing zone on this line:
? (_chop distance _gl < 100) : goto "END"
You may want to experiment changing the 100 to something else. Bear in mind, that the distance also includes height displacement (if I recall correctly), so you may want to replace it with something like this:
_groundDistance = [getPos _chop select 0, getPos _chop select 1, getPos _gl select 2] distance _gl
? (_groundDistance<100) : goto "END"
(and, once again, fiddle with the 100 figure).
Does not work sadly, says it's missing ; (like before)
Make sure you're spelling it correctly. In the example you just pasted, you had "setuntipos", which will trigger an error like the above. Other than that, where are you executing this? It should, ideally, be placed in the "init" line of the unit you want it to apply to.
EDIT: Also about the end condition, what should it actually say? i just assumed that End #1 was the ending and the "triggered by blufor" would be the condition. . . :o
Well, an End trigger should do just that, end the mission when the trigger conditions are met. As long as the conditions are met (i.e. it's "Activated by: BLUFOR"), I can't think of any real reason why it wouldn't complete. That said, I'm unable to test how the End triggers work in Arma2, as I don't yet own it, so there may be a subtly different behaviour (especially as things like the briefings have changed).
])rStrangelove
Jun 9 2009, 10:23
Fiddling with helicopters and landing behaviour was always tricky, so be patient if it doesnt work at first.
Exchange the code underneath the CONTINUE and END labels with this code:
#CONTINUE
_chop move [((getpos _gl select 0) + 4),((getpos _gl select 1) + 4),0]
_chop FlyInHeight 50
? (_chop distance _gl < 300) : goto "END"
~10
_gl setPos getPos _lead
goto "CONTINUE"
#END
_chop setSpeedMode "LIMITED"
_chop FlyInHeight 50
? (_chop distance _gl < 70):_chop land "LAND";[_lead] allowGetIn true;hint "Board";goto "VERYEND"
~0.01
goto "END"
As i said, you can never be sure it'll work so you need to test a bit and see how it goes. If _chop land "LAND" doesnt work, maybe try _chop land "GET IN" or "GETIN". The distances (_chop distance 300) might also be wrong, fiddle around with both 300 and 70 as well until you think you got it about right.
Also, in the last section your chopper moves to the coords 0,0 - does that make sense in your mission?
)rStrangelove;1304429']Fiddling with helicopters and landing behaviour was always tricky, so be patient if it doesnt work at first.
Exchange the code underneath the CONTINUE and END labels with this code:
#CONTINUE
_chop move [((getpos _gl select 0) + 4),((getpos _gl select 1) + 4),0]
_chop FlyInHeight 50
? (_chop distance _gl < 300) : goto "END"
~10
_gl setPos getPos _lead
goto "CONTINUE"
#END
_chop setSpeedMode "LIMITED"
_chop FlyInHeight 50
? (_chop distance _gl < 70):_chop land "LAND";[_lead] allowGetIn true;hint "Board";goto "VERYEND"
~0.01
goto "END"
As i said, you can never be sure it'll work so you need to test a bit and see how it goes. If _chop land "LAND" doesnt work, maybe try _chop land "GET IN" or "GETIN". The distances (_chop distance 300) might also be wrong, fiddle around with both 300 and 70 as well until you think you got it about right.
Also, in the last section your chopper moves to the coords 0,0 - does that make sense in your mission?
The chopper waypoints are defined by the waypoint init;
[heli1,gl1,hp1] exec "extract.sqs"
Where gl1 and hp1 are waypoints(H objects) and heli1 is the chopper.
and:
this setunitpos "UP"
works now, was a spelling error. :)
])rStrangelove
Jun 9 2009, 10:49
#EXIT
_chop domove [0,0,0]
_chop FlyInHeight 35
_chop setSpeedMode "FULL"
exit
As i see it, your heli will fly to 0,0 after it was boarded and that's it. You'd need to send it to the pos of your carrier or hangar if you want to trigger your endmission - like you said in 1st post.
something like _chop domove getpos mycarrier (if your carrier is named mycarrier)
Therein lies the problem, you're passing the script three arguments:
[heli1,gl1,hp1]
But the script is only using the first two.
As per DrStrangelove's advice, modify the last section to:
#EXIT
_chop domove (_this select 2)
_chop FlyInHeight 35
_chop setSpeedMode "FULL"
exit
That should mean that your chopper flies back to the location of H-object called 'hp1'
Therein lies the problem, you're passing the script three arguments:
[heli1,gl1,hp1]
But the script is only using the first two.
As per DrStrangelove's advice, modify the last section to:
#EXIT
_chop domove (_this select 2)
_chop FlyInHeight 35
_chop setSpeedMode "FULL"
exit
That should mean that your chopper flies back to the location of H-object called 'hp1'
So.
_chop = _this select 0
_gl = _this select 1
_player = player
_lead = leader _player
_gl setPos getPos _lead
~0.1
_chop setSpeedMode "LIMITED"
#CONTINUE
_chop move [((getpos _gl select 0) + 4),((getpos _gl select 1) + 4),0]
_chop FlyInHeight 35
? (_chop distance _gl < 100) : goto "END"
~10
_gl setPos getPos _lead
goto "CONTINUE"
#END
_chop setSpeedMode "LIMITED"
_chop FlyInHeight 0
? (((getpos _chop) select 2) < 2):[_lead] allowGetIn true;hint "Board";goto "VERYEND"
~0.01
goto "END"
#VERYEND
_lead assignAsCargo _chop
? (_lead in _chop):hint "OK";goto "EXIT"
~0.01
goto "VERYEND"
#EXIT
_chop domove (_this select 2)
_chop FlyInHeight 35
_chop setSpeedMode "FULL"
exit
Used this, here are the results.
1st time: Helicopter stopped up and landed perfectly in front of me, i jumped on board but it wouldn't move to the hp1 mark.
2st time: Chopper came in too fast and crashed into the ground. (landed, but too much speed = dead)
3st time: Chopper passed over my head with too much speed, landed somewhere behind the location i wanted it to land, too much speed again, pilots jumped out and got slaughtered by the enemies. (The chopper has a heli1 setCaptive true script, but the pilots dont)
very inconsistent.
Changing the <100 to something else doesn't seem to help either, if you go under 100 it will keep circling with too much speed above your head, and if you go above 100 it will just land/crash somewhere else. :o
Goddammit!
You can change the chopper speed further away from the landing point to avoid the AI overshooting the landing zone
The end mission trigger i have is now working partly, the black screen comes in, the right text appears.
BUT
The map doesn't end, you know, the pause and scoreboard. Instead everything is just black and you can still die/fly/talk/blablabla
So, i'm using the Trigger and then the "End #1", does this need some kind of thing relating to the "End #1"?
I thought it was a preset to end the mission?
(and yes i am dumb)
You can change the chopper speed further away from the landing point to avoid the AI overshooting the landing zone
How would i go about this? The speed is already set to LIMITED which is the slowest i believe ? :o
I don't know when it is set to limited, perhaps try to slow it down before (what I described as "further away" ;) )
])rStrangelove
Jun 9 2009, 13:30
To make it slower beforehand just increase the distance 300 to distance 500 or so. Happy testing! :D
Got it to work, the reason it was bugged was because the chopper will gain speed because of the enemies that were close, so i had to the behaviour to "CARELESS", which solves the problem.
I only need one more thing if that is possible, i need a condition script that makes a specific waypoint completed once a GreenSmokeShell is being thrown in a specific waypoint area.
I have seen people normally use eventhandlers for this but i have never worked with event handlers before, so it is an unknown thing for me completely.
Can't be harder than some kind of smoke detection script, which then fullfills the condition?
EDIT: Also, i had to remove the location change and skip it back to _chop domove [0,0,0], or else the chopper wouldn't move to the waypoint. Works like a charm now though, so no problem if the script is a little crude.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.