Jump to content

Exiting Power Armor Event


Recommended Posts

 

 

So there is no esp around that scales the PC upon entering and exiting a PA?

 

I could really use one.

 

Player scaling when using power armor is built into the entry and exit animations.

 

Ahh, that's awesome.

So how do I change then scales when entering and exiting?

 

 

Make a new animation. You've noticed that when an actor enters power armor their whole body gets stretched like this, right?

 

aeFg5Z0uGLO2DzU1xw7cbZFi3zWlGDKkEKYqk678

Link to comment
Share on other sites

That's a bit much for what he's asking. He literally means a set of scripts that use Game.GetPlayer().SetScale(1.15) and SetScale(1.0) upon entering and exiting it. I did actually write a set of scripts that do this, although they're highly intertwined with a lot of other scripts. I'll try to come back and post just the parts necessary when I have more time to explain how to implement them. It's actually pretty simple.

Edited by ZerasCETA
Link to comment
Share on other sites

That's a bit much for what he's asking. He literally means a set of scripts that use Game.GetPlayer().SetScale(1.15) and SetScale(1.0) upon entering and exiting it. I did actually write a set of scripts that do this, although they're highly intertwined with a lot of other scripts. I'll try to come back and post just the parts necessary when I have more time to explain how to implement them. It's actually pretty simple.

Wow, That's awesome!

 

I hope you get back with the script or esp! :)

Link to comment
Share on other sites

Well, again, for my purposes I did it with the script attached to the frame.

 

 

 

I'm trying to configure a script so that it fires when you exit power armor. I checked all the native "OnEvent" options, and none of them seemed to be what was needed. Which means I need to create my own event for this? If I am wrong, can someone please clarify for me, and if I'm not, I would greatly appreciate some help with event creation, as I'm not sure how to go about doing that.

 

Power armor is a sitting furniture. The Actor event you should use is OnGetUp().

 

Example (in a script extending Actor, placed on a player alias):

Event OnGetUp(ObjectReference akFurniture)
    if akFurniture.HasKeyword(FurnitureTypePowerArmor)
        ; do your stuff here
    endif
EndEvent

You're welcome :smile:

 


This, should work to convert it to a constant script running on the player but I can't guarantee that as I haven't actually done it this way. Still, no reason it shouldn't work.


 

Edited by ZerasCETA
Link to comment
Share on other sites

  • 3 weeks later...

Hi guys,
OK, I have some trouble here as well. I'm trying to make a mod with huge sword for PA only. What I've done so far is when you try to equip that weapon when you're not in PA then that item is automatically unequipped. You just not allowed to do this. When you are in PA you can equip that weapon and draw it. But the problem shows up when you exiting PA. Then a weapon is holstered but still equipped. I have no idea how I can implement the script which will activate PA exit event and unequip that weapon.
Here is my script:

Scriptname woyosensei_PA_weapon extends ObjectReference Const


Weapon Property PA_weapon Auto Const
Keyword Property PA_check Auto Const




Event OnEquipped(Actor akActor)
if akActor == Game.GetPlayer()
Debug.Trace("We were equipped by the player!")
if (Game.GetPlayer().IsInPowerArmor())
Debug.Trace("The player is in Power Armor")
; Force the player to equip the tutu - but they can remove it
Game.GetPlayer().EquipItem(PA_weapon)
Else
Debug.Trace("The player is NOT in Power Armor")
; Force the player to unequip the tutu - but they can equip it
Game.GetPlayer().UnequipItem(PA_weapon)
endIf
endIf
endEvent


Event OnGetUp(ObjectReference akFurniture)
    if akFurniture.HasKeyword(PA_check)
       if (Game.GetPlayer().IsEquipped(PA_weapon))
          Debug.Trace("The player has the uber sword equipped")
          Game.GetPlayer().UnequipItem(PA_weapon)
       endIf
    endif
EndEvent
When I'm trying to compile I'm getting an error:
" new event ongetup cannot be defined because the script is not flagged as native"

Does anyone knows how to solve it? All I need is unequip that weapon when player will exit PA.

