script rewrite

Post » Wed Apr 07, 2010 5:47 pm

*snip* new code down below
User avatar
mike
 
Posts: 3432
Joined: Fri Jul 27, 2007 6:51 pm

Post » Wed Apr 07, 2010 2:22 pm

Maybe write the script a bit more generic. OBSE has some neat commands, such that you can scan the players inventory for ANY alchemy ingredient, and find its effects.

First, use http://cs.elderscrolls.com/constwiki/index.php/GetNumItems to see how many unique items the player has in his/her inventory. Note: this counts UNIQUE items only, which is really what ya want...... it does not differentiate between having one steel blue entomola cap, or 5000.

Then, when you know how many items the player has, cycle thru them to find alchemy ingredients, using http://cs.elderscrolls.com/constwiki/index.php/GetObjectType. (25 is ingredients)

If you find an ingredient, then you use http://cs.elderscrolls.com/constwiki/index.php/GetNthEffectItemCode, to test the four possible positions of the type of effect you are looking for. I am currently unable to come up with a table of just what the codes are though..... there HAS to be one..... or, you may need to do a bit more hoop jumping to discover them within the script. If you find an effect you are looking for, increment your counter, or, test to see if there is more than one of them first, with http://cs.elderscrolls.com/constwiki/index.php/GetItemCount, and increment your counter by that. (of course, you would then have to make sure you removed that number of them too.... depending on what it is you had in mind.)

I assume that this script will just be running in some manner of menumode?
User avatar
Austin Suggs
 
Posts: 3358
Joined: Sun Oct 07, 2007 5:35 pm

Post » Wed Apr 07, 2010 3:59 pm

Maybe write the script a bit more generic. OBSE has some neat commands, such that you can scan the players inventory for ANY alchemy ingredient, and find its effects.

First, use http://cs.elderscrolls.com/constwiki/index.php/GetNumItems to see how many unique items the player has in his/her inventory. Note: this counts UNIQUE items only, which is really what ya want...... it does not differentiate between having one steel blue entomola cap, or 5000.

Then, when you know how many items the player has, cycle thru them to find alchemy ingredients, using http://cs.elderscrolls.com/constwiki/index.php/GetObjectType. (25 is ingredients)

If you find an ingredient, then you use http://cs.elderscrolls.com/constwiki/index.php/GetNthEffectItemCode, to test the four possible positions of the type of effect you are looking for. I am currently unable to come up with a table of just what the codes are though..... there HAS to be one..... or, you may need to do a bit more hoop jumping to discover them within the script. If you find an effect you are looking for, increment your counter, or, test to see if there is more than one of them first, with http://cs.elderscrolls.com/constwiki/index.php/GetItemCount, and increment your counter by that. (of course, you would then have to make sure you removed that number of them too.... depending on what it is you had in mind.)

I assume that this script will just be running in some manner of menumode?


no, it is a container that converts items based on what is placed inside, and its alchemical effects.
User avatar
Victor Oropeza
 
Posts: 3362
Joined: Sun Aug 12, 2007 4:23 pm

Post » Wed Apr 07, 2010 11:42 am

Converts them to what?
User avatar
Shae Munro
 
Posts: 3443
Joined: Fri Feb 23, 2007 11:32 am

Post » Wed Apr 07, 2010 3:36 pm

Converts them to what?


this is a redo of the magical portion of the arrow forge. it converts them into enchanted arrows. based on the abilities of the alchemy ingredients.

the arrows are preset to what effects are needed. that part works
User avatar
ZzZz
 
Posts: 3396
Joined: Sat Jul 08, 2006 9:56 pm

Post » Wed Apr 07, 2010 4:43 pm

ok, are you doing one arrow per ingredient added? or, a batch of arrows per ingredient? I have never used the mod in question......

It would be possible to also set it up so the chest could use more than one ingredient per arrow, and have a stronger effect. :D

I don't recall if their are any ingredients that have multiple effects either, which may or may not complicate things..... something like fire damage, AND frost damage, or some such. I take it you put some ingredients in the chest, add a stack of arrows, close it, and it 'enchants' the arrows with whatever effect the ingredient has?
User avatar
Heather Stewart
 
Posts: 3525
Joined: Thu Aug 10, 2006 11:04 pm

Post » Wed Apr 07, 2010 12:27 pm

ok, are you doing one arrow per ingredient added? or, a batch of arrows per ingredient? I have never used the mod in question......

It would be possible to also set it up so the chest could use more than one ingredient per arrow, and have a stronger effect. :D

I don't recall if their are any ingredients that have multiple effects either, which may or may not complicate things..... something like fire damage, AND frost damage, or some such. I take it you put some ingredients in the chest, add a stack of arrows, close it, and it 'enchants' the arrows with whatever effect the ingredient has?


