Advertisement

Author Topic: How to use waypoint SCRIPTED + examples  (Read 3227 times)

0 Members and 1 Guest are viewing this topic.

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
How to use waypoint SCRIPTED + examples
« on: 27 Oct 2003, 04:05:09 »
A few months ago i figured out how to use the
waypoint type SCRIPTED.
I came then up with a thread, where i explained it
and even included an example mission.

IMHO this is the really most powerfull waypoint, as
it opens a wide variety of options for scripts in combination
with the use of waypoints.

Now i haven't seen much people been using it or asking
for that kind of waypoint  :'(
I'm not sure now wether my explanation was maybe too complicated, or noone was thinking about how to implement
this waypoint into his missions.

Therefore i decided to open up a new thread, where i'm
going to release a couple of examples, to show you guys
what can be done with this waypoint.

:note - all of the examples, i'm going to show you here
will require nothing more than INGAME editing + the scripts
for the waypoint type SCRIPTED itself.
No need to give vehicles/units/groups a name in the editor.

First i wanna explain the waypoint SCRIPTED in theory:

Waypoint SCRIPTED will be executed once a unit/group
has reached the previous waypoint of the one type SCRIPTED.

If waypoint SCRIPTED is the first waypoint, it will be executed
imidiately.

The unit/group will not move to the waypoint, it only does
what it gets told from inside the script.

The script to be executed, has to be entered into the SCRIPTED
field at the bottom of the waypoint's menu.

:note - no quotation marks are needed, just the scriptname
+ it's extension.

This would then look like: scriptname.sqs

A few very helpfull parameters will be passed automatically
from the waypoint to the script:

[owner,position,target]

owner represents the owner of the waypoint (may be unit
or group)

position is the position array of the waypoint itself

target is the object, where the waypoint is placed onto

Inside the script these can be accessed that way:

owner:
_group = _this select 0

position:
_pos = _this select 1

target:
_target = _this select 2

Now these 3 parameters are already enough to make really
interesting stuff, as you will see in the upcomming examples.

The unit/group will now do everything what the script provides.
Once the script ends/exits, the group will move to the waypoint
after the SCRIPTED one.

The onActivation field of the SCRIPTED waypoint will get in
use when the script has ended.

Same goes for anything in the waypoint's effects menu.

P.S: i know this should go to the editors depot, and i've already
made a thread about that some time ago, but i opened this
new one for the following reasons:

1) An old thread might not be attractive enough for a lot of
the members to be read

2) A tutorial will follow, but as this waypoint is so easy to use
i would like to get more people interested in this one before
making a tutorial, where maybe noone feels bothered to have
a read into.

3) I would like to collect a couple of examples of mine (or also
even of yours) together, to make it worth being a tutorial
for the ED-depot

Examples will follow in the next posts to be found easier here.

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:How to use waypoint SCRIPTED + examples
« Reply #1 on: 27 Oct 2003, 04:06:38 »
Mounted gun:

This example shows you how to:

a) let a group mount a single gun, and if the gunner
gets killed it will be replaced by another member of the group

:note - there already exists a script for this one, but not
that easy i think, and especially not in combination with
the waypoint SCRIPTED

b) destroy that gun, when all members of that group were
killed

:note - sometimes AI seems to react in a stupid way, if
there are empty guns hanging around. Therefore i made this
script

a will use a simple GETIN waypoint placed onto an empty M2 machinegun

:note - best you use: open fire in the waypoint's menu on this one

b will use a waypoint SCRIPTED placed with left-shift onto the M2
machinegun too. The script is gonna called: brf_gunner.sqs

<brf_gunner.sqs>

The script will wait at an @condition until all units of the group
got killed. When done, the gun will be set to damage 1 (=destroyed)

You the player are set to captive true, so feel free to kill all soldiers, nobody will bother to return fire.

Following parameters were used for this script:

owner,target

_this select 0
_this select 2

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:How to use waypoint SCRIPTED + examples
« Reply #2 on: 27 Oct 2003, 04:07:30 »
Chopper insertion:

This example mission will show you how to;

a) let a group moveincargo of a flying helicopter

b) let this group disembark near the player

c) let the helicopter go two get another group in cargo

d) disembark this group aswell near the player

Finally the chopper will land near the player aswell, but without
using the SCRIPTED waypoint (no attention has to be taken on that
therefore)

a will use the script: brf_mount.sqs

b and d will use the script: brf_landing.sqs

<brf_mount.sqs>

A west group with a waypoint SCRIPTED, placed onto a flying
western UH60.

Following parameters were used for this script;

owner,target

_this select 0
_this select 2


<brf_landing.sqs>

