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

Quest script:

2. I do not see any way 'Obelisks' can equal anything other than 0.

3. I do not see what 'Minute' is supposed to accomplish.

Those variables are used and modified by other scripts.

Well, if timer is theoretically not broken, then why it's not working? :shrug: I'm not sure for quest script, but for NPC script it really should be working. And I'm absolutely sure that I've attached those scripts to the NPC/quests properly. Instead, e. g. NPC is not reviving after 3 seconds, like the timer is not modified at all. I've tried with clean save too...

Link to comment
Share on other sites

I've removed this part for testing and it haven't changed anything. I can do simple workaround by just removing this part and marking NPC as essential (with unmarking him at proper moment), but that doesn't change the fact that the second, most important timed thing refuses to work "because no", with no way to workaround. XD There is nothing in "(...)" parts what could break the thing in any way, I'm sure of it.

I'll be looking for some solution, although I don't think I can figure it out for myself...

Link to comment
Share on other sites

There is nothing in "(...)" parts what could break the thing in any way, I'm sure of it.

If I had a nickle for everytime I heard that. XD

Another thing, in your NPC script, you have your 'timer' defined as a 'short' where it should be a 'float'.

Link to comment
Share on other sites

Another thing, in your NPC script, you have your 'timer' defined as a 'short' where it should be a 'float'.

...And it definitely should be a float? :yes: I must try it...

EDIT: YES! That was the source! XD Thank you very much Willie, I would never figured it out for myself!

Link to comment
Share on other sites

XD Smarty says: All variables that you use along with 'GetSecondsPassed' must be a 'float' since a short will hold only 'non-decimal' values.

Since you are "adding" to your 'timer' once every FPS cycle, if you are running at 60 FPS, you would be adding 0.0167 to your timer, which would have stored in it 0. So, the timer would never advance.

Now, if you were "subtracting" from your 'timer', you would get one FPS cycle for each 'number' you set your timer to, since it rounds down. So, a timer of 5 would get 0.0167 subtracted from it, where it instantly becomes 4. Then next FPS cycle would make it 3, and etc..

Link to comment
Share on other sites

I have a strange problem in the CS. I can no longer create or edit scripts. The script editor pop-up box seems... broken. Either that or I'm doing something really dumb and missing the obvious.

Following Class 1 I created a new script, saved it by clicking on the disk icon thingy (I've even tried Script - Save) and all seems fine. When I go to close the script box, either clicking on the X in the corner or by using Exit, I get the message in this pic.

It simply won't close unless I say No, which of course, doesn't save the script.

Any thoughts?

Link to comment
Share on other sites

I'm looking for a non-OBSE solution to this (if possible) so those who don't use OBSE can play this.

I'm trying to make a sword that adds one of ten custom spells at random on strike and removes it after 5 seconds. What I've done so far:

1) Set the script as a Magic Effect with a duration of five seconds (that way, the ScriptEffectFinish block will remove the added spell).

2) Made ten different Ability spells so the effects will be applied to any actor struck by the sword.

3) Added the scripted enchantment to the sword.

My current script (which is very rough) is:


scn RandomEffectSwordScript


short Rand


Begin ScriptEffectStart


set Rand to GetRandomPercent


 if Rand >= 90

  AddSpell CDrainFat

 Elseif Rand >= 80

  AddSpell CWeak

 Elseif Rand >= 70

  AddSpell CSilence

 Elseif Rand >= 60

  AddSpell CParalyze

 Elseif Rand >= 50

  AddSpell CDamSpeed

 Elseif Rand >= 40

  AddSpell CDamMagic

 Elseif Rand >= 30

  AddSpell CShockDam

 Elseif Rand >= 20

  AddSpell CFrostDam

 Elseif Rand >= 10

  AddSpell CFireDam

 Elseif Rand < 10

  AddSpell CDamHealth

 Endif

End


Begin ScriptEffectFinish


 RemoveSpell CDrainFat

 RemoveSpell CWeak

 RemoveSpell CSilence

 RemoveSpell CParalyze

 RemoveSpell CDamSpeed

 RemoveSpell CDamMagic

 RemoveSpell CShockDam

 RemoveSpell CFrostDam

 RemoveSpell CFireDam

 RemoveSpell CDamHealth


End

For some reason, the script does not add the spells to the target at all. I've use a script similar to this to add spells to a target before, but not with a random variable thrown in. Any pointers?

Edit: Oh, one other thing: I'd like for each effect to run its full course. If I strike an enemy once and CShockDam gets added, I want that to remain for five seconds, even if I hit the enemy again before that time is up. Is that possible?

Edited by The Vyper
Link to comment
Share on other sites

I have a strange problem in the CS. I can no longer create or edit scripts. The script editor pop-up box seems... broken. Either that or I'm doing something really dumb and missing the obvious.

