Jump to content

Need help with a script


avebrave

Recommended Posts

i'm searching for a script to use with bu armor, the problem is that bu only support one model (male/female armor) so i need a script which interrogates the gender

of the actor wich equip the armor,not only pc should be suporrtet also npcs, because its an armor replacer.

 

my idea is to make two versions of the armor, one for male (puplic), one for females (hidden, only added/equipted if the actor is female)

 

on the "puplic" armor should be a script like this:

 

 

begin OnEquip

 

If player.GetIsSex female

player.additem "HiddenArmor" 1

player.equipitem "HiddenArmor"

player.removeitem "PuplicArmor" 1

endif

end

 

 

and on the "hidden" one like this:

 

 

begin OnEquip

 

If player.GetIsSex Male ;if for some reason a male gets the armor, lootet e.g.

player.additem "PuplicArmor" 1

player.equipitem "PuplicArmor"

player.removeitem "HiddenArmor" 1

endif

end

 

begin OnUnequip

 

player.removeitem "HiddenArmor" 1

player.additem "PuplicArmor" 1

end

 

 

 

how must the scripts looks like that both, pc and npc are supported?

Link to comment
Guest ThatOne

Try working with onAdd and onRemove scripts instead of onEquip, as they'll run less times by far (EX: If you want to keep the armor, they'll only ever run once).

 

If you want it to work for npcs as well, I guess you'll need something like getContainer followed by getIsSex (getSelf will crash the game under certain circumstances).

 

I am NOT sure if this will work, just trying to help.

Link to comment

great idea with onAdd/onRemove, but for some reason my game crash when i add the item

 

ref User

begin onAdd
set User to getContainer
if User.GetIsSex female
	User.additem "HiddenArmor" 1
	User.removeitem "PuplicArmor" 1
endif
end

 

so what else can i do?

Link to comment

So this armor has a script attached that will change the nifs when worned out?

How does it handle changing mesh?

 

Do yo have the link to main mod? I'll check it.

 

Cheers! (see you tomorrow' date=' nearly time for bed here :) )

[/quote']

 

Grumpf, the plugin is BUFramework. Link: http://oblivion.nexusmods.com/mods/29751

 

Version 2 (the latest) works off of an ini file. You put the unbroken mesh into the esp as per normal and then you put however many meshes you intend on using into the ini. The 1st mesh is the unbroken one and then you can have various stages of "broken" meshes until it is completely broken. The ini handles swapping out the meshes at the stages (depending on how many broken parts you have). Normally there are 1 unbroken and 3 broken meshes per set, but that is just typical and not a rule.

 

The problem is there is no mechanism built into it to use armors that are for both sexes as it can't distinguish if the npc is male or female and then use the appropriate meshes per sex. Rather it is just a straight forward swap out of meshes based on the damage to the armor. Thus it is only good for custom armors that are made for one sex or the other.

 

I would love to be wrong but I haven't found anything in the scripting that shows any evidence of allowing separate mesh sets for one armor for both sexes.

 

Cheers,

Greg

Link to comment

Ok I looked at the scripts and it's really difficult to dig into them like that as they're using a lot functions.

 

Question: How does BU swap armors? Are you playing with objects that are defined as armors in the CS like Armor01 Armor02 Armor03 in decaying order?

 

Or does it uses some kind of advanced nifs procedure to attach nifs to the same objects?

 

Do you a complete working mod I can use and try to see for myself?

 

Cheers!

Link to comment

All right, seems a bit complicated to just have it work so I'll just assume you redefine nifs for only one object.

A very hard way to deal with considering you needed only to redefine several objects and swap them when armor condition decreases... That would have allowed both genders easily but will not have been so flexible as to allow any nif...

 

Now, you can only have one armor that can break or you can have several?

 

In both cases, isn't it more efficient to create two different armors that are gender specific? The only way I see the need for a script is if you want random NPC such as bandits to wear it but It'll be simpler to handle items during NPCs spawning.

 

Tell me what you think and I can try to see if my fucked up mind can be of any help...

 

As for your script, you are removing the object running the script so of course it'll CTD :)

Link to comment

thank you for your help.

...

In both cases' date=' isn't it more efficient to create two different armors that are gender specific? The only way I see the need for a script is if you want random NPC such as bandits to wear it but It'll be simpler to handle items during NPCs spawning.

...

[/quote']

 

i want to replace the iron armor for any female user so that they use the bu-version. if this is not possible for all npc, than maybe for the respawning, like bandits.

the script work fine atm (only testet with pc now)

 

 

 

i made 2 armors a male and a female

On Armor (male and female) is this script:

ref User

begin onadd
set User to getcontainer
User.additem RingOfArmor 1
end

begin onremove
set user to getcontainer
user.removeitem RingOfArmor 1
end

on the RingOfArmor is this script:

ref User

begin onadd
set User to getcontainer
if user.getitemcount MaleArmor >= 1
	if User.GetIsSex female
		User.additem FemaleArmor 1
		User.removeitem MaleArmor 1
	endif
elseif
	if user.getissex male
		user.additem MaleArmor 1
		user.removeitem FemaleArmor 1
	endif
endif
end

 

 

what do i need to do to handle it during NPCs spawning?

Link to comment

Make the iron armor the ring... Then when NPCs will equip the iron armor, the script attached to it will equip the female BU version or the copied iron armor with the remove "ring" one.

 

So in other words:

 

Changed Vanilla Iron armor to the same with a script attached to it that will equip male or female armor.

 

Add a script to male & female armor to remove the modified Vanilla one.

 

You may also want to make those armors not playable.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use