Home   Help Search Login Register  

Author Topic: changing what your weapon fires?  (Read 2929 times)

0 Members and 1 Guest are viewing this topic.

Offline DurbanPoison

  • Members
  • *
changing what your weapon fires?
« on: 27 Aug 2010, 01:36:17 »
howdy people,


I remember back in the good 'ol ofp days someone round here created a script that switched out ammo for your weapon... so that is fired seagulls instead! I am working on a very serious mission and would like to know if it is possible to do this in arma2 aswell?

I'd like the player's weapon to fire chickens... and would be even better if they exploded when they hit an object or player.  :D

Anyone have any ideas how i'd go about doing this? Thanks in advance to anyone who can help out!

Offline zonker3210

  • Members
  • *
Re: changing what your weapon fires?
« Reply #1 on: 27 Aug 2010, 03:22:15 »
Maybe one of the gurus on here might know of a script-based way of doing this but as far as I know this is something that requires an mod-based approach. You could probably use this mission (and the included mod) as a starting point for figuring it out...

UberSoldaten (complete with Cow-Launching Destroyer of Worlds)
http://forums.bistudio.com/showthread.php?t=86950

If you do come up with a script-based way, please do share. I can't speak for others but personally, I would LOVE a chicken launcher. Heh...

Offline DurbanPoison

  • Members
  • *
Re: changing what your weapon fires?
« Reply #2 on: 27 Aug 2010, 17:30:30 »
Thanks for the pointer Z - I'll check out the mod and see if it might help...granted i script missions like i perform at work... poorly. But I am certain the old ofp one was script based.

I'll go light some insence and chant some more...   :blink:

Offline ZapBrannigan

  • Members
  • *
Re: changing what your weapon fires?
« Reply #3 on: 05 Sep 2010, 23:42:38 »
an sqs code line


add this to the player init
Code: [Select]
player addEventHandler ["fired",{if ((_this select 4) == "B_556x45_Ball") then {[]exec"chicken.sqs"}}]
Make an sqs script name chicken.sqs

Code: [Select]
_missile = nearestObject [player,"B_556x45_Ball"]
_ckn = "Chicken" camcreate getpos _missile
_ckn setvelocity velocity _missile
deletevehicle _missile
@(damage _ckn) > .1
_bam = "G_40mm_HE" camcreate getpos _ckn
deletevehicle _ckn
exit


this should make the players gun fire chickens that explode when they hit stuff.  but only if the player is armed with an m16.   for other guns change the ammo in the init and script to the ammo name you want.

also im not sure what the classname for chicken is, you may need to search around for that.  and put it where it says chicken, (if chicken isnt really the classname)

Offline zonker3210

  • Members
  • *
Re: changing what your weapon fires?
« Reply #4 on: 06 Sep 2010, 06:22:26 »
That's it? Just that little bit of code? Ohhhhh, I cannot wait to try this out. Thanks for sharing, Zap!  :good:

Offline ZapBrannigan

  • Members
  • *
Re: changing what your weapon fires?
« Reply #5 on: 06 Sep 2010, 09:35:42 »
sorry the last one was from memory, in arma 2 use this code

Code: [Select]
_missile = nearestObject [player,"B_556x45_Ball"]
_pos = getpos _missile
_ckn = group m1 createunit ["cock",_pos,[],0,"NONE"]
_ckn setpos getpos _missile
_ckn setvelocity velocity _missile
deletevehicle _missile
#bam
_npos =getpos _ckn
~.2
_bam = "Sh_125_HE" createvehicle _npos
_bam setvelocity velocity _ckn
_npos = getpos _ckn
~.2
_bam setpos _npos
_bam setvelocity velocity _ckn
~.6
deletevehicle _ckn
exit


I tested it it works. you need to place a unit on the map named m1
« Last Edit: 06 Sep 2010, 09:54:47 by ZapBrannigan »

Offline DurbanPoison

  • Members
  • *
Re: changing what your weapon fires?
« Reply #6 on: 10 Sep 2010, 03:39:43 »
"Brannigan's Law is like Brannigan's love, hard and fast."

...you nailed it Zap - thanks man!  :clap:

This is why i am forever wandering the halls of ofpec... cause out of the blue someone will answer you insence chanted prayers!

Only thing i noticed... the chicken.... or cock as you so cruedly put it... seems to appear and pause for a split second before flying off to kill who and whatever. Is there a way to have it not pause  like that?

Don't get me wrong... your script nailed what i wanted... just curious as to if the pause can be avoided. If not it's no bid deal... not like it takes away from the realism or anything LOL!  ;)

either way...  question is **SOLVED!**