Jump to content

[LE] Quick Questions, Quick Answers


Recommended Posts

1. Is there any way to detect how many arrows are stuck in an actor?

 

2. How does one check if a calculation returns an int and not a float?

2.

 

if ( Math.Floor(SomeValue) != SomeValue )
   ; Not a float
endif
Edited by B1gBadDaddy
Link to comment
Share on other sites

Thanks mate.

 

Why won't this work?

https://s7.postimg.cc/ee36uik23/weaponspeed.jpg

 

Edit:It doesn't work on bows but it works with other weapons. How do I get it to work on draw speed? BowSpeedBonus doesn't seem to work.

Just remembered the quick shot perk exists and I can look at that. Nevermind.

 

Edit 3?:

Here's what I've got for a script, it's applied to enemies via a perk.

Scriptname AceTestScript extends activemagiceffect 

MagicEffect Property MyMGEF Auto ;The Magic Effect itself

Event OnEffectStart(Actor akTarget, Actor akCaster)

	Int ArrowHitCount 
	
	If akTarget.HasMagicEffect(MyMGEF) ;Do I need this? I just want to add increments every time the effect is applied

		ArrowHitCount +1 ;I also tried +=1  and that returned with the count being 1 instead of 0

	EndIf

	Debug.Notification("Count:"+ArrowHitCount) ;Count is always 0

EndEvent
Edited by Elias555
Link to comment
Share on other sites

ArrowHitCount always returns 0 because you gave it no value when defined and are not assigning a value to it anywhere else in the script. Your line: ArrowHitCount + 1 will just be thrown out by Papyrus. The resultant yield is not assigned to anything. You were correct to first use: ArrowHitCount += 1. If that always returns a 1, then perhaps your conditions need reconsidered. I would try without your If statement to see if that has an affect.

Link to comment
Share on other sites

Different instances of an effect (i.e. the same thing applied multiple times) run different instances of the script (and therefore diferent variables), and in any case ArrowHitCount being within the event only exists within it. If you want to count in that manner I'd say add a token to the actor receiving the hit (Aktarget.additem(MyItem, 1) any non-playable item will do. The count of items (via condition function or in payrus with getitemcount) is the number of times he has been hit. You could remove the tokens upon death.

Link to comment
Share on other sites

Thanks for the responses. I was originally going to apply layers of hidden magic effects to keep the count but I like your idea of an item. I take it akTarget.MyGlobalVar wouldn't work then either?

 

Edit: Am I missing something here?

Scriptname AceTestScript extends activemagiceffect

MiscObject Property MyCounterRef Auto  

Event OnEffectStart(Actor akTarget, Actor akCaster)

	akTarget.AddItem(MyCounterRef, 1) ;Nothing is being added to the actor
	Int CurrentCount = akTarget.GetItemCount(MyCounterRef)
	Debug.Notification("Count:"+CurrentCount) ;Always 0

EndEvent

I'm using a perk to apply the effect via a bow(it's firing so it must be being applied), apply combat hit spell. The spell is FF and contact. I tried using Actor TargetActor = GetTargetActor() as well.

Alright, even when I add the items via console the count is still 0. This leads me to believe akTarget isn't functioning the way I thought it would. The visual effect is playing on the target so I'm not sure why the actor doesn't register as the target.

Edit: I swear I set the property, it even changed the icon to show that I did but it wasn't set. Second time this has happened to me.

Edited by Elias555
Link to comment
Share on other sites

Is it bad practice to use a script and have empty properties when you're not using that part of the script? eg I have a few perks and spells I want to add to the player but I want to use one script only so I condense it and only have

Event AnEvent()

PlayerRef.Addperk(MyPerk) ;this property is left empty when I don't need to fill it
PlayerRef.AddSpell(MySpell) ;this property is left empty when I don't need to fill it

EndEvent

Only one is filled when it needs to be.

 

 

 

I'm thinking that script is not sticking around long enough to report the proper value. So it may help to try assigning that value to a property on a quest script.

No..I just didn't set the property correctly.

Link to comment
Share on other sites

Is it bad practice to use a script and have empty properties when you're not using that part of the script? eg I have a few perks and spells I want to add to the player but I want to use one script only so I condense it and only have

Event AnEvent()

PlayerRef.Addperk(MyPerk) ;this property is left empty when I don't need to fill it
PlayerRef.AddSpell(MySpell) ;this property is left empty when I don't need to fill it

EndEvent

Only one is filled when it needs to be.

 

 

 

I'm thinking that script is not sticking around long enough to report the proper value. So it may help to try assigning that value to a property on a quest script.

No..I just didn't set the property correctly.

 

 

You'll throw a Papyrus warning/error when you try adding a perk of none. Probably best check the property is filled first:

if MyPerk != None
	PlayerRef.Addperk(MyPerk)
endif
Link to comment
Share on other sites

  • Recently Browsing   0 members

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