let me break it down, I am bad at getting people to understand me...

the arrows exist in vanilla. these are not modded.

1. you put an arrow type into the forge, number doesnt matter.
2. you put herbs into the container with them 3. a formula is run
4. based on the total value of the herbs inside, say its 30, each fire arrow requires 1 iron arrow and 5 point of fire. than it would take 6 iron arrows out of the stack, and return 6 fire arrows. destroying the original 6, and the herbs placed inside.
5. if the arrows were immolation, than a glass arrow would be needed, and take 50 points per arrow

the calculations script works, what I need is the tier set up

byt first I need it to be able to scan the random ingredients, match them against a preset effects table to see if the meet the required effect, and place the count in the appropriate tier effect



right now it is encoded as you see above as a hard coded value function.

I want to keep seperate effect functions, IE fire function for total fire, shock function for total shock, but able to scan any material to match. not what is hard coded. this way it plays nice with any other mod, and doesnt have to be hardcoded for every new mod I want, or when a mod updates and changes any effects.

total fire = FireT1 total + FireT2 total + FireT3 total + FireT4 total.
User avatar
Robert
 
Posts: 3394
Joined: Sun Sep 02, 2007 5:58 am

Post » Wed Apr 07, 2010 8:33 am

Ok, are you going to allow multiple ingredient flavors (with the same effect) per batch?
User avatar
City Swagga
 
Posts: 3498
Joined: Sat May 12, 2007 1:04 am

Post » Wed Apr 07, 2010 7:04 pm

Ok, are you going to allow multiple ingredient flavors (with the same effect) per batch?


yes, and if an ingredient has multiple effects, it can be used for multiple items, the ingredient doesnt get destroyed til the very end.

if it does restore health - fire damage - drain magicka - fire shield - frost damage

examples are not accurate


it would both make arrows of frost and arrows of fire

50 iron arrows
frost arrows cost 5 each, fire arrows cost 5 each


33 points fire
75 points frost

would make 6 fire arrows, 15 frost arrows, and have 29 iron arrows left over

3 points of fire go bye bye


original version is here, with readme that explains it better. this is NOT a public release
User avatar
Code Affinity
 
Posts: 3325
Joined: Wed Jun 13, 2007 11:11 am

Post » Wed Apr 07, 2010 4:24 pm

This is just a part of the script. and a best guess at that.... but, the method should work.

containerref <- Your chest. replace it with whatever the editor ID of the chest is.

short counted 			; a switchshort numberitems		; number of unique items in chestshort itemcount			; number of items in stackshort itemtype			; variable for item typeshort firetotal			; running total of fire effectslong effecttype			; variable for effect typeref itemref			; reference varible for items in chestref effectref			; variable for magic effect on itemif (counted == 0)	set numberitems to containerref.getnumitems	set counted to 1	set effecttype to GetMagicEffectCode FIDG				; set effect type to fire damage, in this case.endifif (numberitems >= 0)	set itemref to containerref.getinventoryobject numberitems	set itemtype to itemref.getobjecttype	set itemcount to containerref.getitemcount itemref	if (itemtype == 25) 							; if it is an ingredient		if (effecttype == GetNthEffectItemCode itemref 1)		; if it has the right effect in the first spot			set firetotal to (firetotal + (itemcount * multiplier))	; multiplier is whatever you had it set to.			set numberitems to (numberitems - 1)			return		endif		if (effecttype == GetNthEffectItemCode itemref 2)			set firetotal to (firetotal + (itemcount * multiplier))	; multiplier is whatever you had it set to.			set numberitems to (numberitems - 1)			return		endif		if (effecttype == GetNthEffectItemCode itemref 3)			set firetotal to (firetotal + (itemcount * multiplier))	; multiplier is whatever you had it set to.			set numberitems to (numberitems - 1)			return		endif		if (effecttype == GetNthEffectItemCode itemref 4)			set firetotal to (firetotal + (itemcount * multiplier))	; multiplier is whatever you had it set to.			set numberitems to (numberitems - 1)			return		endif	endifendif


this particular code bit would assume you had a menu to select what type of object you were making. For this example, it would be fire arrows. This would only get you the total 'points' for the fire effect, which you can do with as you will.

I think this will do what you want. The way this is geared, it will start with the LAST item on the list of stuff in the chest, and work its way to the beginning of the list, only checking ingredients for the specific effect. I got the FRDG from the construction set, as that is the "code" for fire damage. At some point, you would have to reinitialize the control variables counted, and numberitems. (number items will get to -1, at that point, you know you have gone thru each item in the chest.) also need to reset firetotal when done with it.

Does that help?
User avatar
Stephy Beck
 
