Jump to content

Quick Questions, Quick Answers


Mattiewagg

Recommended Posts

  • Replies 2.6k
  • Created
  • Last Reply

Top Posters In This Topic

 

 

Hi,

 

After many reads, research, tries and test, I finally ends up here hoping for some help...

 

Here's what give me some hard time:

 

 

I want to add two dialogue options to followers even if they are not currently in following state.

The goal is to manage equipment by moving Npc inventory into custom chest, whose the player can access to change their content.

 

 

I've got 7 followers to manage via dialogue options.

They all have their own Chest system.

 

 

ChestGears = items to go outside, ready to fight!

ChestRelax = items for interior, or non warrior style.

 

 

The dialogue options are:

 

"All Gears Up!" =

 

.npc remove all current items,

.move them to ChestRelax,

.then they acquired all items from ChestGears,

.npc equip the new items.

 

"Let's Relax!" =

 

.npc remove all current items,

.move them to ChestGears,

.then they acquired all items from ChestRelax,

.npc equip the new items.

 

 

 

Actually, I've try to make quests, but I failed with scripts.

Some function like "UnequipAll" don't compile, I can't manage to make "RemoveAllItems" move items to another container...

I'm missing some better knowledges for now :sad:

 

 

So, If someone know something about that I'm ready!.

 

Thanks in advance.

 

 

As long as you call RemoveAllItems correctly it should move the items to the specified container... did you call it something like the following?

FollowerRef.RemoveAllItems(ChestGears, true, false)

That should ensure their all of their non-Quest items are moved to ChestGears, while they retain ownership of said items. You have to make sure you specify the container you want the items transferred to, and that you have that container as a property of the script (ObjectReference Property ChestGears Auto) so that it actually knows what you're referencing. Also, make sure that you give it some time to process after calling RemoveAllItems() before you try to give any items to them or they might just end up getting removed as well.

 

So you could have something like:

Function LetsRelax(ObjectReference FollowerRef)
     FollowerRef.RemoveAllItems(ChestGears, true, false)
     ;this should move the items from FollowerRef to ChestGears, retaining ownership of the items so they still belong to FollowerRef
     Utility.Wait(0.2) ;force the game to wait, thus allowing time to process
     ChestRelax.RemoveAllItems(FollowerRef, false, false)
     ;this should move the items from ChestRelax to FollowRef, without retaining ownership so that the items still belong to FollowerRef
     Utility.Wait(0.2) ;might not be necessary, but allows time to process
EndFunction

Then just call this 'LetsRelax' function, passing a reference of the follower you want to run the function on, when you select the "Let's Relax!" dialogue option. You would do much the same thing for the "All Gears Up!" option, just make sure that instead of putting items in the ChestGears you put them in ChestRelax, and pull items from ChestGears instead of ChestRelax... Something like:

Function GearUp(ObjectReference FollowerRef)
     FollowerRef.RemoveAllItems(ChestRelax, true, false)
     ;this should move the items from FollowerRef to ChestRelax, retaining ownership of the items so they still belong to FollowerRef
     Utility.Wait(0.2) ;force the game to wait, thus allowing time to process
     ChestGears.RemoveAllItems(FollowerRef, false, false)
     ;this should move the items from ChestGears to FollowRef, without retaining ownership so that the items still belong to FollowerRef
     Utility.Wait(0.2) ;might not be necessary, but allows time to process
EndFunction

 

Edit: Also note that RemoveAllItems() won't actually do anything until there isn't a menu open, as far as I know, which means you'll have to make the selecting those dialogues kick you out of the conversation to allow it to take effect.

Edited by Darkxenoth
Link to comment
Share on other sites

Even if I position a door marker in the air, I still teleport in on the surface far below that door marker. How do I teleport to the exact position of the marker in the air and then have the player fall to the ground from there ?

 

One possible solution is to place a(n invisible ?) surface just below the door marker, and then disable it just after the cell is loaded.

 

Is there a more refined way to do this ?

Link to comment
Share on other sites

@Darkxenoth,

 

wow thanks! I realize that I wasn't too far of this result, but I badly handle some CK Wiki example, and thus script don't compile!

 

I try asap your method, look more clean than mine!

 

Thanks again, you really help me a lot! Have a nice week end :D

 

 

Edit: For that "Also note that RemoveAllItems() won't actually do anything until there isn't a menu open, as far as I know, which means you'll have to make the selecting those dialogues kick you out of the conversation to allow it to take effect."

 