Following Class 1 I created a new script, saved it by clicking on the disk icon thingy (I've even tried Script - Save) and all seems fine. When I go to close the script box, either clicking on the X in the corner or by using Exit, I get the message in this pic.

It simply won't close unless I say No, which of course, doesn't save the script.

Any thoughts?

Yep, I know that box of doomz very well, it always does that when my script code is fail.

Link to comment
Share on other sites

I have a strange problem in the CS. I can no longer create or edit scripts. The script editor pop-up box seems... broken. Either that or I'm doing something really dumb and missing the obvious.

Following Class 1 I created a new script, saved it by clicking on the disk icon thingy (I've even tried Script - Save) and all seems fine. When I go to close the script box, either clicking on the X in the corner or by using Exit, I get the message in this pic.

It simply won't close unless I say No, which of course, doesn't save the script.

Any thoughts?

Despite the fact that you get no error messages until you try to close, the script may still have an error in it. Can you show us the whole script you are trying to save?

Link to comment
Share on other sites

I would like to create a NPC-only spell that summons a specific armor and weapon, just like the spell that summons the gear of Mythic Dawn's members. I haven't found anything like that in OOO, which has only a spells to summon custom creatures. Do you know how to create such script? I'm always failing in my efforts.

Link to comment
Share on other sites

Okay, I've retooled the script I posted earlier, but it still has the same problem: It won't add the spells at all (and yes, I tried a clean save :D ). The script type is Magic Effect and is added to the enchantment. The enchantment has Fire Damage, Frost Damage, Shock Damage & this script effect. The script is the only part that's not working. The current version is:


scn RandomEffectSwordScript


short Rand

short Add

ref RESTarget


Begin ScriptEffectStart


set Rand to GetRandomPercent


set RESTarget to GetSelf


 if Rand >= 90

  Set Add to 1

 Elseif Rand >= 80

  Set Add to 2

 Elseif Rand >= 70

  Set Add to 3

 Elseif Rand >= 60

  Set Add to 4

 Elseif Rand >= 50

  Set Add to 5

 Elseif Rand >= 40

  Set Add to 6

 Elseif Rand >= 30

  Set Add to 7

 Elseif Rand >= 20

  Set Add to 8

 Elseif Rand >= 10

  Set Add to 9

 Elseif Rand < 10

  Set Add to 10

 Endif

End


Begin ScriptEffectUpdate

 If Add ==1

  RESTarget.addspell CDrainFat

 Elseif Add == 2

  RESTarget.addspell CWeak

 Elseif Add == 3

  RESTarget.addspell CSilence

 Elseif Add == 4

  RESTarget.addspell CParalyze

 Elseif Add == 5

  RESTarget.addspell CDamSpeed

 Elseif Add == 6

  RESTarget.addspell CDamMagic

 Elseif Add == 7

  RESTarget.addspell CShockDam

 Elseif Add == 8

  RESTarget.addspell CFrostDam

 Elseif Add == 9

  RESTarget.addspell CFireDam

 Elseif Add == 10

  RESTarget.addspell CDamHealth

 Endif

End



Begin ScriptEffectFinish


 RESTarget.RemoveSpell CDrainFat

 RESTarget.RemoveSpell CBWeak

 RESTarget.RemoveSpell CSilence

 RESTarget.RemoveSpell CParalyze

 RESTarget.RemoveSpell CDamSpeed

 RESTarget.RemoveSpell CDamMagic

 RESTarget.RemoveSpell CShockDam

 RESTarget.RemoveSpell CFrostDam

 RESTarget.RemoveSpell CFireDam

 RESTarget.RemoveSpell CDamHealth


End


I have to manually remove the spells at the end because they are Ability type spells. Even after the script and the spells have finished their duration, the spells remain unless manually removed via script command. I've tested this by making my own character the target of a similar weapon (that actually does work like it's supposed to).

Link to comment
Share on other sites

@Hanaisse - The image link does not work for me. But if you get an error when you try to close a script box, then your script still has an error. The 'automatic' debug does not find everything. As mentioned already, post your script if your having trouble with it.

@The Vyper - Variables should work in a script. Can you make sure your spells (abilities) work correctly by using the console to add the spell to an NPC? Do you see anything?

Another thing, you have multiple enchantments on the weapon, the strongest one will prevail in terms of the 'effect' you 'see' on the NPC. Since script effects are usually a '0' power, the other effects (fire, shock) will show over any script effects.

You set the duration of the enchantment to 5 (?) if you want it to last 5 seconds.

The scriptEffectUpdate will only run if the enchantment has a duration. You might want to move the 'addspell' to the ScriptEffectStart block instead. There is no reason for it to be in an 'update' block since it only needs to be added once.

Link to comment
Share on other sites

@The Vyper - Variables should work in a script. Can you make sure your spells (abilities) work correctly by using the console to add the spell to an NPC? Do you see anything?

The abilities work when added manually. (And kick like a clannfear too. :coolup: )

You set the duration of the enchantment to 5 (?) if you want it to last 5 seconds.

The scriptEffectUpdate will only run if the enchantment has a duration.

:clap: I should have mentioned that. I set the duration of the abilities and the script effect to five seconds.

You might want to move the 'addspell' to the ScriptEffectStart block instead. There is no reason for it to be in an 'update' block since it only needs to be added once.

I did originally try that. The problem with that is that a second strike within the five second time span seems to trigger the ScripEffectFinish block for the first spell (removes it) without adding a second spell. Either that, or it does add a second spell, but it's immediately removed by the ScriptEffectFinish block running on the first. Example:

1st strike: CParalyze gets added.

2nd strike: CParalyze gets removed, no additional effect visible.

3rd strike: CDamSpeed gets added.

4th strike: CDamSpeed gets removed, no additional effect visible.

Adding the spells in a ScriptEffectUpdate block seems to bypass this problem. I have a dagger in this same mod that does various levels of Shock Damage depending on Player level. This weapon actually works. The script for it is:


scn FoHScript


Short Lvl

ref target


Begin ScriptEffectStart


set Lvl to player.getlevel

Set target to getself


end


begin ScriptEffectUpdate


 if Lvl >= 20

  target.addspell FoH40

 elseif Lvl >= 15

  Target.addspell FoH30

 elseif Lvl >= 10

  Target.addspell FoH20

 elseif Lvl < 10 

  Target.addspell FoH10

 endif


end


begin scriptEffectFinish


Target.RemoveSpell FoH40

Target.RemoveSpell FoH30

Target.RemoveSpell FoH20

Target.RemoveSpell FoH10


End

This works well enough. Example:

player is level 16

1st strike: FoH30 is added

2nd strike: FoH30 is removed, then added again (basically resetting the duration of the spell).

3rd strike: FoH30 is removed, then added a third time.

This is good for the dagger, otherwise it might be too powerful. It just doesn't seem to be working for the sword (but again, that script is a slightly different animal).

I've also thought of moving an activator into the target and having it cast the spell, but I've experienced problems with that too. If the target is knocked too far back, the activator might miss the target. Even if it doesn't, it (or the spell projectile it's casting) will still be seen and I want to avoid that. Also, if the target dies as a result of the spell, the Player won't get credit for the kill.

