Jump to content

Script for Player Knockback


highlander31527

Recommended Posts

I have a mod that I am working on to build the Noisy Cricket from MIB. It's a joke weapon that does a cricket noise when you pull it up and acts like the one in the movie. I am having difficulty with the script as I have tried several forms of the deathclaw knockdown or bighorner knockback script, rewritten with the player being the target of the knockback part, but none are working. geck will let me save them as viable scripts sometimes, but it does not like my wording. Sample:

 

scn NCknockback

 

ref myself

 

begin scripteffectstart

 

set myself to getself

player.pushactoraway myself 1000

 

end

 

It accepts this, but this knocks them away, not me. This one:

 

scn NCknockback

 

ref mytarget

 

begin scripteffectstart

 

set mytarget to gettarget

actor.pushplayeraway mytarget 1000

 

end

 

It does not accept this script at all.

Changing the variable ref myself to ref mytarget or ref actor does not help.

I have just been making educated guesses at the second line actor.pushplayeraway.

It seems as if there is a way to do this, but my brain is not letting me figure it out.

 

 

Any ideas what I am doing wrong?

 

 

 

 

 

Link to comment
Share on other sites

This one:

 

scn NCknockback

 

ref mytarget

 

begin scripteffectstart

 

set mytarget to gettarget

actor.pushplayeraway mytarget 1000

 

end

 

It does not accept this script at all.

It seems you didn't define the variable "actor". I don't think the function "gettarget" exists either.

 

I recommend getting The GECK 1.4 PowerUp - it's a nice GECK upgrade that will show you the scripting errors when it doesn't save the script.

Link to comment
Share on other sites

I don't think there's a way to do it besides scripting, so better scripting tools would come in handy. :smile:

It seems what you are looking for is the onFire event, which you need to put in a script attached to your gun.

I imagine the code would look something like this:

scn GunScript

ref rTarget
begin onFire
    set rTarget to GetCrosshairRef
    rTarget.PushActorAway player 1000
end

Note that GetCrosshairRef is a function added by NVSE, so you'll need NVSE for the function to work.

If you would prefer to do it with vanilla functions, you could use a combination of GetPos, GetAngle, SetPos, SetAngle and math functions. This mod has the code that does that.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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