Home   Help Search Login Register  

Author Topic: Scripted actions....  (Read 5951 times)

0 Members and 1 Guest are viewing this topic.

KyleSarnik

  • Guest
Re:addaction and parameters
« Reply #30 on: 03 Oct 2003, 20:39:16 »
I don't think you get it still.... I don't want to have pre defined "types":

Quote
If (_Type=="F16") Then {_objcanopy = "canopytF16" createVehicle [0,0,0] ; _ejectseat = "seattF16" createVehicle [0,0,0]}

and I still dont understand what to do ??? >:( :-\

if I put _array = [_obj,_seatt,_canopyt] exec

then have  _ejectaction = _obj addaction ["Eject",_array+"ejection.sqs"]

will it work?
Well I will go try it....

KyleSarnik

  • Guest
Re:addaction and parameters
« Reply #31 on: 04 Oct 2003, 18:20:14 »
Nope.... Doesn't work :(..... Grr this is really making me mad! Is there ANY way to detect if the action was activated in the same script with the addaction? Or is there any way to do something to the plane that could be detected in script w/ the addaction in it?? OR if you could just explain the damn array thing perhaps I could define the array in the script itself!!! Please help! Much Thanks!!!!

Offline KTottE

  • Former Staff
  • ****
Re:addaction and parameters
« Reply #32 on: 04 Oct 2003, 20:12:25 »
I think you should sit down and work out exactly what you want to accomplish, and then explain it to us in a comprehensible fashion.

Right now we're just getting bits and pieces of information, and it's hard to help anyone if you don't know what they want.

So, give us the full story, with all the details, as you have planned it. No matter how it works now, but your original plan, in detail.
« Last Edit: 04 Oct 2003, 20:12:45 by KTottE »
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

KyleSarnik

  • Guest
Re:addaction and parameters
« Reply #33 on: 04 Oct 2003, 22:54:49 »
I am making a universal ejection seat addon/script.... I have three parameters, [object(plane),"seatclassname","canopyclassname"] and the ejection part works fine but I can't set the parameters for the ejection script through an addaction. What I can do is execute the ejection script in the same script that the addaction is in, but I need a way to detect if the pilot used the action. I have tried using global variables it wouldnt work on muiltiple planes. I hope thats good enough cause I can't think of anything else to explain...   :-\

Offline KTottE

  • Former Staff
  • ****
Re:addaction and parameters
« Reply #34 on: 05 Oct 2003, 00:34:05 »
You're still not explaining everything.

Why do you need the canopy and seat classnames?
What will you use that for?
Will you have several classnames?
How will these be decided?

And so on and so forth.
This goes for everything, not just the canopy and seat classnames.
Explain the entire idea from beginning to end and leave no detail out.
What exactly will the eject script do?
What exactly will the action script do?
Any limits on when/how you can use the action?

NOTE: These are not the only questions, they are just here to start you off.
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

KyleSarnik

  • Guest
Re:addaction and parameters
« Reply #35 on: 05 Oct 2003, 06:13:34 »
I know what im doing and it should apear obvious to you what im trying to do. A script that works with any vehicle classname, an action that is removed when engine is off, the guy gets put into the seat and the seat flies upward. I allready have this and it works. I don't know what your asking for? All I need is a way to transfer parameters through an addaction. All your doing is confusing me...  :-\ :-[ and its kinda embarassing...

Offline KTottE

  • Former Staff
  • ****
Re:addaction and parameters
« Reply #36 on: 05 Oct 2003, 09:19:06 »
We have come up with several different solutions to the problem you describe, but all the time you say "No, that's not what I want" or "No, that will not work", so what I want you to do is write a very detailed explanation of what you want to do, and what you want the scripts to do, what parameters you need to pass, why you need to pass them, what you want to do with the passed parameters,  why does it have to be an added action?

And so on and so forth.

In my opinion, an eventhandler attached to 'Eject' would do just fine, mostly because you can pass variables to scripts executed by eventhandlers without a problem, and you could make one script that works for all planes.
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:addaction and parameters
« Reply #37 on: 05 Oct 2003, 13:53:12 »
I totally agree to what Ktotte said here.

There have been a whole lot of suggestions brought
up, where you always said it wouldn't work.

While you said you don't understand, some answers you
got in "less-advance"-editing forum, you were begging to
get this thread swapped over to "advance"-editing forum.

(*me still thinks that in both threads the very same people
will read and answer, but that's just an assumption*)


Your main question is: how do i pass parameters to a script,
without the possibility to do that from the exec statement.

The answer here i say again now: use arrays

What KToTTe means by more details is:

if you want a detailed answer, you need to explain the
logic functionality of how your script should work - explain
how and why variables will be passed and used
explain where your variables should come from, and explain
the dependence of those variables, how they do influence
the outgoing of your script.

If you can't explain it the scientist's way, then just do the
following: explain three different scenes of a game, where
your script should already be working. Tell us all, what happens
and what will be important to make this scene working.
Leave no detail out - e.g: player sits in a plane - player
triggers custom action - script should do this and that and blablabla.

jfyi - i've already decided to give up answering here, as you
were not ready to think about understanding the answers,
and i wasn't sure if you don't want or can't understand them

If you come back with more details, maybe i understand why
none of the yet posted replies couldn't help you, and then
we probably could go for another solution.

~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

KyleSarnik

  • Guest
Re:addaction and parameters
« Reply #38 on: 05 Oct 2003, 19:05:34 »
My most unfavorite word: explain (thats why I failed my english class)

What exactly do you want to know?? My head is clouded... All I wish to acheive is transer 2 of those damn parameters to the secnd script with out executing that script... or whatever! I am having a very difficult time understanding what you mean by all this... About the arrays, what I don't understand is how you use different arays, for different planes... It seems like using arrays would put a limmit on the excepted parameters? Am I wrong? This is all giving me a headache.... I don't know what to type.... I understand that in using addaction you can determine the plane, and the pilot too (that doesn't really help me tho), but I need those 2 classname parameters! What I want is, pilot clicks "Eject", canopy pops, guys seat flys outta plane and then a parachute deploys and he comes safly back to the ground.... Seat classnames and canopy classnames changable... Is that good enough????? Thats all I can tell you, im in a hurry.... I must go now....

Offline KTottE

  • Former Staff
  • ****
Re:addaction and parameters
« Reply #39 on: 05 Oct 2003, 19:57:03 »
Why do you need different canopies and ejectionseats?

When a player ejects himself, he won't think about canopy or seat type as he shoots out. Sure, he'll notice if they are good looking models or crappy looking ones, but he won't go "omg, that's a russian ejection seat in an american plane!" or something of the sort.

But, your idea would give the player two Eject actions, the one in the game, and the one you add. Why make things more complicated than they have to be?
Eventhandlers can be attached to just about everything in OFP, so if you attach one to the 'Eject' event, the EH will trigger any time someone ejects, and the beauty of eventhanders is that you can pass parameters to the scripts you execute in them.

Since I'm a bit strapped for time right now I can't give you a proper example, but it could look something like this:

this addEventHandler ["eject",{[foo,bar]  exec "ejectScript.sqs"}]

Put that in the initfield of the airplane.
foo and bar are the parameters you want to pass to the script.
And these can be caught from within ejectScript.sqs with:

Code: [Select]
_foo = _this select 0
_bar = _this select 1
« Last Edit: 05 Oct 2003, 19:58:03 by KTottE »
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

KyleSarnik

  • Guest
Re:addaction and parameters
« Reply #40 on: 05 Oct 2003, 21:33:40 »
Wow!  :wow:

I didn't know that you could do that that defeats the whole locking the plane so there is only 1 ejection action and making AI use it when they get 5 dammage part of my script! Right. Well the reson I want the different canopys and seats is because it would look stupid if you saw an oversized canopy fly off of a smaller aircraft then a huge seat that wouldnt fit in the cockpit. Its for the realisitc part of my script, I didn't really make this script to save peoples lives when they eject, I made it cause it looks cool, but now I can make it so it looks cool AND saves peoples lives  ;)

Im going to go try it now...

KyleSarnik

  • Guest
Re:addaction and parameters
« Reply #41 on: 05 Oct 2003, 21:42:29 »
Nope that syntax doesnt work.... Are you sure its correct??

Offline KTottE

  • Former Staff
  • ****
Re:addaction and parameters
« Reply #42 on: 05 Oct 2003, 21:48:28 »
Quote
Since I'm a bit strapped for time right now I can't give you a proper example, but it could look something like this:

^ Read what I say ;)

It could go something like that, but I'm not very used to EH's, so I can't give you exact syntax.
What's the error message it gives you?
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:addaction and parameters
« Reply #43 on: 05 Oct 2003, 23:55:50 »
Yeh - sorry, but eventhandler "eject" doesn't exist i believe.

There's an eventhandler "GetOut'", but i'm not sure if the
action "eject" is covered by the getout event.

Kyle, i'm trying now to show you what i mean with using arrays.
(don't think about using the exact same model for you, just
try to imagine if something like that could help you).

An array is a vektor with positional parameters, like

my_array1 = [a,b,c]

Now there are 3 parameters, which can be selected by
my_array select 0 - 2

let's make two more arrays for later use:

my_array2 = [d,e,f]
my_array3 = [g,h,i]

Then there are even more complex arrays, consisting of
sub arrays:

my_array = [my_array1,my_array2,my_array3]

this array would look like:

my_array = [[a,b,c],[d,e,f],[g,h,i]]

This array consists of 3 sub-arrays, where each of it consists
of 3 parameters.

Now let's say the first parameter of each sub-array contains
the type of a plane;

my_array1 select 0 = SU_25
my_array2 select 0 = A10
my_array3 select 0 = C-130

:note - the name of the planes are just fantasy names,
for your script you still need to find out the type, you need.

The second parameter of each array could then be used
to define the seat-type, and the third one for the canopy.

my_array1 select 1 = "su25-seat"
my_array2 select 1 = "a10-seat"
my_array3 select 1 = "c130-seat"

my_array1 select 2 = "su25-canopy"
my_array2 select 2 = "a10-canopy"
my_array3 select 2 = "c130-canopy"


Now once your ejection-action has been triggered, as you
already figured out, the owner of the action (the plane) is
passed automatically to the script.

All you have to do is:

compare the vehicle, owning from where the action has been
called against the first parameter of each sub-array - once you found the right sub-array, take seat- and canopy type from this sub-array to be used in your script.

That's why unnamed and me replied about the "if-statement".


_plane = _this select 0

{If (vehicle _plane) == _x select 0) Then {_seatt = _x select 1; _canopyt = _x select 2}} ForEach my_array

[_plane,_seatt,_canopyt] exec "ejection.sqs"

Now what will happen?:

custom action is called from an A10

script says: _plane = the plane, from where the action has
been called

Now the script checks, which first element of the three sub-
arrays in my_array does match to the script-owner.
In this case it's the second sub-array:

my_array2

Now the script will assign parameter 2 and 3 of my_array2
to _seatt and to _canopyt

Followed by starting the ejection.sqs with passing the correct
parameters.

voila

hope this helps

:edit - just fixed a missing "select 0", and added an exec statement, using the array you want to pass the correct
parameters. Also i've updated the arrays to match with your
idea of how to get it to work.

~S~ CD
« Last Edit: 06 Oct 2003, 12:55:11 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

KyleSarnik

  • Guest
Re:addaction and parameters
« Reply #44 on: 06 Oct 2003, 00:23:56 »
But wouldnt I have to have a different array for each seat/canopy combination?? Or can I just put in the script:

array = [_obj,_seatt,_canopyt]
_obj addaction ["Eject","eject.sqs"]

and in ejection.sqs:

aray exec "ejection.sqs"

or how does that work?? I don't understand the if, then thing...