Home   Help Search Login Register  

Author Topic: Multiple Map Click Array  (Read 940 times)

0 Members and 1 Guest are viewing this topic.

Offline Skumball

  • Members
  • *
Multiple Map Click Array
« on: 10 Dec 2002, 04:30:39 »
Another week, another script by me which uses the map click function :D This time, however, the script is not specific and can be used in almost any situation.

The script reads any number of map clicks and transfers the co-ordinates to an array. Straight-forward you cry, but I have been trying to figure this one out for a while and it is very useful, trust me.

For example, a mission may require the player to specify a route for a vehicle to take. The player can click on the map and choose the waypoints himself.

Or the player could click a location for a tank to spawn in, click another location for it to move to and finally click another location for it to fire at.

I could go on but I think you get the idea. Let your mind run wild and try to be creative!

*UPDATE* v1.1 below
|
|
|
v
« Last Edit: 18 Dec 2002, 02:46:23 by Skumball »

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Multiple Map Click Array
« Reply #1 on: 10 Dec 2002, 10:48:53 »
i like ur weekly "map click scripts 4 beginers"  ;)  ;D

but i think u could have writen dis script in beter way (im postin dis only cuz i like 2 discus scriptin 2 disin or somthin  ;D)

u could have do it in dis way - need only 2 scripts

"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Multiple Map Click Array
« Reply #2 on: 10 Dec 2002, 10:50:27 »
or check dis 1 script only :D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Skumball

  • Members
  • *
Re:Multiple Map Click Array
« Reply #3 on: 10 Dec 2002, 12:56:42 »
Thanks LCD that's a big improvement. I'll get on it tonight.

Offline KeyCat

  • Members
  • *
Re:Multiple Map Click Array
« Reply #4 on: 16 Dec 2002, 07:05:03 »
Thanks for all your great scripts! I would like to use the Multi Map Click script with the SetWPPos command but fail to get it to work...

The SetWPPos expect a parameter like this...

 
Code: [Select]
[_unit,1] SetWPPos [X,Y,X]
But after lets say 3 clicks the array looks like this (note the double [[ and ]])...

 
Code: [Select]
[[X,Y,Z],[X,Y,Z],[X,Y,Z]]
Any clue how to pick out each "[X,Y,Z]" from the array so it could be feed to the SetWPPos command?

Again, thanks for all scripts you are sharing! Since I'm still a newbie they helps alot while learning and it's neat to be able to learn from the pro's :)

/Christer (a.k.a KeyCat)

« Last Edit: 16 Dec 2002, 07:13:14 by KeyCat »
- The journey is the reward!

Offline Skumball

  • Members
  • *
Re:Multiple Map Click Array
« Reply #5 on: 17 Dec 2002, 04:35:37 »
Thanks KeyCat, I haven't been doing OFP editing for very long. I have had some basic programming experience in the past and that has helped a great deal. I never had any motivation to do any more until I got into OFP editing a couple of months ago. It's good to be able to get instant feedback from a few lines of code in a game like this !

Anyway on to your question.

If you have the array as mapClickArray then first what you need to do is to name the arrays inside the array:

_array1 = mapClickArray select 0
_array2 = mapClickArray select 1
_array3 = mapClickArray select 2

and so on.

Then to get each element of the individual arrays, you must name the contents like this:

_x1 = _array1 select 0
_y1 = _array1 select 1
_z1 = _array1 select 2

_x2 = _array2 select 0
_y2 = _array2 select 1
_z2 = _array2 select 2

_x3 = _array3 select 0
_y3 = _array3 select 1
_z3 = _array3 select 2

That should work   ;)

Offline KeyCat

  • Members
  • *
Re:Multiple Map Click Array
« Reply #6 on: 17 Dec 2002, 05:50:19 »
Worked like a charm (in SP, haven't tried MP yet)! Without your help I've probably pulled out all my hear before solving it myself  :D

Big KUDOS to you and once again thanks for all great script to learn from! Will make sure to give proper credits in anything I may eventually release to the OFP community.

/Christer (a.k.a KeyCat)

« Last Edit: 17 Dec 2002, 19:24:03 by KeyCat »
- The journey is the reward!

Offline Skumball

  • Members
  • *
Re:Multiple Map Click Array
« Reply #7 on: 18 Dec 2002, 01:29:52 »
Glad it worked :)

I haven't done any MP editing yet. I think the 'publicVariable' command is important though.

Offline Skumball

  • Members
  • *
Re:Multiple Map Click Array
« Reply #8 on: 18 Dec 2002, 02:38:45 »
Here is Multiple Map Click Array v1.1 with LCD's modifications and an example mission.

LCD: The only thing that you missed was 'execMapClicks = false' after '@ execMapClicks'. After running the script once the array would only accept 1 map click value. Other than that, good job!
« Last Edit: 18 Dec 2002, 02:44:13 by Skumball »

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:Multiple Map Click Array
« Reply #9 on: 18 Dec 2002, 07:47:11 »
Glad it worked :)

I haven't done any MP editing yet. I think the 'publicVariable' command is important though.

You'll find it may be a little bit more complicated than that.

I got it working for your airstrike script, but the process was difficult. I tried to explain how to do it here:

http://www.ofpec.com/yabbse/index.php?board=7;action=display;threadid=3986

Getting the napalm script to work was even more difficult. I am getting around to putting an example mission together...  ::)
Bohemia Interactive Simulations

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Multiple Map Click Array
« Reply #10 on: 22 Dec 2002, 00:40:36 »
tanks skumball  ;D nd snYpir

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta