Jump to content

Exiting Power Armor Event


Recommended Posts

Thanks! I'll check it as soon as I get back from work (late evening). About this part:

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

 

it just mean that when you try to equip that weapon it will be automatically unequipped so it's just a precaution to make sure that you're not gonna use that weapon outside of PA.

Link to comment
Share on other sites

Yes, but this part is doing it isn't it? Or am I missing something

 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)

I'm not sure you want to use EquipItem at all.. because what's gonna happen if player has 10 of those weapons? It's gonna try equip them all :D Atleast test it properly. It's propably not problem for weapons without mods when they are in same stack but what happens with modded weapons? Anyway, tested this and it only autodraws the weapon if player has 1 of them.

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 <-- I took this out because it doesn't really do anything
			;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?
		Else
			Debug.Trace("The player is NOT in Power Armor")
			; Force the player to unequip the tutu - but they can equip it <--- no they can't, unless they are in PA
			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) == 1) ; 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
Edited by vkz89q
Link to comment
Share on other sites

Yeah, I knew I forgot about something. Simple check if weapon is already equipped should do the job. Let me check your script on a fresh game. From what I see it should work perfectly.

EDIT: so I've checked that script and it doesn't work at all. I can equip my weapon easily, even without PA. And that was a new game, just a minute after I left the vault...

Edited by woyosensei
Link to comment
Share on other sites

How did you spawn your weapon? I spawned my test weapon with console.

 

1. Are you 100% sure all properties are filled? You opened properties window, pressed Auto-fill, checked everything is ok and hit ok?

2. You have this script on your weapon?

 

Try moving RegisterForRemoteEvent(PlayerRef, "OnSit") inside OnEquipped block, as first line and not inside any IF blocks. But if you can equip the weapon outside PA, sounds like the whole script isn't firing. I don't know, it works for me.

Edited by vkz89q
Link to comment
Share on other sites

How did you spawn your weapon? I spawned my test weapon with console.

 

1. Are you 100% sure all properties are filled? You opened properties window, pressed Auto-fill, checked everything is ok and hit ok?

2. You have this script on your weapon?

 

Try moving RegisterForRemoteEvent(PlayerRef, "OnSit") inside OnEquipped block, as first line and not inside any IF blocks. But if you can equip the weapon outside PA, sounds like the whole script isn't firing. I don't know, it works for me.

I'm so sorry. Please, accept my apologise. As I said in my previous post it seems that the script is working perfectly. And it is. It's really cool. I mean, wow :D

OK, I can show you what I'm working on. The First Tsurugi. 6 swords and one to rule them all :smile: You need to craft all 6 swords if you want to create this Big F*** Sword :D

Here's some screenshots:

http://i.imgur.com/w5YAYnZ.png

and full version:

http://i.imgur.com/ecmQrSy.png

That screen was made before I decided to limit this sword for PA only.

http://i.imgur.com/rUW1iVQ.png

 

and here's in PA:

http://i.imgur.com/GT5y3DR.png

 

Thank you very much again for help with this one. I promise it's going to be a great mod! :D

Edited by woyosensei
Link to comment
Share on other sites

That looks pretty good. Hopefully it's a good mod after all this scripting :pirate: . Just kidding, now I have "detect player when he exits/enters PA" script too. And who knows, it might stop working for x reason. Happened to me with many things I try do in CK, so don't be too happy yet :sleep:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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