The chopper will be ordered to move to the SCRIPTED waypoint
Once it has reached the position, the chopper will fly in a height
off 0.5 (will look like hovering at the ground), and then disembark
all soldiers inside (except the chopper's crew itself).
Once all soldiers from the cargo group are out of the chopper, the
script will end and the chopper takes off to it's next waypoint.

Following parameters were used for this script;

owner,position

_this select 0
_this select 1

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:How to use waypoint SCRIPTED + examples
« Reply #3 on: 27 Oct 2003, 20:52:33 »
Mobile infantry:

This example mission will show you how to;

a) mount infantry onto vehicles

b) let the infantry disembark

c) let each soldier move to a random position

d) let the vehicle move on when c) has been completed

e) let the infantry remount the vehicle when d) is done

And last the vehicle will move on to it's final destination
where all the crew and cargo will disembark.



a will use the script: brf_mount.sqs

:note - brf_mount.sqs is the same script and uses the same technique
as shown in the chopper insertion example. But for those who haven't
seen the chopper insertion i'm gonna post the details once more;


<brf_mount.sqs>

A western group with a waypoint SCRIPTED, placed onto a western manned
vehicle

Following parameters were used for this script;

owner,target

_this select 0
_this select 2

The script will wait at an @condition, until every unit is mounted
in cargo of the vehicle, before it exits. This was required, as
the next waypoint of the group is also type SCRIPTED, which wouldn't
have worked other way.


b,c,d,e is a combination of two interacting scripts:

brf_getinpos.sqs + brf_recon.sqs


<brf_getinpos.sqs>

The western vehicle will move to a certain position, where it unloads
it's cargo for exploring the area, before continuing it's way.
Once the cargo group was unloaded, the script will wait for the
behaviour of the whole cargo group to be "COMBAT".
Then the vehicle will move to the position of the SCRIPTED waypoint,
to let the cargo group remount it there. The SCRIPTED waypoint is
placed onto a gamelogic, which was required to easily check the distance of the vehicle to it's rendevouz point with the cargo group
again.

Following parameters were used for this script;

owner,position,target

_this select 0
_this select 1
_this select 2


<brf_recon.sqs>

This script will be executed, once the brf_mount.sqs script exits.
It will wait then until every member of the group has left it's
transport vehicle. Then every soldier will be ordered to a different
random position inside a 75 meter radius around the scripted waypoint.
When all units have reached their position, the behaviour will be set
to "COMBAT", to let the script brf_getinpos.sqs continue it's work.
The script will end, until every member of the group is back in cargo.


Following parameters were used for this script;

owner,position

_this select 0
_this select 1



:note

To let you have a deeper look onto the power of waypoint SCRIPTED,
i've copy/pasted the whole stuff on the map, so that you will see
everything twice with a small difference;

group 1 consists of 8 men and will mount an m113,
while group 2 consists of 12 men and will mount a 5t truck

Still there was no need to use any object/group/unitnames, nor was
there need for any global variables to be passed anywhere.

The only thing i needed this time was: a gamelogic to be the target
of a scripted waypoint.

Both groups and vehicles are using the very same scripts and the very
same kind of waypoints.

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Blanco

  • Former Staff
  • ****
Re:How to use waypoint SCRIPTED + examples
« Reply #4 on: 28 Oct 2003, 00:52:21 »
interesting stuff...

Search or search or search before you ask.

Offline Blanco

  • Former Staff
  • ****
Re:How to use waypoint SCRIPTED + examples
« Reply #5 on: 28 Oct 2003, 18:02:15 »
Hm... Chris, I think there is a fourth parameter, but it was too late (or early) to find out wat it returns. It returns a number, thats all I know.

try this


letmeknow.sqs

_par1 = _this select 0
_par2 = _this select 1
_par3 = _this select 2
_par4 = _this select 3

hint format ["%1\n%2\n%3\n%4,"_par1,_par2,_par3,_par4]

try it in a scripted waypoint and with my example, a UAZ with 1 movewp and 1 scriptedwp placed on another UAz (target)

_par4 returns the number 0, I don't know what it stands for but it's not the damage or a wppos id.


Maybe it's the total units in cargo I don't know, but i'm sure it's worth to mention...









Search or search or search before you ask.

Offline Burn

  • Members
  • *
Re:How to use waypoint SCRIPTED + examples
« Reply #6 on: 28 Oct 2003, 18:16:23 »
Thanks for reminding me of this Chris :thumbsup:, I remember seeing the last time you posted about scripted wp's, but i forgot about it later on :P... Your words and example missions have been saved to my harddrive for further inspection ;D,(just in case my brain crashes from overheating :beat:), thanks :toocool:.
==========================================================
******************************************************************
 
::) E D I T       :o       E D I T        :booty:      E D I T      ;D    E D I T     :gunman:      E D I T    :hmm:

===========================================================
*******************************************************************
Btw anyone havin' any problems getting into the official forums ???

I get the following:
Quote
Ikonboard CGI Error
--------------------------------------------------------------------------------
Ikonboard has exited with the following error:

