Jump to content

Recommended Posts

Posted (edited)

Hello, i try player to be equipped with another item when player draws any weapon and main item is equipped. here is my script

Scriptname aaaBaseAspectRingScript extends ObjectReference  

Armor Property RingPower  Auto  

Event OnEquipped(Actor akActor)
   if akActor == Game.GetPlayer()
	if (Game.Getplayer().IsWeaponDrawn()  == true)
          Debug.MessageBox("Player equip weapon")
	  Game.GetPlayer().EquipItem(RingPower)
	elseif (Game.Getplayer().IsWeaponDrawn()  == false)
	  Game.GetPlayer().UnEquipItem(RingPower)
        endif
   endif
endEvent

but I think IsWeaponDrawn isn't working any ideas what's the problem?

Edited by shavkacagarikia
Posted

Think the issue is the event On equip only firing before the player has chance to draw the weapon. Try a different event such as an update loop or on a registered animation event

Posted

register for update isn't working inside onequipped event, because it's member function or something like that, and i haven't heard about animation events can you give me more hints about them?

Posted

I take it this script is on the weapon in question.

Just guessing here on this code ... but it should be right.

 

Scriptname aaaBaseAspectRingScript extends ObjectReference
Armor Property RingPower Auto
Event OnEquipped(Actor akActor)
Game.GetPlayer().EquipItem(RingPower)
endEvent
Event OnUnEquipped(Actor akActor)
Game.GetPlayer().UnEquipItem(RingPower)
endEvent
Posted
  On 7/19/2016 at 11:30 PM, NexusComa said:

 

I take it this script is on the weapon in question.

Just guessing here on this code ... but it should be right.

 

 

Scriptname aaaBaseAspectRingScript extends ObjectReference
Armor Property RingPower Auto
Event OnEquipped(Actor akActor)
Game.GetPlayer().EquipItem(RingPower)
endEvent
Event OnUnEquipped(Actor akActor)
Game.GetPlayer().UnEquipItem(RingPower)
endEvent

 

no i want the item to be equipped when the weapon is out, not equipped, and no this script is on another ring, when you have it equipped and draw any weapon another ring should be equipped on player

Posted (edited)

Guess #2 ... True = -1 to a code, you're looking for a 1 or not a 1

 

Scriptname aaaBaseAspectRingScript extends ObjectReference
Armor Property RingPower Auto
Event OnEquipped(Actor akActor)
if akActor == Game.GetPlayer()
if (Game.Getplayer().IsWeaponDrawn() == 1)
Debug.MessageBox("Player equip weapon")
Game.GetPlayer().EquipItem(RingPower)
elseif (Game.Getplayer().IsWeaponDrawn() != 1)
Game.GetPlayer().UnEquipItem(RingPower)
endif
endif
endEvent
Wait I can see a problem already it will continuously keep putting the ring away or on like this ... you just want it to do that once so ... 1 second
Edited by NexusComa
Posted

that works when i already have weapon equipped and then equip the ring, but i want to somehow check everytime when player equips the weapon

Posted (edited)

Guess #3 ... not sure how to test for "item is equipped" without a huge loop so this will do.

 

Scriptname aaaBaseAspectRingScript extends ObjectReference
Armor Property RingPower Auto
int RingState = 0
Event OnEquipped(Actor akActor)
if akActor == Game.GetPlayer()
if (Game.Getplayer().IsWeaponDrawn() == 1)
if(RingState == 0)
Game.GetPlayer().EquipItem(RingPower)
RingState = 1
endif
elseif (Game.Getplayer().IsWeaponDrawn() != 1)
if(RingState == 1)
Game.GetPlayer().UnEquipItem(RingPower)
RingState = 0
endif
endif
endif
endEvent
Event OnUnEquipped(Actor akActor)
Game.GetPlayer().UnEquipItem(RingPower)
RingState = 0
endEvent
Edited by NexusComa
Posted (edited)

I think my problem here is the Event OnEquipped(Actor akActor)

Only triggers one time as you equip the item. Without going to the kit and building this I am just guessing ...

Edited by NexusComa
  • Recently Browsing   0 members

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