Jump to content

Draw weapon - issue with script


SAC

Recommended Posts

So, I am trying to script a mod where you select two actors, they assume a position, then actor A executes actor B point blank.

TargetaWeapon = targeta.GetEquippedWeapon()
targetb.removefromallfactions()
targetb.setprotected(false)
targetb.playidle(wpnidle2)
targeta.setrestrained(false)
targeta.drawweapon()
utility.wait(0.2)
targeta.setrestrained(true)
targeta.playidle(wpnidle1)
utility.wait(5)
TargetaWeapon.fire(targeta, fireammo)
targetb.kill()
instanceID = gunshot.Play(targetb)
target.ApplyHavokImpulse(0, 1, 0, 50)

All good and well, but actor A never equips any weapon. He just assumes a position according to the passed idle, then the execution is about playing a sound and killing actor B via script. I don't know what I'm doing wrong, but I need to make actor A draw a weapon somehow.

 

Thanks!

post-1591796-0-84479600-1498407825_thumb.png

Link to comment

Probably TargetWeapon is empty.

 

I case it is empty just add a weapon of your choice to the target actor, and then equip it

 

 

 

 
if !TargetWeapon
    TargetWeapon = aDefaultRifle
    targeta.addItem(TargetWeapon, 1)
endIf

 

 

 

Small advice on the names. Don't call them targeta and targetb. Very easy to confuse each other.

Call them something like "executioner" and "victim"

 

Link to comment

When we draw a weapon ingame, we press the mouse button.

  This is a trigger to draw the weapon only.

This means the script to draw a weapon already exists.

It should be a simple matter to modify said script to be a call function when the the killer is selected that he or she automatically draws their weapon.

 Then to end the script, the command for actor A to fire weapon (maybe aim first?)

 

Link to comment

Why not do a scene with a travel package with "Weapon Drawn" ticked?

 

LOL, I've got no idea whatsoever how to do that, but it's not a static scene. The idea is for the player to pick any two actors in game, and have one of them execute the other, a la "2-target sex gun". I am butchering Leito's (actually Crazy's) positioning script to set the actors in place, and shoot the gun. Make war, not love, essentially. And it works, it's just the executioner fires his (lethal) finger, instead of his gun...

When we draw a weapon ingame, we press the mouse button.

  This is a trigger to draw the weapon only.

This means the script to draw a weapon already exists.

It should be a simple matter to modify said script to be a call function when the the killer is selected that he or she automatically draws their weapon.

 Then to end the script, the command for actor A to fire weapon (maybe aim first?)

 

That may be so, but I just have no idea what script (or whatever else) LMB triggers in game, so I can call it.

Probably TargetWeapon is empty.

 

I case it is empty just add a weapon of your choice to the target actor, and then equip it

 
if !TargetWeapon
    TargetWeapon = aDefaultRifle
    targeta.addItem(TargetWeapon, 1)
endIf

Small advice on the names. Don't call them targeta and targetb. Very easy to confuse each other.

Call them something like "executioner" and "victim"

 

Already did that, additem / equipitem. No joy :(

 

Thanks for the suggestion about naming, sounds about right

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use