Home   Help Search Login Register  

Author Topic: simpler way?  (Read 622 times)

0 Members and 1 Guest are viewing this topic.

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
simpler way?
« on: 11 Dec 2004, 15:47:35 »
I use this script to add some variety to a deathmatch.  I am certain there is a more simple way to pull this off.  The script is called from a grouped trigger by each unit, so that means I have 12 grouped triggers calling 12 seperate scripts just to position the player in a deathmatch away from another player after a respawn.  Other than using the OR command I can't think of a way to streamline the process.  This has been tested in MP with 4 players.  Anyone have an idea to streamline this whole process?
Code: [Select]
;________________________
;::::::::::::::::::::::::
;
;Place Documentation here
;author Zombie
;created 12/9/2004 8:09:22 PM
;________________________
;::::::::::::::::::::::::
#here
;;getpos here references a gl named here
;;s1 through s12 are the units
s1 setpos [(getpos here select 0)+ random 45, (getpos here select 1) + random 45, getpos here select 2]
?(s1 distance s2)<= 15:goto "nothere"
?(s1 distance s3)<= 15:goto "nothere"
?(s1 distance s4)<= 15:goto "nothere"
?(s1 distance s5)<= 15:goto "nothere"
?(s1 distance s6)<= 15:goto "nothere"
?(s1 distance s7)<= 15:goto "nothere"
?(s1 distance s8)<= 15:goto "nothere"
?(s1 distance s9)<= 15:goto "nothere"
?(s1 distance s10)<= 15:goto "nothere"
?(s1 distance s11)<= 15:goto "nothere"
?(s1 distance s12)<= 15:goto "nothere"
;;s1 sidechat "warped"
exit
#nothere
;;getpos nothere references a gl named nothere
s1 setpos [getpos nothere select 0, getpos nothere select 1, (getpos nothere select 2) + random 15]
;;?(s1 distance s2)<= 5:goto "here"
exit

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:simpler way?
« Reply #1 on: 11 Dec 2004, 17:22:26 »
i believe you are using a 'not present' trigger yes?

first make a 'present' trigger grouped to the players and put this in the activation line:
allplayers = thislist
group one trigger to all of them and set it to 'any unit'
and make a gl in the center of your map
and pass the script like so:
{[_x] exec "script.sqs"} foreach thislist

then in your script, put:
_unit = _this select 0
_gl = gl
#place
_here = "logic" camcreate [(getpos _gl) + random # - random #,(getpos _gl) + random # - random #, 0]
?"_here distance _x <= 15" foreach allplayers:goto "place"
_unit setpos getpos _here
« Last Edit: 11 Dec 2004, 17:23:18 by Triggerhappy »

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:simpler way?
« Reply #2 on: 12 Dec 2004, 16:21:23 »
actually I am using present triggers covering a huge respawn area outside of the mission area.  Then the player is randomly inserted in the mission area.  I will give your idea a try later today and let you know....
as an aside...sometimes the player is positioned inside a building that is not meant to have anyone inside, and it is difficult to get out of the building, is there any way to resolve this too?  The map is Tequila btw

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:simpler way?
« Reply #3 on: 12 Dec 2004, 20:29:53 »
don't have that map, sorry, but you might be able to use the nearestbuilding command and find the distance between the player and the building