Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

General Script Questions #1


WillieSea
 Share

Recommended Posts

I am also confused by your statement about wanting to make it 'compatible' with other mods if you are also 'adding' new versions of the weapon based on level. That alone would cause problems I would think.

I don't think so, they're already created in default game and all I'm doing is replacing lesser versions with better ones, depending on player's level. They're rather the same at scripting point of view, and together with original scripts, it should work fine. In theory, at least.

2. You only have 5 seconds defined in the script before the merchant vanishes. If you don't talk in that time, then the merchant goes away.

Hm... as you've mentioned it, now I've noticed that there's a simple timer here: "if ( summontimer >= 5 )". I've been working with timers only recently, and at the time I've been working with those scripts I didn't know that there's the thing I need to change. Thanks for indicating me that! :cry:

3. Did you put a reference ID name on the merchant chest, and remove the items using the reference name?

I've tried to use "removeallitems" function on the Merchant, not chest. If that's what you mean.

The items from chest wasn't shown in Merchant's equipment while bartering, so I thought that the connection with Merchant and her chest wasn't working at all from such distance. And yes, I've added ownership to this chest, so it wasn't the problem of my forgetfulness(?).

If thats not possible, you might try moving the chest to the merchant, but below the ground. Then try to remove all items from it.

I thought about such solution, although I've considered it as a rather provisional thing. Well, I'll try it anyway in this case.

Link to comment
Share on other sites

@The Vyper - That is simple math. Just give the chest a Reference ID name and your good to go.

Then, on the wall switch, you have the script that does the work.

*snip*

Thanks! :grr: I'll try that out (probably be Saturday before I get a chance) and see how it works.

Link to comment
Share on other sites

Okay, I think I've got next question.

Let's say that I want to create a spell/enchantment, that "freezes" the stricken character - his movement in WHOLE actions becomes slower by half (and that means the Burden spell is not what I need). How can I do such a thing?

Link to comment
Share on other sites

@SuTheSkunk - That might not need a script at all. I have never tried such a thing, but it may be possible by creating a spell with the 'Damage Attribute' Effect, where your 'ActorVal' is 'Speed'. If you lower the speed of the AI, I would think it would move and act slower.

Its something to try.

But if you wanted it exactly, then you could use a script, where you use ModActorValue to subtract from the targets speed. You could use GetActorValue to find out what their current speed is, then half that and use that value to mod the actor value for speed by a negative number.

Perhaps something like this:

set MySpeed to target.GetActorValue speed
set mySpeed to mySpeed / 2
set mySpeed to mySpeed - ( mySpeed * 2 )
target.ModActorValue mySpeed[/code]

Link to comment
Share on other sites

This scripting version works quite well, thank you. :) But the thing is that changing speed value affects only actor's movement while going and running, but not his animations while, for example, swinging the sword. That's what I wanted to get - to make his WHOLE movement slower, not only while going and running. Is it even possible? If not, then I'll just stay with changing speed value.

Edited by ZuTheSkunk
Link to comment
Share on other sites

I am not sure how you would (or could) change the speed of attack animations.

There are settings that slow the 'entire game' down, but not individual actors, at least that I know of.

Now, with your changed 'speed', you can only change their speed back to normal with the 'ModActorValue speed' again.

So, at the end of the spell effect, you could add the speed value back that you removed.

begin ScriptEffectStart
set MySpeed1 to target.GetActorValue speed
set mySpeed1 to mySpeed1 / 2
set mySpeed2 to mySpeed1 - ( mySpeed1 * 2 )
target.ModActorValue mySpeed2
end

begin ScriptEffectEnd
target.ModActorValue mySpeed1
end[/code]

Link to comment
Share on other sites

I guessed this last part of script for myself, but thank you anyway. :salute: Well, if there's no known possibility to affect actor's animation speed on run, then I'll just keep affecting speed value.

