Home   Help Search Login Register  

Author Topic: Random Weaponry  (Read 1799 times)

0 Members and 1 Guest are viewing this topic.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Random Weaponry
« on: 04 Dec 2003, 13:46:19 »
Ok, this'll be a long post but try to bear with me...  ;D


I'll lay down the history (so to speak) behind this problem I'm having....

I'm currently making a mission in which you are a leader of a small sabotage team (sounds dull already  :D) behind NME lines an a ( oh my god...  :P) mission to destroy the NME weapons cache or something (please, not again...  :-* )...
Well the trick in this mission is that it actually starts after the main objectives have been failed and everything is FUBAR....  :o (well wow...)
You and your group (most died during the execution of the main objectives) are badly hurt, very low on ammo and on the run. Well it doesn't sound so magnificent right now, but there are a bunch of features that I'm not going to reveal until the mission is released (if ever...)

The problem I'm having is that I wan't the players group as well as all the NMEs to have a random amount of weapons and ammo based on their original weapon/ammo 'inventory'...

I've managed to have something happen when I made a mile long script which had to be 'manually' told the weapon/ammo varibs of the unit in question and that was only for the players group... But to do this in this way to all the NMEs  (about the group limit reached by now...) would propably kill my CPU  ::)  And it didn't even work so well...


So please all you OFP Gods, your help is sore arsely needed...  :moon:  :help:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Random Weaponry
« Reply #1 on: 04 Dec 2003, 14:19:19 »
Lets say you want the squad to consist of about 4 loons.     Create a squad of 12.   Give each loon a differnent weapon loadout and move his ammo and health bars to different points.   Then move the probability of presence field in the 11 AI loons to about 1/4.     This will give you the effect you want.    Use a similar trick for the enemy groups.    

If you want more variety than that create several groups in this way.  Give them join waypoints as their first WP, with the player's group having a join and lead.     Make the probabilities very low.  Experiment till you get what you want.   Even with probability you can't place more than 12 loons in one group in the editor.   However, if you use join waypoints the game is clever enough to make sure you never have more than 12 units created.   In this case thats not particularly important, since you will set the probabilites too low.

If you want to control whether an AI group appears or not give a probability of presence to the group leader and name him.   In the condition field of each of his loons write

alive leadername

and they will not be created at all unless the group leader is created.  

Use the placement radius field to randomise the starting positions of enemy groups.     There is a placement radius field in waypoints too.    
Plenty of reviewed ArmA missions for you to play

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Random Weaponry
« Reply #2 on: 04 Dec 2003, 15:31:10 »
Quote
Lets say you want the squad to consist of about 4 loons.    Create a squad of 12.  Give each loon a differnent weapon loadout and move his ammo and health bars to different points.  Then move the probability of presence field in the 11 AI loons to about 1/4.    This will give you the effect you want.    Use a similar trick for the enemy groups.

Hmm... Worth a try...
Wouldn't this however decrease the amount of NME units  ???
That could suck a bit  :(

Quote
If you want to control whether an AI group appears or not give a probability of presence to the group leader and name him.  
Use the placement radius field to randomise the starting positions of enemy groups. There is a placement radius field in waypoints too.

Yup, aware of these... I've been editing since OFP came out but have never been so pleased at my work to actually release anything  :P


The reason why I would like this random Weaponry (actually, a random AMMO would do the trick...) be done via scripting that it's my goal to make the mission varying from hard to extremely frustrating (dunno why, maybe I'm somewhat sadistic...  :D ); lot's of NME, low on ammo, and poorly available ammo 'harvest' from the dead...

But if this becomes overwhelmingly difficult I better go and try this trick...

thnx
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Random Weaponry
« Reply #3 on: 04 Dec 2003, 16:03:45 »
Assuming the attempt to get 4 from 11 will result in you having 3, 4 or 5, and that each of the 11 has a different loadout, that gives you 957 possible combinations.   In other words if you played the mission 450 times you would be unlikely to see the same combination of group members.     And of course if you tried it often enough you would eventually get all 11 present (easy mission, home in time for tea) or none at all (gulp).

That's just for one group of course.     If you do the same with say a dozen enemy groups, each with a 25% probability of presence, you're looking at tens of thousands of possible combinations.     Once you've created one satisfactory enemy group, just copy and paste.  There's no point in getting cute about groups the player isn't in.

Decreasing the probabilities will of course decrease the number of enemies, so you will have to increase the number of possible units to offset this.

