Jump to content

need help scripting


antopicio

Recommended Posts

yeah ! that's crucial for programmer ! lol

 

the documentation of OBSE you should see it yourself in your Oblivion install directory in file ' obse_command_doc.html ' or you can read here for more info notation & expressions

 

here's a little example for you. the message will appear in Console in-game (see it by pressing tilde '~' then write command tdt and press enter)

scn TestPrint
ref rf1
short sh1
string_var st1
begin GameMode
	
	Let rf1 := MartinRef
	Let sh1 := 1
	Let st1 := "My name is"
	
	PrintToConsole "Hello World!"
	PrintToConsole "value of var sh1 is %g" sh1
	PrintToConsole "value of var st1 is %z" st1
	PrintToConsole "rf1 have name %n and FID %i" rf1 rf1
	PrintToConsole "Valiables can be print out like this : %z %n. %p knows sh1 is %g" st1 rf1 rf1 sh1
end

but when in game you must have quest or something like that

because quest can store variable that can be called anywhere

example

you have Quest 'TestPrint' and attached 'TestPrintQuestScript'

then in that script you have variable 'short myValueA' and 'short myValueB'

when in-game

you can assign in like this

set TestPrint.myValueA to 999 ;---> notice that when calling from script you don't write its script name (that attached to the quest), but the Quest name instead

or you can do something like this

set TestPrint.myValueA to TestPrint.myValueA > TestPrint.myValueB

sadly Object script variable can't be accessed directly

but if you insist to know variable in Object script, you can ! by using a little trick

how?

you should make a variable that update Quest variable of the same type in that object script

then ... when you call that quest variable, it will be the same as the Object script one

this method is not very elegant

Edited by lubronbrons
Link to comment
Share on other sites

Side notes about charge:
- With my script the chargeCost variable can't be 0, as that case is already covered in the previous check.
- Don't assume an enchantment have a cost. You can create enchantments with no cost. It won't be the case in your mod, as you already know your enchantment and you know the cost is not 0.
- If GetCurrentCharge doesn't work, don't do Player.GetEquippedCurrentCharge 16. The weapon may be wielded by anyone (not necessarily the Player: you may be disarmed by a left/right power attack and the enemy may take your weapon). Better use owner.GetEquippedCurrentCharge 16.

 

 

About the code:

...
ElseIf switchWeapon
   Let switchWeapon := 0
   RemoveMe
...

Let switchWeapon := 0 is useless. With RemoveMe the weapon and it's script instance are completed destroyed and won't run anymore. The script will stop exactly on the command RemoveMe (like a Return).

 

 

Be carefull there:

SetEnchantmentCharge 0 temp

Temp is a weapon. SetEnchantmentCharge is a command which takes an enchantment (not a weapon) and alter the field "Charge amount", which (1) is unused by the game* and (2) it's an enchantment base object's field, not a weapon reference's charge. You need to change the weapon charge with the command SetCurrentCharge:

Let charge := owner.GetEquippedCurrentCharge 16   ;get the charge from the weapon before you remove it
temp.SetCurrentCharge charge   ;apply it to the newly added weapon

.

 

 

* The CS wiki states: "Charge Amount: The charge capacity required of an item/soul gem in order to imbed this enchantment.". When you enchant with a soulgem, you can't use premade enchantments in the esm/esp, but you always create a new one, so this the field is completely useless.

Edited by forli
Link to comment
Share on other sites

just for knowing there is a way for see the value of a variable during the game?

 

Hmm, can you really use the "script" name in console from inside the game? Last time I checked I had to use the "quest" name there as well.

 

Oh, and there's more ways to just read a variable of a quest or object inside the game than specifically scripting something to debug output it.

 

- With the command "sqv <quest name>" (ShowQuestVariables) you can always get a complete list of all the variables inside a quest's script to see their current values.

- With the command "show <quest name>.<variable name>" you -should- be able to ask for a specific one as well, but I can't say I've ever tried that before. I do know "show" can be used to view -global- variables and stuff though.

- And finally with the command "sv" (ShowVariables) you can get a list of all variables from inside scripts currently running on an object as well (just select one first by clicking on it while the console is open). This might be a little convoluted, as there's possibility to have multiple scripts running on a single object at the same time, which will create quite a mix of different variables, some even with the same names perhaps, but still it is a nice means to debug these at times.

 

(The "<...>" are placeholders, do not type the "<" or ">" when replacing them with a real quest's or variable's name!)

Link to comment
Share on other sites

sorry for retaking this up, but i wanted to know if you there is a way you know of for not making the weapon resheat when switching one with another,

for example in this case when the weapon discharge, it equip the non-flaming weapon by doing the sheathe animation, if this cuold be avoided by just replacing the weapon it would be cooler.

but i don't know if it is possible sadly, i can't see any way of doing it.

 

i don't know if you can understand i really need to get some new english lesson =)

Link to comment
Share on other sites

maybe this will help

read and learn here bro >>> cs wiki SetModePath

you must learn this too >>> Update3D

I never use that syntax, so I can't help much

but this is just a guess, you can use that syntax like this (not confirmed)

SetModelPath "meshes\XXXyourFlamingModel.nif" XXXyourFlamingSword
youCurrentEquipFlameRef.Update3D
Edited by lubronbrons
Link to comment
Share on other sites

  • Recently Browsing   0 members

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