Home   Help Search Login Register  

Author Topic: Go anywhere with action command  (Read 1714 times)

0 Members and 1 Guest are viewing this topic.

Offline GW

  • ofp cadet
  • Members
  • *
  • The great Himalaya
Go anywhere with action command
« on: 30 Aug 2009, 09:14:07 »
Hey guy don't misunderstand me.i want to build a mission in everon.is there any script with help i can go lamentien to morton by pressing action menu which come on bottom of screen right side.
Be happy.
ofp die-hard fan for whole life

Offline Krieg

  • Mission Maker
  • Members
  • *
  • Who dares wins.
Re: Go anywhere with action command
« Reply #1 on: 30 Aug 2009, 09:44:57 »
I do not think so.

camcreate command could create a new unit at Morton, but I am not sure if you could set new unit as player and just delete other one.

Edit: Well, guess I was wrong.
« Last Edit: 30 Aug 2009, 12:33:20 by Krieg »
If you see a light at the end of the tunnel, then it's probably an enemy tank.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Go anywhere with action command
« Reply #2 on: 30 Aug 2009, 12:07:34 »
Actually it's quite simple to do this.

First, the action. In the player's init box type

Code: [Select]
this addaction ["Teleport!", "teleport.sqs"]
Next, place a marker in Morton where you wish to teleport to. Call the marker mk_morton.

Finally, the teleport script.

Code: (teleport.sqs) [Select]
; get passed variable
   _who = _this select 0

; teleport!
   _who setpos getmarkerpos "mk_morton"

; all done
   exit

Now this works, but it's very limited. Something more useful would be to use the onMapSingleClick command in this script so that you could click anywhere on the map and teleport instantly to that location. That's a bit more complicated though.

If you need something to help you teleport while you design your missions, try DTools.

Offline GW

  • ofp cadet
  • Members
  • *
  • The great Himalaya
Re: Go anywhere with action command
« Reply #3 on: 24 Mar 2010, 09:52:39 »
is it possible to use this script for various place teleport
Be happy.
ofp die-hard fan for whole life

Offline Krieg

  • Mission Maker
  • Members
  • *
  • Who dares wins.
Re: Go anywhere with action command
« Reply #4 on: 24 Mar 2010, 13:34:46 »
It is possible, to choose via dialog. However, if you want to make teleportation random, following script will do the job:

Code: [Select]
_random = random 5
_whole = _random - (_random mod 1)

?(_whole == 1) : goto "1"
?(_whole == 2) : goto "2"
?(_whole == 3) : goto "3"
?(_whole == 4) : goto "4"
?(_whole == 5) : goto "5"


#1
player setPos getMarkerPos "morton"
exit

#2
player setPos getMarkerPos "lamentin"
exit

#3
player setPos getMarkerPos "regina"
exit

#4
player setPos getMarkerPos "airfield"
exit

#5
player setPos getMarkerPos "lemoule"
exit
If you see a light at the end of the tunnel, then it's probably an enemy tank.

Offline GW

  • ofp cadet
  • Members
  • *
  • The great Himalaya
Re: Go anywhere with action command
« Reply #5 on: 24 Mar 2010, 16:20:31 »
how to use it,can you explain like bedges
Be happy.
ofp die-hard fan for whole life

Offline Krieg

  • Mission Maker
  • Members
  • *
  • Who dares wins.
Re: Go anywhere with action command
« Reply #6 on: 24 Mar 2010, 18:46:06 »
Sorry for not explaining.

1) Copy it to your mission folder
2) Open up mission editor
3) Add corresponding markers (i.e. morton, lemoule, airfield, lamentin, and regina marker)
4) Open player's field.
5) Write in the init: "this addAction ["Teleport", "teleport.sqs"] (or whatever you named the script).
6) Test it.

Hope that helps,
Krieg
« Last Edit: 24 Mar 2010, 18:52:46 by Krieg »
If you see a light at the end of the tunnel, then it's probably an enemy tank.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Go anywhere with action command
« Reply #7 on: 24 Mar 2010, 22:11:37 »
@GW - see attached missionette.

@Krieg - take a look at the format command. I've seen a few scripts you've written which involve jumping to script markers, and it can be done a bit simpler especially if the markers are sequential. For example:

Code: [Select]
_random = random 5
_whole = _random - (_random mod 1)

goto format["this_marker%1", _whole]

#this_marker1
player setPos getMarkerPos "morton"
exit

#this_marker2
player setPos getMarkerPos "lamentin"
exit

#this_marker3
player setPos getMarkerPos "regina"
exit

#this_marker4
player setPos getMarkerPos "airfield"
exit

#this_marker5
player setPos getMarkerPos "lemoule"
exit

To cut the code down even further you could use an array of marker names, e.g.

Code: [Select]
_markers = ["morton", "lamentin", "regina", "airfield", "lemoule"]

_random = random 5
_whole = (_random - (_random mod 1)) -1

player setPos getMarkerPos (_markers select _whole)

Offline Krieg

  • Mission Maker
  • Members
  • *
  • Who dares wins.
Re: Go anywhere with action command
« Reply #8 on: 25 Mar 2010, 12:47:27 »
Thanks about the info bedges! I'll look into it.
If you see a light at the end of the tunnel, then it's probably an enemy tank.