Jump to content

Quick Questions, Quick Answers


Mattiewagg

Recommended Posts

  • Replies 2.6k
  • Created
  • Last Reply

Top Posters In This Topic

*Edited*

Hey, could anyone take a look at this code I'm toying with and tell me if there is any reason it shouldn't work as intended? I made it after a friend asked me about making a weapon he could use from the start and throughout his playthrough regardless of level... so I was trying to make it so the weapon would hit harder as you level, going with numbers that he suggested.

scriptName selfLevelingSwordScript

Property Weapon darxSelfLevelingSword auto
Property Int pcLvl
Property Int weapDmg
Property Int dmgBuff
Property Int varZ

Function calcWeapDmg()
	pcLvl = (Game.GetPlayer().GetLevel())
	if(pcLvl < 5)
		dmgBuff = 0
	elseIf(pcLvl > 5 && pcLvl <= 20)
		dmgBuff = (pcLvl - 5)
	elseIf(pcLvl > 20 && pcLvl <= 50)
		dmgBuff = (15 + ((pcLvl / 5) - 4))
	elseIf(pcLvl > 50)
		if((pcLvl / 10) < 6)
			varZ = 5
		else
			varZ = ((pcLvl / 10) - 1)
		endIf
		dmgBuff = (21 + ((pcLvl / 10) - varZ))
	endIf
	weapDmg = ((darxSelfLevelingSword.GetBaseDamage()) + dmgBuff)
EndFunction

Event OnEquip()
	calcWeapDmg()
	darxSelfLevelingSword.SetBaseDamage(weapDmg)
EndEvent

If it should work and compile fine as is, great. If you have any suggestions, or know of a mod that does this already please feel free to mention them.

Thanks.

 

I love how the only thing keeping it from working correctly was 3 little letters... well, after i actually touched it up so the properties were coded properly anyway.

 

 

So instead of:

Property Weapon darkxSelfLevelingSword Auto
Property Int weapDmg Auto (etc...)

fixed them to:

Weapon Property darkSelfLevelingSword Auto
Int Property weapDmg Auto
(etc...) 

 

 

Edited by Darkxenoth
Link to comment
Share on other sites

 

 

Is there a way to attach a script to something dynamically? Like can I somehow attach a script to an item in-game, without having to attach the script to that item with the CK or anything? I already know I could probably do that by attaching the script to an effect on an enchant and enchanting the item in-game that I want to have the script; but I don't want to do it that way, if at all possible.

 

Nevermind... found this, that answers my question. I really need to look before asking something.

 

Edit2: New question! Is there a way to attach a script to an arrow without having to attach a magic effect to the projectile it uses?

Edit3: Another question: Is there a way to change the base damage of an arrow through a script? I see the GetDamage() function for ammo, but there isn't a SetDamage() or SetBaseDamage() function for ammo as far as I can tell...

Edited by Darkxenoth
Link to comment
Share on other sites