Posts: 3492
Joined: Mon Apr 16, 2007 12:33 pm

Post » Wed Apr 07, 2010 2:36 pm

this helps alot!

I take it you dl'd the info then?

my friend comes by tuesday, we will both go over the mod and adjust accordingly. I will put a progress update there.

should I move this to a new topic in mods or keep as cs?
User avatar
Breautiful
 
Posts: 3539
Joined: Tue Jan 16, 2007 6:51 am

Post » Wed Apr 07, 2010 7:25 pm

Since this is a [Wipz} (work in progress) you can start a [Wipz] thread in the Mods section.

Nope, that is just a generic script snippet. you will have to fill in some of the information there, but, it is adaptable to ANY effect you want to use. Just change the editor ID of the effect you are looking for, and maybe a different variable name for the 'total points', and it will work. Use some flavor of 'switch' variable, to determine which effect loop you want to run. (set from a menu of choices.)
User avatar
Deon Knight
 
Posts: 3363
Joined: Thu Sep 13, 2007 1:44 am

Post » Wed Apr 07, 2010 11:38 am

still need help with this function, something isnt right it isnt adding up the fire damage effect and passing the totalfire

scn functionCountFire
; 0 "DGFA" ; Damage Fatigue
; 1 "DGHE" ; Damage Health
; 2 "DGSP" ; Damage Magicka
; 3 "DSPL" ; Dispel
; 4 "FIDG" ; Fire Damage
; 5 "FISH" ; Fire Shield
; 6 "FRDG" ; Frost Damage
; 7 "FRSH" ; Frost Shield
; 8 "LGHT" ; Light
; 9 "SHDG" ; Shock
; 10 "LISH" ; Shock Shield
; 11 "SLNC" ; Silence



ref CNTRef

short TotalFire

; Variable from sample script (Taken from forums)

short counted ; a switch
short numberitems ; number of unique items in chest
short itemcount ; number of items in stack
short itemtype ; variable for item type

long effecttype ; variable for effect type

ref itemref ; reference varible for items in chest
ref effectref ; variable for magic effect on item

; Variables added by Wayfarers_Shadow

short Alchemy ; Contains the players Alchemy skill

short multi1 ; Multiplier for first tier effects, Alchemy scaled.
short multi2 ; Multiplier for second tier effects, Alchemy scaled.
short multi3 ; Multiplier for third tier effects, Alchemy scaled.
short multi4 ; Multiplier for fourth tier effects, Alchemy scaled.

begin Function {CNTRef}

Set Alchemy to Player.GetActorValue Alchemy

set counted to 0

Set TotalFire to 0

if (Alchemy < 25)
set multi1 to 15
set multi2 to 0
set multi3 to 0
set multi4 to 0
elseif (Alchemy < 50)
set multi1 to 20
set multi2 to 30
set multi3 to 0
set multi4 to 0
elseif (Alchemy < 75)
set multi1 to 25
set multi2 to 40
set multi3 to 60
set multi4 to 0
elseif (Alchemy < 100)
set multi1 to 30
set multi2 to 50
set multi3 to 70
set multi4 to 90
else
set multi1 to 45
set multi2 to 75
set multi3 to 105
set multi4 to 135
endif

if (counted == 0)
set numberitems to CNTRef.getnumitems
set counted to 1
set effecttype to GetMagicEffectCode FIDG ; Set effect. See List above in Documentation.
endif

while (numberitems >= 0)
set itemref to CNTRef.getinventoryobject numberitems
set itemtype to itemref.getobjecttype
set itemcount to CNTRef.getitemcount itemref
if (itemtype == 25) ; If the item is an ingredient
if (effecttype == GetNthEffectItemCode itemref 1)
set TotalFire to (TotalFire + (itemcount * multi1)) ; multi1 is scaled for players Alchemy, see above.

endif
if (effecttype == GetNthEffectItemCode itemref 2) ; Check second tier for Effect[index] type
set TotalFire to (TotalFire + (itemcount * multi2)) ; multi2 is scaled for players Alchemy, see above.

endif
if (effecttype == GetNthEffectItemCode itemref 3) ; Check third tier for Effect[index] type
set TotalFire to (TotalFire + (itemcount * multi3)) ; multi3 is scaled for players Alchemy, see above.

endif
if (effecttype == GetNthEffectItemCode itemref 4) ; Check fourth tier for Effect[index] type
set TotalFire to (TotalFire + (itemcount * multi4)) ; multi4 is scaled for players Alchemy, see above.

endif
set numberitems to (numberitems - 1)
endif
loop

setfunctionvalue TotalFire

end
User avatar
Colton Idonthavealastna
 
Posts: 3337
Joined: Sun Sep 30, 2007 2:13 am


Return to IV - Oblivion