Home   Help Search Login Register  

Author Topic: Need Help With Random Variables!  (Read 466 times)

0 Members and 1 Guest are viewing this topic.

Sniper_Kyle

  • Guest
Need Help With Random Variables!
« on: 26 Sep 2003, 22:40:23 »
Hey all, its been awhile because I just got a nice new comp.  But anyways I would like some help with random variables for my artillery script.  What happens is that I  put down for the pos to be random (see script for more info) but every time the artyround hits, it is in the same spot.  Plz help...fast!  I need it for a mission that is really good.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Need Help With Random Variables!
« Reply #1 on: 26 Sep 2003, 22:50:46 »
Move up #loop to the _random values, otherwise you'll stay at one value all the time.

Edit:

Like this:

#loop
_random = random 20
_random2 = random 5

arty1 = "HEAT105" camcreate([(getpos artymark1 select 0)+_random - _random2,(getpos artymark1 select 1)+_random - _random2,(getpos artymark1 select 2)])
~1
arty2 = "HEAT105" camcreate([(getpos artymark2 select 0)+_random - _random2,(getpos artymark2 select 1)+_random - _random2,(getpos artymark2 select 2)])
~3
goto "loop"


:beat: *Gets Shot* :beat:
« Last Edit: 26 Sep 2003, 22:51:36 by The real Armstrong »

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Need Help With Random Variables!
« Reply #2 on: 26 Sep 2003, 22:52:07 »
Try this:
Code: [Select]
#loop
_random = random 20
_random2 = random 20


arty1 = "HEAT105" camcreate([(getpos artymark1 select 0)+(_random - _random2),(getpos artymark1 select 1)+(_random - _random2),(getpos artymark1 select 2)])
~1
arty2 = "HEAT105" camcreate([(getpos artymark2 select 0)+(_random - _random2),(getpos artymark2 select 1)+(_random - _random2),(getpos artymark2 select 2)])
~3
goto "loop"
goto "check"

#check
? damage artybuilding >=1 : goto "stop"
~.5
goto "check"
« Last Edit: 26 Sep 2003, 22:52:43 by toadlife »
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Need Help With Random Variables!
« Reply #3 on: 26 Sep 2003, 22:54:11 »
Bullseye! Was faster than toady! ;D

:beat: *Gets Shot* :beat:

Sniper_Kyle

  • Guest
Re:Need Help With Random Variables!
« Reply #4 on: 28 Sep 2003, 21:00:14 »
THANX SO MUCH GUYS!  I needed this.  Thanks for the help and keep it up!

ChEeRs,
       Sniper_Kyle ;D