I plan to make a dialogue quest with 3 stages,

stage 00: I iniate dialogue and I add this GetOwningQuest().SetStage(10)

stage 10: dialogue are finished, menu are closed and the script do the job, GetOwningQuest().SetStage(20)

stage 20: quest end.

Edited by dredd3110
Link to comment
Share on other sites

I have a very quick question not worth making a new thread for. I can't get equipitem to work. Here is the script:

 

Note: PrisonerOutfit refers to an article of prisoner clothing--ie. tunic, shoes. Additem works properly. Equipitem has no effect.

 

Any ideas ?

Scriptname CSBJailscript extends ObjectReference  

ObjectReference Property CSBJailChestID auto
ObjectReference Property PrisonerOutfitCSB01  auto
ObjectReference Property PrisonerOutfitCSB02  auto
ObjectReference Property PrisonerOutfitCSB03  auto

Event OnTriggerEnter(ObjectReference akActionRef)
	Game.GetPlayer().RemoveAllItems(CSBJailChestID)
	Game.GetPlayer().AddItem(PrisonerOutfitCSB01)
	Game.GetPlayer().AddItem(PrisonerOutfitCSB02)
	Game.GetPlayer().AddItem(PrisonerOutfitCSB03)
	utility.wait(0.25)
	Game.GetPlayer().EquipItem(PrisonerOutfitCSB01)
	Game.GetPlayer().EquipItem(PrisonerOutfitCSB02)
	Game.GetPlayer().EquipItem(PrisonerOutfitCSB03)
EndEvent

Link to comment
Share on other sites

If you have a spell with a base cost of 66.0, with a skill usage mult of 1.0, and belonging to the Restoration skill... do you get the same amount of experience by casting that spell as you would using Game.AdvanceSkill("Restoration", 66.0)? I'm just trying to figure out whether I'd be giving too much experience...

 

I'm trying to figure out a way to make a spell that has a dynamic casting cost and experience gain... I already have the spell effect as dynamic, it 'shields'* the caster for 2/3 their base health; but now I want to make it have a dynamic casting cost without gimping it's experience - I want it to cost 1/6 of the caster's base health in magicka**, and give experience equal to its cost***. I figure this way it would be useful any time of the game, and still have a meaningful cost throughout - At early levels, you're not going to have as much health as later on and so it won't shield as much, thus it costs less and gives less experience. As you gain levels and increase your health, it becomes more expensive to cast while giving more experience. Of course, I'll also be putting in a check to verify you actually have enough magicka to 'cast' it to ensure you can't use it if your magicka is lower than would be required to 'cast' it; though of course the spell would have already been 'cast' since the effect doesn't start until then, but if you don't have enough magicka then it would just dispel the spell before setting the shield value to ensure you don't get the benefits without being able to afford it.

 

*

 

spell property shieldSpell auto ;this references the shield spell that this effect is part of
float pcHealth = Game.GetPlayer().GetBaseActorValue("health")
float totalShield = ((pcHealth/3)*2)
float dmgTaken = 0.0

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
     float curHealth = pcRef.GetActorValue("health")
     float hDiff = (pcHealth - curHealth)
     dmgTaken += hDiff
     if(dmgTaken <= totalShield)
       pcRef.RestoreActorValue("health", dmgTaken)
       pcHealth = curHealth
     else
       hDiff = (dmgTaken - totalShield)
       pcRef.RestoreActorValue("health", hDiff)
       pcRef.DispelSpell(shieldSpell)
     endIf
EndEvent 

 

 

**

 

float castCost = (Game.GetPlayer().GetBaseActorValue("health")/6)
Game.GetPlayer().DamageActorValue("magicka", castCost)

 

 

***

 

Game.AdvanceSkill("Restoration", castCost)

 

 

 

Link to comment
Share on other sites

 

I have a very quick question not worth making a new thread for. I can't get equipitem to work. Here is the script:

 

Note: PrisonerOutfit refers to an article of prisoner clothing--ie. tunic, shoes. Additem works properly. Equipitem has no effect.

 

Any ideas ?

 

Scriptname CSBJailscript extends ObjectReference  

ObjectReference Property CSBJailChestID auto
ObjectReference Property PrisonerOutfitCSB01  auto
ObjectReference Property PrisonerOutfitCSB02  auto
ObjectReference Property PrisonerOutfitCSB03  auto