Thank you in advance for any help.

Edited by woyosensei
Link to comment
Share on other sites

I'm just guessing here but OnGetUp is an actor event?

 

Again, I'm guessing here but maybe you can do this:

Event OnInit()
RegisterForRemoteEvent(PlayerRef, "OnGetUp")

EndEvent

Event Actor.OnGetUp(Actor theActor, ObjectReference akFurniture)
    if(akFurniture.HasKeyword(PA_check))
     ;do stuff
    endIf
EndEvent

Actor Property PlayerRef Auto Const

I have not tried it, so if you try it, please report back. I have only done similiar things with quest stages.

 

Edit: Seems to work but only when you enter PA, not when you exit it.

Edited by vkz89q
Link to comment
Share on other sites

I'm just guessing here but OnGetUp is an actor event?

 

Again, I'm guessing here but maybe you can do this:

Event OnInit()
RegisterForRemoteEvent(PlayerRef, "OnGetUp")

EndEvent

Event Actor.OnGetUp(Actor theActor, ObjectReference akFurniture)
    if(akFurniture.HasKeyword(PA_check))
     ;do stuff
    endIf
EndEvent

Actor Property PlayerRef Auto Const

I have not tried it, so if you try it, please report back. I have only done similiar things with quest stages.

 

Edit: Seems to work but only when you enter PA, not when you exit it.

 

Unfortunately it doesn't work. What about that second function: OnExitFurniture - ObjectReference? This one seems to be specific for exit PA (or anything else connected to that). I'll try it in a second when I get back home.

 

EDIT: I can't get this one to work... Really, I have no idea what else I can do to solve it. Please, anyone? Help? :)

Edited by woyosensei
Link to comment
Share on other sites

