Home   Help Search Login Register  

Author Topic: basic scripting attempt  (Read 2079 times)

0 Members and 1 Guest are viewing this topic.

El-Mariachi

  • Guest
basic scripting attempt
« on: 18 Sep 2002, 22:51:23 »
ok heres my situation, i've got a bus full of civs with names a1 to a7, when they stop at a checkpoint i need my three guys (gunner1 to gunner3) to open fire on the civvies as they get of the bus to leg it. i have tried to make a script for it but i can't get it to work, here is what i've been using

#start

_player = ap
_gunner1 dofire a1
_gunner1 dofire a2
_gunner1 dofire a3
_gunner1 dofire a4
_gunner1 dofire a5
_gunner1 dofire a6
_gunner1 dofire a7
_gunner2 dofire a1
_gunner2 dofire a2
_gunner2 dofire a3
_gunner2 dofire a4
_gunner2 dofire a5
_gunner2 dofire a6
_gunner2 dofire a7
_gunner3 dofire a1
_gunner3 dofire a2
_gunner3 dofire a3
_gunner3 dofire a4
_gunner3 dofire a5
_gunner3 dofire a6
_gunner3 dofire a7

exit

its very basic but this would be my first attempt at scripting, any help guys?


Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:basic scripting attempt
« Reply #1 on: 18 Sep 2002, 23:44:09 »
Remove the _ from the front of the names.

You havent got the best script there.  The first gunner will shoot all the civs then the other two wont have anything left to shoot.

El-Mariachi

  • Guest
Re:basic scripting attempt
« Reply #2 on: 18 Sep 2002, 23:55:48 »
thats still not working, i'll put this thread in the scripting forum as well see if i get any luck there

Gameer_77

  • Guest
Re:basic scripting attempt
« Reply #3 on: 18 Sep 2002, 23:59:40 »
You haven't told us whats not working. Do they just not fire? Or is there an error?  :-\

 8)PEACE

El-Mariachi

  • Guest
Re:basic scripting attempt
« Reply #4 on: 19 Sep 2002, 00:05:02 »
sorry, basically they just stand there and ignore them. no error, im using player exec "murder.sqs"  to activate it on the final checkpoint of the bus

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:basic scripting attempt
« Reply #5 on: 19 Sep 2002, 00:08:33 »
i think dat da prob is dat it takes time 4 da gunners 2 aim nd shot nd mybe dat u need 2 use da dotarget command also - da best way is 2 assign 4 each gunner difrent targets in 3 difrent scripts (1 4 each gunner)

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

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:basic scripting attempt
« Reply #6 on: 19 Sep 2002, 00:12:12 »
Getting the soldiers to shoot civs is much easier if you use notepad to open the mission.sqm and change the "side=" of each civ to be either west or east.

Alternatively if you really want the script then do this;

In the trigger or WP that you are calling the script put this in place of your command you are using to call the script currently;

[gunner1]exec "Murder.sqs"; [gunner2]exec "Murder.sqs"; [gunner3]exec "Murder.sqs"

Then make your murder.sqs look like this;

_man = _this select 0

_man dotarget a1
_man dofire a1
_man dotarget a2
_man dofire a2
_man dotarget a3
_man dofire a3
_man dotarget a4
_man dofire a4
_man dotarget a5
_man dofire a5
_man dotarget a6
_man dofire a6
_man dotarget a7
_man dofire a7

exit

If this doesnt work, then using a script isnt going to work.  Though the best method is still to use the sqm to alter the side of the civs.

Gameer_77

  • Guest
Re:basic scripting attempt
« Reply #7 on: 19 Sep 2002, 00:20:59 »
First of, don't bother with the player exec "murder.sqs". Just use [] exec "murder.sqs"

Second, as LCD said, you'll only ever get the last few being killed. I would recommend using something like this:

Code: [Select]

_targeteder= _this select 0

_targeteder setcombatmode "red"
_targeteder setbehaviour "combat"

#Bad
;Put the names of the civvy's inbetween the []'s
_Civvs=[name1,name2,name3,andso-on]

_tmp = 0
#loop1
_tmp= _tmp + 1
? _tmp >= _count:exit
_Civv=_Civvs select _tmp
~0.01
? not (alive _Civv):goto "loop1"
_targeteder dofire _Civv
_targeteder reveal _Civv
@not (alive _civv)
~0.01
goto "loop1"

Not fully tested, but put that into a script and then out each of the civvy's names into the "array" (_Civvs=[name1,name2,name3,andso-on]  <----That thing!)IE:

_Civvs=[Jimmy,bob,malcolm]

then call it using:

[Nameofmurder] exec "nameofthisscript.sqs"

Any q's? Think it Should Work  :P

 8)PEACE
« Last Edit: 19 Sep 2002, 10:04:15 by Gameer_77 »

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:basic scripting attempt
« Reply #8 on: 19 Sep 2002, 00:27:41 »
I still sayhacking the sqm is by far the best way.

El-Mariachi

  • Guest
Re:basic scripting attempt
« Reply #9 on: 19 Sep 2002, 00:34:26 »
well, i've tried hacking the sqs and turning the civs to west but they just stand there and look at em. I've also noticed that if i try and arm the civs, with a pistol or something. they turn into soldiers.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:basic scripting attempt
« Reply #10 on: 19 Sep 2002, 00:37:45 »
mube deir weapons r not loaded ? - u r usin a addweapon command in deir ?

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

El-Mariachi

  • Guest
Re:basic scripting attempt
« Reply #11 on: 19 Sep 2002, 00:42:48 »
yeah im using addweapon.

Cheers Gameer_77 thats working great now, cheers for that. Great stuff!

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:basic scripting attempt
« Reply #12 on: 19 Sep 2002, 00:45:37 »
I said hack the sqm, not the sqs.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:basic scripting attempt
« Reply #13 on: 19 Sep 2002, 01:12:51 »
k solve da topic  ;D

BTW i get som of da credit also - cuz of me finidin 2 of da basics of dis thing  ;)  ;D

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

Gameer_77

  • Guest
Re:basic scripting attempt
« Reply #14 on: 19 Sep 2002, 10:01:35 »
Well, i was woken eerily last night when i suddenly realised i forgot to put in the "? _tmp >= _count:end" bit.  :o

So, if you do expierience any probs, then i've edited the script i gave you.  :)

Credit goes to LCD as he is finding too, the basics of this.  ::) Icarus also, who's idea was better than mine  :P

 8)PEACE
« Last Edit: 19 Sep 2002, 10:09:19 by Gameer_77 »