Results 1 to 8 of 8

Thread: Random gear on men

  1. #1

    Random gear on men

    Hello

    I am trying to make a small COOP mission on klurs island for the purposes of slaughtering the undead, however, i have run into a couple small problems that have got me hung up. i hope some of you guys can help me out.

    as i note I have NO programming abilities, the extent of my knowledge is adding variables and tweaking things, which i figured out fro a little trial and error

    As a base i am using a lot of scripts out of the QUARANTINE mission (thanks to whom ever made that mission)

    hang up number one:
    i have tweaked the boxArm.sqs from Q to get rid of the random placement in buildings. the script works fine for the ammo boxes however i would like to extend that functionality to people, specifically the zombies (add random bits of gear). this is what the script looks like:

    ? !isServer: exit
    ~random 30
    _Weapons=(left out to save space)
    _ammo=(left out to save space)
    _box=_this select 0
    _stagtime=boxarmtime
    boxarmtime=boxarmtime+10
    #start
    ~0.5

    ~_stagtime
    _box setdir random 360;
    _ranselect= round random 9
    ~1
    randomam= _ammo select _ranselect
    randomwep=_Weapons select _ranselect
    _box addmagazinecargo [randomam,random 4];box addweaponcargo [randomwep,1];
    box=_box
    publicVariable "box"
    publicVariable "randomam"
    publicVariable "randomwep"
    exit

    i have tried removing the lines related to weapons (as i dont want the Z to have them), but no gear spawns. do i have to rename the variable from "box" to "man" or something?

    also having to do with the above script, i would like to drastically lower the probability of a weapon spawning in the crates. i changed the [randomwep] from 1 to .5, but that seemed to stop weapons from spawning at all (or it wrk WAY to well)

    another problem i am having is with syntax. i am also using the FLARERED (medkits) scripts from Q
    i add: this addaction [""Use Medkit"",""healaction.sqs""] to the player units but i get an error. i copied this directly from the mission.sqm from Q so i am not sure what is missing. arma tells me i am missing a "]" . i have tryed moving some stuff around, and adding things like "exec" but nothing is catching

    my final hurtle is not such a big problem (haven't even reached this stage yet). its more of a future question
    for the mission players will be stranded in the north of klurs with out a map (ACE). they need to find one so that they can return to safety in the south (they find it on a Z or in a crate somewhere).
    i want the mission to update once they have found the map. the editing guide does not exactly say how to go about doing this. at least not directly enough for me to figure it out

    thanks for your help

  2. #2
    _box addmagazinecargo [randomam,random 4];box addweaponcargo [randomwep,1];
    to
    _box addmagazine randomam;_box addmagazine randomam;_box addmagazine randomam;_box addmagazine randomam;_box addweapon randomwep

    These lines are useless imho.
    box=_box
    publicVariable "box"
    publicVariable "randomam"
    publicVariable "randomwep"

    Make the double quotes single in the command you have trouble with, they're used as such only when they are inside another quote.


    About the map: showMap true
    Last edited by Celery; May 10 2009 at 07:52.

  3. #3
    well i dont really know what those lines are needed for (they look important to me)
    the reason i was not doing the addmag addweap was to give more variability and randomness

    the script randomly takes one of the item listed in the _Weapons= and _ammo= and give a box between 0 and 4 magazines and 0 and 1 weapons each time the mission starts

    maybe i did not make that too apparent my first post, sorry
    Quote Originally Posted by MadDogX View Post
    "Gentlemen, you can't have useless discussions here! This is the internet!"

  4. #4
    Quote Originally Posted by That guy View Post
    well i dont really know what those lines are needed for (they look important to me)
    the reason i was not doing the addmag addweap was to give more variability and randomness

    the script randomly takes one of the item listed in the _Weapons= and _ammo= and give a box between 0 and 4 magazines and 0 and 1 weapons each time the mission starts

    maybe i did not make that too apparent my first post, sorry
    I'm pretty sure that the [randomam,random 4] array doesn't work outside the cargo variant and you can't give stuff to people using the cargo command. If you absolutely need random 4 mags, here's the script to put right above the addweapon line:

    _loop=0
    _mags=ceil random 4
    #magloop
    ?_loop>=_mags:goto "magend"
    _box addmagazine randomam;_loop=_loop+1
    goto "magloop"
    #magend

    By using ceil random 4 there will always be at least one mag for the guy but if you don't like that idea, replace ceil with round.

  5. #5
    thanks celery. now i just need to figure out what you meant by "above the addweapon line".

    like i said i am not a coder.
    i am guessing i have to add this script into the one i already posted? its not a tottaly new script right?
    thanks

  6. #6
    ? !isServer: exit
    _Weapons=(left out to save space)
    _ammo=(left out to save space)
    _box=_this select 0

    _ranselect= round random 9
    _randomam= _ammo select _ranselect
    _randomwep=_Weapons select _ranselect

    _loop=0
    _mags=ceil random 4
    #magloop
    ?_loop>=_mags:goto "magend"
    _box addmagazine _randomam;_loop=_loop+1
    goto "magloop"
    #magend

    _box addweapon _randomwep
    exit

  7. #7
    thank you very much Celery! it works well!

    now i just need to get; __this addaction [""Use Medkit"",""healaction.sqs""]
    to work and i am golden

  8. #8
    Quote Originally Posted by That guy View Post
    thank you very much Celery! it works well!

    now i just need to get; __this addaction [""Use Medkit"",""healaction.sqs""]
    to work and i am golden
    this addaction ["Use Medkit","healaction.sqs"]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •