Jump to content

I am very pleased to announce I got my sniper script working :-)q


irswat

Recommended Posts

thanks to JIP, Mr. Patterson, Alien, and luthienanarion for helping me on the script! You will get credit as due when the mod is released!

Here is the script that worked. The Snipers fire at play from as far away as I can see them :-) quite a challenge. Now its time to figure out how to make prone snipers :-D

scn OldSniperModScriptWithTimer

float hfPlayer
int AlertFlag
ref rSniper
float WeapMaxRange
float timer

begin GameMode

        set timer to 0

        if player.IsInInterior == 0
            if(timer < 1)
                set timer to timer + getsecondspassed
                return
            else
                set AlertFlag to 0
                set WeapMaxRange to GetMaxRange WeapNVGhillieSniperRifle
                set rSniper to GetSelf
                set hfPlayer to player.GetDistance rSniper
        
                if GetDead
                    MessageEX "Sniper %i is dead" rSniper
                    set AlertFlag to 0
                    return
                elseif player.GetDead
                    set AlertFlag to 0
                    return
                elseif ((GetDead == 0) && (player.GetDead == 0))
                    if hfPlayer <= WeapMaxRange
                        MessageEX "Sniper is %g units away" hfPlayer
                        set AlertFlag to 1
                    elseif hfPlayer > WeapMaxRange
                        MessageEX "Sniper is out of range by %g units" (hfPlayer-WeapMaxRange)
                        set AlertFlag to 0
                    endif
                endif
            
                if AlertFlag
                    rSniper.UseWeapon WeapNVGhillieSniperRifle rSniper player -1 0 0 1 0  
                elseif GetDetected player
                    StartCombat player
                endif
                if player.GetDead
                    set AlertFlag to 0
                    return
                endif
            endif
      endif

return
end

Edited by irswat
Link to comment
Share on other sites

it's not quite as good as the news of salvation through the death and resurrection of Jesus Christ: that God loves us so much that He sent His Son who knew no sin to take the curse of sin upon Himself so we could be set free from sin and death! If we turn away from sin and follow Him we can be forgiven and share in the hope of being raised from the dead to eternal life!

I had to :-) You set me up

As far as the infinitely more trivial matter of the mod, I work on it with much of my free time. I'm putting the finishing touches on the script now messing around with creating detection events. It's the strangest thing. These snipers don't react right away from 11000 units, but if I get there attention and retreat they keep sniping at me from as far as I can see them through the sniper scope! I'm hoping I can use this create detection event function to make them initially react from as far away as 11000 units.

Any idea how I would approach making prone snipers? Are there commands I can issue NPC's for different stances? E.g. sometimes they take a knee and start shooting. How can I make them do that?

Edited by irswat
Link to comment
Share on other sites

nice sent me a copy ... not sure if you can do prone since it isn't one of the defaults might have to get it from a pose or something

there has to be a way. If NPC's can kneel and fire, or crouch and fire, which I'm pretty sure I've seen, it's got to be possible to get them to prone. I'm looking into it

Link to comment
Share on other sites

it's not quite as good as the news of salvation through the death and resurrection of Jesus Christ:

 

snipers for Christ? Can't say I have any supernatural beliefs (that I'm aware of), but to each their own.

 

Are there commands I can issue NPC's for different stances? E.g. sometimes they take a knee and start shooting. How can I make them do that?

Yes there are, playGroup will allow you to, but alas we have no prone animations and until someone does the KF for them you wonn't be able to implement them :sad:

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...