Home   Help Search Login Register  

Author Topic: Random  (Read 1083 times)

0 Members and 1 Guest are viewing this topic.

Jim666

  • Guest
Random
« on: 23 Jul 2005, 13:44:21 »
I've got a mission where your soppose to assinate a enemy officer, I want the officer to start in random places, (I dont mean placement radious) I want to script it like, each time you start a different mission he can be in a different town, or in a different part of the town.

How can i go about doing this?

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Random
« Reply #1 on: 23 Jul 2005, 13:54:08 »
create several empty markers in the places you want, then group them all to the officer. he'll spawn in random placement each time the game is played.
« Last Edit: 23 Jul 2005, 13:54:24 by bedges »

Jim666

  • Guest
Re:Random
« Reply #2 on: 23 Jul 2005, 14:06:26 »
Do the markers need to be named anything?

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Random
« Reply #3 on: 23 Jul 2005, 15:32:21 »
Nope.
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline rado1265

  • Members
  • *
Re:Random
« Reply #4 on: 23 Jul 2005, 15:35:16 »
In fact yes, because I think you can't place a marker without a name.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Random
« Reply #5 on: 23 Jul 2005, 16:17:28 »
indeed yes. they needn't be anything special, but flashpoint won't let you place an unnamed marker.

the only difficulty you'll have is with grouping them to the unit, because as soon as you switch to 'groups' the markers will disappear ;)
« Last Edit: 23 Jul 2005, 16:17:43 by bedges »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Random
« Reply #6 on: 24 Jul 2005, 16:14:03 »

MISSION EDITOR
in the "Init field" of your officer unit place the following line
this exec "setpos.sqs"

and then create a number of empty markers, lets name them "pos1", "pos2" etc at the spawn location of your choice

Setpos.sqs
Quote
_unit = _this select 0
@ alive _unit
;; following is an array containing all the markers you want as a possible setpos location
_markers = ["pos1","pos2","pos3","pos4","pos5","pos6"]
_count = count _markers
_count = _count + 0.9
_rnd = random count
_rnd = _rnd - (_rnd mod 1)
_pos = getmarkerpos (_markers select _rnd)
_unit setpos _pos
exit

the unit will initially spawn at the location placed by you in the editor and then a fraction of a second later will be setpossed to one of the markers selected at random
« Last Edit: 24 Jul 2005, 16:14:32 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Killzone

  • Members
  • *
  • War is the true Enemy
Re:Random
« Reply #7 on: 07 Aug 2005, 21:47:51 »
Hi

I seen this script and decided to try it because I could use something like this but I keep getting this error. I am not very good at diagnosing a problem. I need some help

Here is the error I get.

_unit = _this select l#l" :error select, type object, expected array

I put an enemy on the map and created some markers and named them pos1, pos2, pos3, pos4, pos5, and pos6

As always thanks people  ;D
"Everyone dies so deal with it and move on"

                                                      ME

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Random
« Reply #8 on: 07 Aug 2005, 22:15:47 »
Well, that's because in unit's init field:

this exec "script.sqs"

will pass the unit itself to the script.

Then in the script it should look like:

_unit = _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

Dubieman

  • Guest
Re:Random
« Reply #9 on: 08 Aug 2005, 14:54:18 »
Terox, why the script? The much easier way is via grouping to markers.

Offline Killzone

  • Members
  • *
  • War is the true Enemy
Re:Random
« Reply #10 on: 08 Aug 2005, 17:35:41 »
Yea I just ended up grouping the markers. I never knew you could group them. It worked out perfectly. Its nice not knowing where the enemy is coming from.

« Last Edit: 08 Aug 2005, 17:36:18 by Killzone »
"Everyone dies so deal with it and move on"

                                                      ME