I've got another question - I wish to add something to the leveled lists of random actors, but without editing those lists directly, so my mod will not overwrite changes from other mods. What is the easiest way to do that? Probably there's some external program to keep such mods compatible, but I wish to know script solution, if there's any.

Link to comment
Share on other sites

Hey guys, I need some help. I'm trying to add a secret bookcase door for my piece of the Sutch mod, but I've run into scripting difficulties. I've tried copying and/or modifying existing vanilla scripts, but that just isn't working for me.

What I want to do is make a door open via an activator switch instead of opening when clicked on like a regular door. I'd also like the door to be lacking any icons (so I'd assume it's better to have it as an activator instead of a door).

I'm wanting to get the door opening animation to play when I press the switch once and then the closing animation play when I press the switch a second time. It seemed simple to me, at first, but nothing I've tried has produced any results. I can think of a few instances where things like this happen: Ayleid hidden walls, that secret wine barrel door, and the door in Anvil that appears at first to be a wall.

What scripts should I put on the switch and/or the secret bookcase that would produce the effect I'm looking for? :D

Thanks for your help guys! :sick:

Link to comment
Share on other sites

The script commands you use will depend on the name of the animations in the bookshelf. Do you know what they are?

Can you at least link to where you got the bookshelf resource?

Its easy enough to do, I just need more information on the objects to be scripted.

The same questions apply to the lever/button/switch you plan on using. What will that be?

Link to comment
Share on other sites

The animated bookshelf has two animations on it.

1. Open

2. Close

That is what you will use to cause the corresponding animation to play.

The candle lever only has one animation, but its the open/close combo.

1. Forward

The script will be on the lever.

The bookshelf can be a static object, or an activator, just make sure you leave the name field blank. That way it cannot be activated or seen as something that might be activatable.

short myState
begin OnActivate
if IsAnimPlaying == 0
if myState == 0
set myState to 1
myBookshelfREF.PlayGroup Open 1
PlayGroup Forward 1
else
set myState to 0
myBookshelfREF.PlayGroup Close 1
PlayGroup Forward 1
endif
endif
end[/code]

Link to comment
Share on other sites

I want to create a generic custom summon that can be used by any NPC (or spell casting creature). Getting them to cast it won't be a problem (I'll just give them a Begin OnStartCombat type script). I have the creatures I want to summon already made and placed in a Leveled List, I just need a script that can be used by multiple NPCs (and/or creatures) at the same time. I'm guessing I'll need to use PlaceAtMe after calling a visual effect and RemoveMe upon the death of the caster or the summon after calling another visual effect. I also need a variation of the script to summon three of these custom creatures at once: 1 to the right of the caster, 1 to the left and 1 directly in front. The only problem is, I don't know what these scripts should actually look like. Any help would be appreciated.

Link to comment
Share on other sites

What you want will not be easy to set up. And it will require a lot of testing to get it right since its not an 'out of the box' script. Creating a 'summon' spell is the stuff of several forum pages... :pints:

PlaceAtMe would work, placed at the casters location.

RemoveMe will not work the way you expect. Its only used to remove items from a container (NPC's are containers too).

You will probably have to do a 'kill' on the summoned creature and then move it to a holding cell for game-cleanup. But, getting its reference may be difficult. You might instead use MoveTo. You have the three creatures in a holding cell, you resurrect them and then move them to the caster. Not sure you would easily be able to put them in front and to the sides without a lot of math. But doing it this way, you can have the creature Reference ID hardcoded. But you would need to make one set of creatures for each spell caster.

The spell would probably need to be set up as a 'self' spell. That way you can get the casters reference ID for the MoveTo reference.

Link to comment
Share on other sites

I have a scripting question, I am working on the ORE Castle Chalenge and I am making a special room, I need animation to be played using a player trigger like how the ayleid blade traps start chopping when the player moves to them, my question is simply is it possible to trigger a animation to be played ( a npc animation ) by using such a trigger and how would I go about writing such a script?

Edited by RedDragonDreamer
Link to comment
Share on other sites

What you want will not be easy to set up. And it will require a lot of testing to get it right since its not an 'out of the box' script. Creating a 'summon' spell is the stuff of several forum pages... :smug:

PlaceAtMe would work, placed at the casters location.

RemoveMe will not work the way you expect. Its only used to remove items from a container (NPC's are containers too).

You will probably have to do a 'kill' on the summoned creature and then move it to a holding cell for game-cleanup. But, getting its reference may be difficult. You might instead use MoveTo. You have the three creatures in a holding cell, you resurrect them and then move them to the caster. Not sure you would easily be able to put them in front and to the sides without a lot of math. But doing it this way, you can have the creature Reference ID hardcoded. But you would need to make one set of creatures for each spell caster.

The spell would probably need to be set up as a 'self' spell. That way you can get the casters reference ID for the MoveTo reference.

In this instance, MoveTo may not be feasible. I want to have some of my custom high level skeletons (Ayleid Skeleton Heroes and Champions) summon some of my custom lower level skeletons (Ayleid Skeletons and Guardians). This spell would basically replace the standard Summon Skeleton spell used by the Vanilla Skeletom Heroes and Champions. MoveTo would work for the triple summon, since it would only be used by one enemy at a time, but I don't think I could properly position them all since MoveTo acts as a return. I guess I could use a Leveled List that always spawns 3 of the appropriate enemy, but I still don't know how to identify the Skeleton Lord as the caster. The script I use for this type of summon is:


scn CustomPlayerSummonGenericScript


float timer

float fade

short playonce

ref SUMN


Begin ScriptEffectStart


        set SUMN to SummonRefID ; The refernce to summon

        SUMN.disable


        SUMN.moveto PLayer 30 30 10 ; here comes the Summon

        SUMN.enable


        set fade to 1


End


Begin ScriptEffectUpdate


       if timer > 240 ; This moves it back after four minutes

           SUMN.moveto BSXRef ; The XMarker to move it to and from

           SUMN.resurrect

           SUMN.disable

       endif


       if SUMN.getdead && timer < 238

             set timer to 238

       endif


       if timer > 0.1 && playonce == 0

           SUMN.pms effectSummonMythicDawn 1

           set playonce to 1

       endif


       set timer to timer + ScriptEffectElapsedSeconds


       if timer > 238 && playonce == 1

           SUMN.pms effectSummonMythicDawn 2

           set playonce to 2

       endif


       if playonce == 2

            set fade to fade - 0.03

            SUMN.saa fade

       endif


End


Begin ScriptEffectFinish


        SUMN.moveto BSXRef 0 0 10

        SUMN.resurrect ; Heals the Summon if it's injured and revives it if it's dead

        SUMN.disable


End

I've used that for many different Player summons. What would I need to change on that to get it to work for a Skeleton Lord or other enemy?

Link to comment
Share on other sites

Couple questions: How can one check if there is more then one item in a container?

How can one check if a referenced item is a specific item? Say I was looking only for apples, and wanted to check for only items with the formID Apple, how would I do so?

If I wanted to make a bit of code run every five seconds when a item is equipped, how could one do so?

Link to comment
Share on other sites

@RedDragonDreamer - Do the ORE rules allow help? Anyway, you could setup a triggerzone that activates when the player enters it. When the triggerzone is activated, you should be able to use the PlayGroup command on the NPC after you give the NPC a Reference ID name. Check the 'AnimGroups' on that WIKI page as well. You can look at the scripts on the triggerzones that set off the blade traps you talked about to see how its done. Where it does the 'swinging' of the blade, you replace that part with your PlayGroup command.

@The Vyper - MoveTo does not act as a 'return'. It only does if you are using the command to move the player.

What is 'SummonRefID' supposed to be? It is a 'pre-placed' critter?

That script should work, but it will only work on the player.

@Yx33A - Easily done.

Store the number of apples in a variable for later use:

set myCount to myContainerREF.GetItemCount Apple
Check for more than 1 apple in the container:
if myContainerREF.GetItemCount Apple > 1

A container can be a NPC, container object or creature. Anything that could have an 'inventory'.

As for checking, there are probably a few ways to do that. One is a quest script, another is just a timed GameMode script on the equipped object.

Link to comment
Share on other sites

Hola,

Not sure I can explain this in a decent way, but I'll try:

I have looked through both the CS and OBSE functions to find a way to determine if a recently slain creature has filled a soul gem. But it either isn't there, or I just can't find it.

I need this for a script that will resurrect certain types of undead when their souls are not trapped after they "die". In other words: you need to capture their soul to defeat them.

Any suggestions?

Link to comment
Share on other sites

@StarX - I don't know of a way to do it that way, but I do know another way if its for a 'special' creature.

On death of the creature, you detect if the player has the correct soul gem in their inventory. If they do, you remove it and give them a 'special' soul gem with the 'special' soul in it.

If the player has that 'special' soul gem in their inventory, then you know they captured it the right way. Otherwise you can have the creature resurrect, or what-ever.

Link to comment
Share on other sites

That's a great idea, Willie! Smart thinking. :smug:

The only problem I foresee is that when the special soul gem stays in the player's inventory and you kill another creature with the same soul level it will not resurrect as the special soul gem is already in the player's inventory.

Maybe I could swap it again for another special soul gem with a similar name but a different ID, but I'm not sure that would work, as the first special soulgem will be in the players inventory for a very short period of time. Hmm...

Link to comment
Share on other sites

@The Vyper - MoveTo does not act as a 'return'. It only does if you are using the command to move the player.

Ah, I was unaware of that. That means in issue I had with another script has a different cause. Hmm...

What is 'SummonRefID' supposed to be? It is a 'pre-placed' critter?

That script is saved in a Notepad file so I can copy and paste it quickly. All I need to do is make a few changes and, Poof! New Player summon spell. SummonRefID is just a placeholder for whatever reference I would need to type in.

That script should work, but it will only work on the player.

Is there any way to change it to work for an enemy instead? I was thinking I could write three separate summon scripts and put them in one spell for the triple summon (I made the same suggestion to Maigrets for her Vampire Bats companion mod, but forgot about that until a little while ago :smug: ).

Link to comment
Share on other sites

@StarX - You have two (2) soul gems.

One is the 'empty' version that you check for on creature death.

The other is the 'full' version that contains the specific creatures soul.

I don't see what the problem here would be, you can have as many of each soulgem type as you want and it would not mess anything up.

@The Vyper - Ok, so 'SummonRefID' will be a specific Reference ID name on a creature.

If the script is playing on the 'caster', then you could use GetSelf to get the casters Reference. You could then swap 'player' with the variable that holds the reference gotten from the GetSelf.

Link to comment
Share on other sites

~@Yx33A - Easily done.

Store the number of apples in a variable for later use:

set myCount to myContainerREF.GetItemCount Apple
Check for more than 1 apple in the container:
if myContainerREF.GetItemCount Apple > 1

A container can be a NPC, container object or creature. Anything that could have an 'inventory'.

As for checking, there are probably a few ways to do that. One is a quest script, another is just a timed GameMode script on the equipped object.

I meant not of the same type. I might have a bunch of apples and pears used in the script, but if I want to not have to define each item I want counted, then how can I do this? Or is that only something OBSE can do?

Link to comment
Share on other sites

I meant not of the same type. I might have a bunch of apples and pears used in the script, but if I want to not have to define each item I want counted, then how can I do this? Or is that only something OBSE can do?

I am not really sure what your asking. You just want to count objects in the container? I believe OBSE has a 'stepping' function that lets you go through the items in a container. I am not sure how that would help you unless you don't care what the object is, you will still have to have specific code to do something when you find specific objects. :rofl:

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...