Another thing, you have multiple enchantments on the weapon, the strongest one will prevail in terms of the 'effect' you 'see' on the NPC. Since script effects are usually a '0' power, the other effects (fire, shock) will show over any script effects.

:D That may be the problem. I'll remove the Fire, Frost & Shock bits and see what happens. If it works, I'll combine them into one spell and have it added regardless.

Edit: Nope. Removing the Fire, Frost and Shock bits had no effect. (I may have to rethink this idea)

Edited by The Vyper
Link to comment
Share on other sites

You might try putting the enchantment on an armor piece that has no slot and add+equip or remove that from the target. But I am not sure if you can equip an armor piece with no slot selected to a creature.

Other than that, your sort of limited to what the game engine will do.

As for having the 'addspell' in the update block, yeah, that will work because its constantly adding the spell to the target, even if it gets removed once by a ScriptEffectFinish block, it adds it back the next FPS cycle.

But, if multiple enchantments are running then its possible if you hit the target 5 times in 5 seconds, that they could have 5 different enchantments on them, all at once. :rolleyes:

Link to comment
Share on other sites

You might try putting the enchantment on an armor piece that has no slot and add+equip or remove that from the target. But I am not sure if you can equip an armor piece with no slot selected to a creature.

Other than that, your sort of limited to what the game engine will do.

Not a bad idea. I could change the Abilty to an Enchantment, put it on an Amulet or Ring (and set it to be Unplayable), and give the amulet/ring a script that will force the actor to auto equip it, then have the script remove it (of course, the sword strike would add the amulet/ring to the target first).

I'm also going to try removing the ScriptEffectFinish and ScriptEffectUpdate blocks and adding a script to each ability that will remove it after 5 seconds.

But, if multiple enchantments are running then its possible if you hit the target 5 times in 5 seconds, that they could have 5 different enchantments on them, all at once. :rolleyes:

That was actually my original intention. :) It will make the sword that much nastier (and harder to get, since you'll have to fight a boss to get it). I'll keep you posted on the developments.

Link to comment
Share on other sites

If you look at the CS wiki you will find the right function for the health check.

Yes, but that doesn't give me the answer how to check maximum health. "Getav health" only allows me to check current health, which can be not maximum, but even close to 0 at very unlucky moments.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...