Results 1 to 8 of 8

Thread: 1st time script attempt

  1. #1
    Private First Class
    Join Date
    Mar 17 2007
    Location
    Pennsylvania
    Posts
    20
    greetings all

    i am trying to do my first solo script, and its not going to well. i have been using this forum and the command reference to help but i still cant get my AI units to do what i want

    i want solo AI units to stand up in a trench for a given time fire then lay back down. they will fire when standing in the trench, but not to the effect i want

    here is my script so far

    _unit = _this Select 0


    #start
    dostop _unit
    _unit SetUnitPos "up"
    _unit setCombatMode "blue"
    _unit switchmove "CombatToLying"
    ~20.0
    _unit switchmove "LyingToCombat"
    _unit SetUnitPos "up"
    _unit Fire [PGM_k98aB,PGM_maumag,PGM_maumag,PGM_maumag,PGM_mau mag,PGM_maumag,PGM_maumag,PGM_maumag,PG
    M_maumag,PGM_maumag,PGM_maumag]
    ~20.0
    ? (Alive _unit):Exit
    goto "start"

    they just lay in the trench now, i want the "whack a mole" effect as your team is running toward the trench

    any help would be great

    Mak
    STAND TALL BEFORE THE MAN

  2. #2
    Hi mak90_2000, nice to see that your script is for the WW1 mod.

    I wouldn't use the "fire" command, but i'd cancel the combatmode "blue" using a "combatmode "green" (don't fire until someone in the group is fired at) or yellow (open fire)

    I'd use :
    the dostop command as you do, but as this command is cancelled when the group is fleeing, you should add the "allowfleeing 0" command :
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{dostop _x;_x allowfleeing 0;_x disableai &#34;target&#34;} foreach units group _unit[/QUOTE]

    The "disableai "target"" command avoids the squad leader to order any attack to its units. So the units chose themselves targets.

    You don&#39;t need to use the switchmove command, just use the "setunitpos "up"" one to make them get up and the "setunitpos "down"" to make them crouch, along with the "combatmode" change.

  3. #3
    Private First Class
    Join Date
    Mar 17 2007
    Location
    Pennsylvania
    Posts
    20
    Author of the Thread
    yeah I like the mod, except for the ***NO ENTRY &#39;.MODELSPECIAL&#39;. error I get on the start of the missions.

    I give up on this script, ***all they want to do is lay in the trench, I even ungrouped the men and made each one launch the script, I even raised their inelegance level. ***

    now i get an error on the _unit= this select 0 ***line


    _unit = _this Select 0

    #start
    {dostop _x;_x allowfleeing 0;_x disableai "target"} foreach units group _unit
    _unit SetUnitPos "up"
    _unit setCombatMode "red"
    _unit Fire,PGM_maumag,PGM_maumag,PGM_maumag,PGM_maumag,P GM_maumag,PGM_maumag,PGM_maumag,PGM_mau
    mag,P
    GM_maumag,PGM_maumag]
    ~20.0
    _unit SetUnitPos "down"
    ~15
    ? (Alive _unit):Exit
    goto "start"


    I think they are just lazy or they are cowards&#33; muahahaha ***j/k

    I will keep searching the forums see if anyone made a "pop up" script I can use

    i am just not cut out to make scripts, every several years i need to at least try









  4. #4
    Quote Originally Posted by [b
    Quote[/b] ]yeah I like the mod, except for the ***NO ENTRY &#39;.MODELSPECIAL&#39;. error I get on the start of the missions.
    Mmm, it&#39;s not because of my mod because i&#39;m not using any "modelspecial" in the mod (modelspecial refers to some kinds of weapons, like mortars where the projectile is visible before firing).

    Try the following script, place groups in the trenches but place the units where you want them to be (edit units before, and in the "special" area select "none" so that they won&#39;t be in formation at the beginning).

    Launch the script by writing the following in the squad leader init area :
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{&#91;_x&#93; exec &#34;name_of_the_script.sqs&#34;} foreach units group this[/QUOTE]

    The script could be :

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this Select 0

    _unit allowfleeing 0
    _unit disableai &#34;target&#34;

    #start
    dostop _unit
    _unit SetUnitPos &#34;up&#34;
    _unit setCombatMode &#34;yellow&#34;

    ~20.0
    _unit SetUnitPos &#34;down&#34;
    _unit setCombatMode &#34;blue&#34;
    ~15
    ? &#40;Alive _unit&#41;&#58;goto &#34;start&#34;
    exit
    [/QUOTE]

  5. #5
    Private First Class
    Join Date
    Mar 17 2007
    Location
    Pennsylvania
    Posts
    20
    Author of the Thread
    i&#39;m trying to understand what is different from the script you have here, to the one i made. yours works&#33; i want to be able to do scripts but i cant understand where i went wrong

    anyhow, great effect tho. need to spread them out a bit more, adjust the time to fire, and i think it will work good

    thank you my good man, for the help


  6. #6
    Your script has this command executing twice when I&#39;m not sure it&#39;s needed:

    _unit SetUnitPos "up"

    Your script also is instructed to exit when the unit is still alive:

    ? (Alive _unit):Exit

    Is this what you want?

  7. #7
    Private First Class
    Join Date
    Mar 17 2007
    Location
    Pennsylvania
    Posts
    20
    Author of the Thread
    no i had put the ? (Alive _unit):Exit in to check if the unit was still alive

    ProfTournesol helped me with this and i now have the effect i want.

    i was just trying to understand how he made his work and mine failed.

    thanks tho

  8. #8
    Another thing that had sorta this effect was with an animation.

    Every time a unit reloaded they would crouch then reload then get back up and fire, since in the ww1 mod they use bolt rifles, they reload after each shot, so it had that whack a mole effect, together with dostop command they effectively gave the trenches a realistic vibe.

    It sucks that there is no crouch command, since going from standing to prone is quite awkward for the units depending on which trench model you are using or how they are set up.

Posting Permissions

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