I've been trying to figure this out for about a day now, so I just wanted to pop a question in here to confirm that I'm correct in my thinking (I'm still relatively new to the creation kit.)

 

If I want to make a specific outdoor cell a no reset/respawn cell, I:

 

1. Give the cell its own name

2. Create a new Encounter Zone and set the Location to the Cell

3. Edit the Cell's location to.. It's location and hit apply

 

That should make it so that if a player drops a random bunch of stuff around the cell (I'm making an exterior home in the Tamriel worldspace) it won't reset and destroy all of their items that aren't in containers, right?

Link to comment
Share on other sites

I have a question. I created a custom interior cell and gave it a custom ambient sound. I converted the file properly, named it correctly, created a sound descriptor, set it to loop blah blah blah...

 

When I first enter a cell in my custom interior the sound plays fine, loops fine, and doesn't go wrong. When I reload a save made in that cell however, the sound doesn't play. If I leave that cell and enter another, then re-enter that cell, then the sound starts playing again. Why is this happening, and how can I fix it?

Link to comment
Share on other sites

I have a question. I created a custom interior cell and gave it a custom ambient sound. I converted the file properly, named it correctly, created a sound descriptor, set it to loop blah blah blah...

 

When I first enter a cell in my custom interior the sound plays fine, loops fine, and doesn't go wrong. When I reload a save made in that cell however, the sound doesn't play. If I leave that cell and enter another, then re-enter that cell, then the sound starts playing again. Why is this happening, and how can I fix it?

Sounds like the sound is being triggered when you're already in the cell on load. How do you have it set to recognize when to play the sound? Other than that, I can't really help since I don't know how to do much of anything with sounds myself.

Link to comment
Share on other sites

I've been trying to figure this out for about a day now, so I just wanted to pop a question in here to confirm that I'm correct in my thinking (I'm still relatively new to the creation kit.)

 

If I want to make a specific outdoor cell a no reset/respawn cell, I:

 

1. Give the cell its own name

2. Create a new Encounter Zone and set the Location to the Cell

3. Edit the Cell's location to.. It's location and hit apply

 

That should make it so that if a player drops a random bunch of stuff around the cell (I'm making an exterior home in the Tamriel worldspace) it won't reset and destroy all of their items that aren't in containers, right?

As far as I know, and I'm by no means terribly well-informed, as long as you made sure to set the No Reset flag/condition on the Encounter Zone of the location you should be fine.

Link to comment
Share on other sites

Hi,

 

I'm searching a way to enable the activation of an item based on how much time have past since the last activation.

this is for a food resource (bee hive) that I just want to be able to harvest once a day.

 

from what I've seen, there is a lot of options, whose functions like: OnUpdateGameTime, RegisterForSingleUpdateGameTime

 

I'm not sure to set it up safely, I've create my script and I just need to know how you attach it to an OnActivate event that start a timer and lock harvesting again until 24hours has passed.

 

Thanks in advance.

Link to comment
Share on other sites

Great comment Mattiewagg ... One of the biggest part of programming/designing programs is the ability to understand how to preform a scientific test.

The first step in solving any major problem when coding is to remove other factors. Focus in on just what you're testing.

 

As for this problem ... a quick guess would be the update distance of the mountain vs the update distance of the tower.

Or possibly you have the [use high-detail LOD textures] set on the tower object or [Has distant LOD].

Link to comment
Share on other sites

Hi,

 

I'm searching a way to enable the activation of an item based on how much time have past since the last activation.

this is for a food resource (bee hive) that I just want to be able to harvest once a day.

 

from what I've seen, there is a lot of options, whose functions like: OnUpdateGameTime, RegisterForSingleUpdateGameTime

 

I'm not sure to set it up safely, I've create my script and I just need to know how you attach it to an OnActivate event that start a timer and lock harvesting again until 24hours has passed.

 

Thanks in advance.

Here's the script I would use. Just attach it to your hive then fill the RewardList property with LItemIngredientHoneycomb and the TimeoutHours property with 24.0. By default if the player clicks again in that same day nothing will happen, but you can create a custom message to show (or even let the default container activation happen).

ScriptName RewardWithTimeoutScript extends ObjectReference
{Activating this object gives a reward only once per time period.}

LeveledItem Property RewardList Auto
{Required: A list of one or more items the player receives when activating this object.}

float Property TimeoutHours Auto
{Required: The amount of time, in game hours, before the player can get the reward again.}

Message Property TimeoutMsg Auto
{Optional: Message shown if player activates this object again during the timeout period.}

bool Property AllowNormalActivationDuringTimeout Auto
{Optional: Allow normal activation for furniture, containers, etc. during the timeout period.}

Event OnInit()
	BlockActivation()
EndEvent

Event OnActivate(ObjectReference akActionRef)
	if akActionRef == Game.GetPlayer() ; do not allow other characters to get the reward!
		GoToState("TimeoutActive")
		if TimeoutHours > 0
			RegisterForSingleUpdateGameTime(TimeoutHours)
		endif
		if RewardList
			akActionRef.AddItem(RewardList)
		endif
	endif
EndEvent

Event OnUpdateGameTime()
	GoToState("")
EndEvent

State TimeoutActive
	Event OnActivate(ObjectReference akActionRef)
		if TimeoutMsg
			TimeoutMsg.Show()
		endif
		if AllowNormalActivationDuringTimeout
			Activate(akActionRef, true)
		endif
	EndEvent
EndState

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...