Quantifier follows nothing before HERE mark in regex m/* << HERE @hzcnc.com/

This error was reported at: Sources/Sessions.pm line 311.

Please note that your 'real' paths have been removed to protect your information.

 :oHuh ??? ...
« Last Edit: 28 Oct 2003, 18:26:14 by Bizon »

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:How to use waypoint SCRIPTED + examples
« Reply #7 on: 28 Oct 2003, 18:50:12 »
Quote
Hm... Chris, I think there is a fourth parameter, but it was too late (or early) to find out wat it returns. It returns a number, thats all I know.

Yes, there's a fourth parameter in that array, but i didn't
mention it because of the reason, you already figured
out by yourself:

it returns the value of zero

And that's the only value, it did return in all of my tests
(whatever i've tried to change it gave me a 0)

Off course it's worth to mention that, as maybe someone
else could figure out what it's for (*hint*)

btw - BIS didn't tell anything about it aswell (look into
the resistance editing manual), so i thought it could also
be just an accident parameter  :)

Will do further investigations on that fourth parameter, to
be able to exclude every possibility about it's being.

P.S: instead of trying to display each parameter manually
by: _this select x, i prefer the method of displaying the
whole array, when exploring such: _this  ;)

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:How to use waypoint SCRIPTED + examples
« Reply #8 on: 07 Jun 2005, 18:59:22 »
Okay,

So what is the difference between using a Scripted waypoint and just putting a script in the On Activation field of the previous waypoint?

My guesses:
1)A Scripted waypoint, as you've described above, passes some useful default variables to the script.
2)With a Scripted waypoint the group will wait at the previous waypoint until the script is finished and then proceed to the waypoint following the Scripted waypoint.  With a script in the On Activation field of the previous waypoint the group will not wait but will immediately proceed to the next waypoint.

Is the above correct?
urp!

Offline Blanco

  • Former Staff
  • ****
Re:How to use waypoint SCRIPTED + examples
« Reply #9 on: 07 Jun 2005, 19:22:44 »
Exactly, your guesses are right Mr Peanut  :)

Remember that scripted waypoints are USELESS in SP missions because status is lost when you save/reload or retry the mission!

 
« Last Edit: 07 Jun 2005, 19:23:11 by Blanco »
Search or search or search before you ask.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:How to use waypoint SCRIPTED + examples
« Reply #10 on: 07 Jun 2005, 21:03:46 »
This is interesting stuff.  Any chance of getting it put somewhere it will not vanish - how about submitting it to the editors dept?

Offline 456820

  • Contributing Member
  • **
Re:How to use waypoint SCRIPTED + examples
« Reply #11 on: 08 Jun 2005, 16:48:39 »
indeed very interesting stuff but the waypoint is activated before the actual scripted waypoint like this
wp1 = move
wp2 = move
wp3 = scripted
so would the scripted waypoint activate the script when wp2 has been completed ?
or have i got something wrong ?

also
Code: [Select]
[owner,position,target]is the position the position of what the waypoint if so wich one or the pos of the group/unit.

ill probaly end up trying to use this waypoint sounds like something i need to get units to stop hiding

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:How to use waypoint SCRIPTED + examples
« Reply #12 on: 18 Jun 2005, 11:21:57 »
huh  :o - i didn't notice that this thread came back to life again

Well 456820;

You got it right - the script activates, once wp2 has been
completed

Off course it's the position of the waypoint: scripted

@Blanco - imho it's not useless in sp - only if savegame is needed
at the point, where a scripted waypoint script is running.
But what if you start find an easy work-around?
What about a switch trigger, which would reenable the waypoint
before a scripted waypoint? This switch trigger could be enabled
by a variable or boolean, which can be stored by save-game.
Could be also some kind of numeric counter, which doesn't match
at first mission start, but at next.

This shouldn't be too complicated to be managed - or should it?

Off course there are situations, where this might become impossible, but also there are situations which could become
solved that way  ;)

@Thobson:

The thread could become a sticky one - if there's the nead - but
i've moved over to addon making and at the mo i really got
not enough time to build up a real tutorial - i thought when making
this that the thread itself should be enough to learn something
from.

Off course i wouldn't have a problem when somebody else put
a decent tutorial out of this together - he could even use my
example scripts for this - why not.

~S~ CD
« Last Edit: 14 Oct 2005, 18:41:51 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline 456820

  • Contributing Member
  • **
Re:How to use waypoint SCRIPTED + examples
« Reply #13 on: 18 Jun 2005, 11:57:27 »
are there like any things that get returned like name of group or anything usefull that can be used in the scripts ?

Offline bedges

  • Former Staff
  • ****
    • OFPEC The Editing Center
Re:How to use waypoint SCRIPTED + examples
« Reply #14 on: 18 Jun 2005, 12:19:03 »
have you read the first post in the thread?