Okay, I got this one to work: (it's on quest, but should work on other places too). Look at the If statements and WornHasKeyword.

Scriptname EnterExitPAScript extends Quest

Event OnInit()
RegisterForRemoteEvent(PlayerRef, "OnSit")
EndEvent


Event Actor.OnSit(Actor theActor, ObjectReference akFurniture)
	Utility.Wait(0.05)
    if(akFurniture.HasKeyword(FurnitureTypePowerArmor) && theActor.WornHasKeyword(isPowerArmorFrame)) ; Enter PA
		Debug.Notification("entered a PA")
		Debug.Trace("enter PA")
     elseif(akFurniture.HasKeyword(FurnitureTypePowerArmor) && !theActor.WornHasKeyword(isPowerArmorFrame)) ; Exit PA
		Debug.Notification("we exited pa lol")
		Debug.Trace("exit PA")
    endIf
EndEvent

Actor Property PlayerRef Auto Const
Keyword Property IsPowerArmorFrame Auto Const
Keyword Property FurnitureTypePowerArmor Auto Const

For some reason debug.notification gets out of synch, but debug.trace shows it works.. I enter/exited 10 different PA's and all fired both events. Use at your own risk, no idea if it works 100% of the time. OnSit() seems to fire when you enter or exit PA.

 

With WornHasKeyword we can check if we have PA or not after we fired "OnSit".

Edited by vkz89q
Link to comment
Share on other sites

Compile was successful, but it still doesn't work when I place it as part of weapon script. At the moment it looks like this:

 

Scriptname woyosensei_PA_weapon extends ObjectReference Const


Weapon Property PA_weapon Auto Const
Keyword Property PA_check Auto Const




Event OnEquipped(Actor akActor)
if akActor == Game.GetPlayer()
Debug.Trace("We were equipped by the player!")
if (Game.GetPlayer().IsInPowerArmor())
Debug.Trace("The player is in Power Armor")
; Force the player to equip the tutu - but they can remove it
Game.GetPlayer().EquipItem(PA_weapon)
Else
Debug.Trace("The player is NOT in Power Armor")
; Force the player to unequip the tutu - but they can equip it
Game.GetPlayer().UnequipItem(PA_weapon)
endIf
endIf
endEvent


Event OnInit()
RegisterForRemoteEvent(PlayerRef, "OnSit")
EndEvent




Event Actor.OnSit(Actor theActor, ObjectReference akFurniture)
Utility.Wait(0.05)
    if(akFurniture.HasKeyword(FurnitureTypePowerArmor) && theActor.WornHasKeyword(isPowerArmorFrame)) ; Enter PA
Debug.Notification("entered a PA")
Debug.Trace("enter PA")
     elseif(akFurniture.HasKeyword(FurnitureTypePowerArmor) && !theActor.WornHasKeyword(isPowerArmorFrame)) ; Exit PA
Debug.Notification("we exited pa lol")
Debug.Trace("exit PA")
    endIf
EndEvent


Actor Property PlayerRef Auto Const
Keyword Property IsPowerArmorFrame Auto Const
Keyword Property FurnitureTypePowerArmor Auto Const

and yet is not working. It doesn't matter if I equip that weapon or not. I checked the logs and they're empty for that second part as well. My part of the script is working just fine, but that was pretty easy even for a noob like me :P The second feature (unequip if leaving PA) is like a hell... Maybe there is other solution? I don't know, make something like universal script for PA or something like empty quest or something?

Link to comment
Share on other sites

Well, I just made copy of Alien blaster, put this on it(after couple tweaks) and it works perfectly:

Scriptname ThisWeaponCanOnlyBeUsedInPAscript extends ObjectReference Const

Weapon Property PA_weapon Auto Const
Actor Property PlayerRef Auto Const
Keyword Property IsPowerArmorFrame Auto Const
Keyword Property FurnitureTypePowerArmor Auto Const

Event OnEquipped(Actor akActor)
if akActor == PlayerRef
    Debug.Trace("We were equipped by the player!")
        if PlayerRef.WornHasKeyword(isPowerArmorFrame)
            Debug.Trace("The player is in Power Armor")
            ; Force the player to equip the tutu - but they can remove it
            PlayerRef.EquipItem(PA_weapon) ; <--- this doesn't make much sense to me? equip weapon while it's already equipped? ; do you want it to auto draw when in pa? If so, check the script PA part
        Else
            Debug.Trace("The player is NOT in Power Armor")
            ; Force the player to unequip the tutu - but they can equip it
            PlayerRef.UnequipItem(PA_weapon)
endIf
endIf
endEvent

Event OnInit()
RegisterForRemoteEvent(PlayerRef, "OnSit")
EndEvent

Event Actor.OnSit(Actor theActor, ObjectReference akFurniture)
Utility.Wait(0.05)
    if(akFurniture.HasKeyword(FurnitureTypePowerArmor) && PlayerRef.WornHasKeyword(isPowerArmorFrame)) ; Enter PA
        Debug.Notification("entered a PA")
        Debug.Trace("enter PA TEST")
            if(PlayerRef.GetItemCount(Pa_weapon) > 0) ; here we can auto draw the weapon if we want
                PlayerRef.EquipItem(PA_weapon)
                PlayerRef.DrawWeapon()
            endIf
     elseif(akFurniture.HasKeyword(FurnitureTypePowerArmor) && !PlayerRef.WornHasKeyword(isPowerArmorFrame)) ; Exit PA
        Debug.Notification("we exited pa lol")
        Debug.Trace("exit PA TEST TO MAKE SURE THIS SHOWS ON TRACE")
        if(PlayerRef.IsEquipped(PA_weapon))
            PlayerRef.UnEquipItem(Pa_weapon) ; we NEED to unequip it here, because exiting pa does NOT unequip weapon, just holsters it, so it's still usable if we dont do this
        endIf
    endIf
EndEvent

You might have old script running on your weapon? Might need a clean save or something. With this script the weapon is usable in PA only and it unequips the moment I step out of PA.

 

For some reason I don't see sometimes ANY debug.notifications but trace shows it works. Make sure your properties are filled too. I commented your script a bit too.

 

You can make this work on quest script or reference alias too, just use actor events instead(OnItemEquipped).

 

Edited by vkz89q
Link to comment
Share on other sites

  • Recently Browsing   0 members

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