You're right that playing with the ammo bar changes the ammo for all weapons types carried by that soldier - M16 ammo is correlated with LAW, say, which obviously you don't want.   To create random ammo try this.   Remove all ammo from your loons.    In your init.sqs:-

_rand = random 6
_num = _rand - (_rand mod 1)
 
_counter1=0
#loop1
_counter1=_counter1+1
?counter1>=_num: goto "nextBit"
"_x addmagazine {M16}" forEach [loon1, loon2, loon3]
goto"loop1"

#nextBit
similar with different weapons, ammo and/or soldiers.

Plenty of reviewed ArmA missions for you to play

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Random Weaponry
« Reply #4 on: 04 Dec 2003, 17:22:27 »
 ;D Wups... Some maths there.... Am I not seeing the forest from the trees, or something  :D

About that script...
I've got some experience with scripting BUT always when dealing with multiple arrays and such I get confused...

That code bit of yours works (done that earlier) but it has the advantage of creating gazillion tons of work as you have to code in 'manually' the mags in every unit (incl. the NME), so you'd have quite a few of these scripts in your mission folder (again, I might be understanding this wrong....).

What I'm now after is that you define a primaryMags array, a secondaryMags array and a handgunMag array.

Then do a comparison with the units loadout and the defined arrays, make note of it (what, how much...), then remove them from the units loadout, then with random amounts add back the mags to the unit so that he/her always has at least that one mag in the prim. weapon or in the possible handgun....

(If one likes to be pedantic, the weapons should be removed and then given back after the mags so there won't be that annoying reloading going on in the beginning of the mission, but that's just a minor thingy and can be ignored...)

I've tried to do this, but somehow I just can't get it to work  >:(

Maybe I'm just too stoopid or am I just thinking this all too complicatedly  ::)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Random Weaponry
« Reply #5 on: 04 Dec 2003, 17:38:12 »
Yeah, there is a bit of tedious work involved.    That's why I commend this probability method to you.    No scripts at all, nice and simple and highly effective at randomising the mission.
Plenty of reviewed ArmA missions for you to play

Grendel

  • Guest
Re:Random Weaponry
« Reply #6 on: 04 Dec 2003, 18:51:51 »
I can do something up if you want.  It would take 2 triggers some relatively small scripts and a function to call random elements from a few arrays.

IM me  if you want my help

-Grendel

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Random Weaponry
« Reply #7 on: 06 Dec 2003, 01:04:24 »
My keyboard suffered a Â'moisturísing momentÂ'and died  :D so I havenÂ't been able to reply... But now, with all new kb...

Quote
I can do something up if you want.  It would take 2 triggers some relatively small scripts and a function to call random elements from a few arrays.

That would be very nice...
( :-\ and could enlighten the idiot; what does IM actually mean  :-[ IÂ'm not so familiar with the Â'netÂ' [I AM old...  :P ] language since I do not do IRCs or chats and these kinda forums also are quite rare activity for me...)

But you can cook up something if you like... I may not be around so often now as I got my hands on Max Payne 2, H&D 2 and Call Of Duty (the only way to 'waste' tax refunds  :P ), so I might be tied up dodging bullets elsewhere for a few hours  ;D

Thnx
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Random Weaponry
« Reply #8 on: 06 Dec 2003, 01:46:45 »
IM = immediate message.   On many forums it's called PM - personal message.   Instead of posting on the forum you can send a private message to an individual.  It's a kind of forum-specific email.

Stuff that should go in IMs shouldn't go in a forum thread and vice versa.    To send an IM to somebody, click on the bit at the top right which says "Hey, you have 0 messages" or click on the name of the person you want to write to and folllow your nose.

Bad luck on the keyboard... hope it worked out ok.
Plenty of reviewed ArmA missions for you to play

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Random Weaponry
« Reply #9 on: 06 Dec 2003, 10:30:49 »
Thanks macguba....

Yup, everything is fine with the kb...  :)

I was actually suspecting that IM meant the same as PM but better safe than sorry...  ::)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Grendel

  • Guest
Re:Random Weaponry
« Reply #10 on: 24 Dec 2003, 01:45:24 »
Hey!

I am just about done with my script for random weapons/ammo.  If you want I can ranomize just about anything; faces, damage level etc.

-Grendel


Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Random Weaponry
« Reply #11 on: 25 Dec 2003, 21:44:37 »
Great...!!

Haven't been working with this thing since FDF Mod 1.1 came out  :P , though I've implemented a few of my (beta) features in the mission...

Just do what ever you like... After all, it's your script  ;)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.