Event OnTriggerEnter(ObjectReference akActionRef)
	Game.GetPlayer().RemoveAllItems(CSBJailChestID)
	Game.GetPlayer().AddItem(PrisonerOutfitCSB01)
	Game.GetPlayer().AddItem(PrisonerOutfitCSB02)
	Game.GetPlayer().AddItem(PrisonerOutfitCSB03)
	utility.wait(0.25)
	Game.GetPlayer().EquipItem(PrisonerOutfitCSB01)
	Game.GetPlayer().EquipItem(PrisonerOutfitCSB02)
	Game.GetPlayer().EquipItem(PrisonerOutfitCSB03)
EndEvent

 

 

Hmm... perhaps try forcing it to wait between each equip*? Or fill out the rest of the parameters for EquipItem()**? Not sure why it would matter either way... As long as you properly filled the properties, which given that AddItem() works you DID, EquipItem() should work as well, you would think. Perhaps it's because you have them as ObjectReference properties and not Armor properties? I've never actually used EquipItem(), but I frequently use UnequipItem(); I always use Weapon or Armor properties when I do, and never have a problem.

*

 

.
.
.
Utility.Wait(0.25)
Game.GetPlayer().EquipItem(PrisonerOutfitCSB01)
Utility.Wait(0.01)
Game.GetPlayer().EquipItem(PrisonerOutfitCSB02)
Utility.Wait(0.01)
Game.GetPlayer().EquipItem(PrisonerOutfitCSB03)
.
.
. 

 

 

**

 

.
.
.
Utility.Wait(0.25)
Game.GetPlayer().EquipItem(PrisonerOutfitCSB01, false, true)
;silently forces the player to equip PrisonerOutfitCSB01, allowing them to take it off afterwards
Game.GetPlayer().EquipItem(PrisonerOutfitCSB02, false, true)
Game.GetPlayer().EquipItem(PrisonerOutfitCSB03, false, true)
.
.
. 

 

 

Link to comment
Share on other sites

If you have a spell with a base cost of 66.0, with a skill usage mult of 1.0, and belonging to the Restoration skill... do you get the same amount of experience by casting that spell as you would using Game.AdvanceSkill("Restoration", 66.0)? I'm just trying to figure out whether I'd be giving too much experience...

 

I'm trying to figure out a way to make a spell that has a dynamic casting cost and experience gain... I already have the spell effect as dynamic, it 'shields'* the caster for 2/3 their base health; but now I want to make it have a dynamic casting cost without gimping it's experience - I want it to cost 1/6 of the caster's base health in magicka**, and give experience equal to its cost***. I figure this way it would be useful any time of the game, and still have a meaningful cost throughout - At early levels, you're not going to have as much health as later on and so it won't shield as much, thus it costs less and gives less experience. As you gain levels and increase your health, it becomes more expensive to cast while giving more experience. Of course, I'll also be putting in a check to verify you actually have enough magicka to 'cast' it to ensure you can't use it if your magicka is lower than would be required to 'cast' it; though of course the spell would have already been 'cast' since the effect doesn't start until then, but if you don't have enough magicka then it would just dispel the spell before setting the shield value to ensure you don't get the benefits without being able to afford it.

 

*

 

spell property shieldSpell auto ;this references the shield spell that this effect is part of
float pcHealth = Game.GetPlayer().GetBaseActorValue("health")
float totalShield = ((pcHealth/3)*2)
float dmgTaken = 0.0

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
     float curHealth = pcRef.GetActorValue("health")
     float hDiff = (pcHealth - curHealth)
     dmgTaken += hDiff
     if(dmgTaken <= totalShield)
       pcRef.RestoreActorValue("health", dmgTaken)
       pcHealth = curHealth
     else
       hDiff = (dmgTaken - totalShield)
       pcRef.RestoreActorValue("health", hDiff)
       pcRef.DispelSpell(shieldSpell)
     endIf
EndEvent 

 

**

float castCost = (Game.GetPlayer().GetBaseActorValue("health")/6)
Game.GetPlayer().DamageActorValue("magicka", castCost)

 

***

Game.AdvanceSkill("Restoration", castCost)

 

The amount of experience you get from a spell is calculated according to some arcane formula using the skill multiplier, the magicka cost, the duration, and the magnitude, so only in very specific circumstances would you actually get 66 experiencd from the spell (I imagine if the duration and magnitude were both 1).

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...