Add action to item in inventory?

Post » Sun Nov 18, 2012 10:23 am

I am trying to figure out how to add an action to an item in your inventory.

Basically I want to create a new type of race that eats ores and gems in order to gain power from them. This race would not be able to wear equipment and I want to make it balanced but I want to give a unique experience.

My thought it that each type of ore or gem would increase magicka, magicka regen, health, health regen, armor rating etc. I was thinking of modeling each type of increase as a permanent buff so that when you eat an item the buff grows stronger.

Is this idea even viable?

Any thoughts on doing this? Ideally I want to give the race no real body just a kind of cloud like mist.
User avatar
Jinx Sykes
 
Posts: 3501
Joined: Sat Jan 20, 2007 11:12 pm

Post » Sun Nov 18, 2012 6:06 pm

The problem you will have is that a character cannot currently eat a gemstone.

And I cannot think of a way of a charcater ACTIVATING a gemstone at all.

If the objects you wanted to be edible were activators, then it would be fairly straight-forward ... but as they are not, then it definately is not.

I think you would have to make your own "edible entities" (as activators) ... then, when one is activated by the player (in inventory or in world) you could add a script to that OnActivate event that does whatever you want (increase magika or whatever).


A very interesting idea ... but I fear it will make your hair bleed before you get it working exactly how you want :(
User avatar
Kim Kay
 
Posts: 3427
Joined: Fri Oct 13, 2006 10:45 am

Post » Sun Nov 18, 2012 4:31 am

It looks like my best option would be to make new smithing recipes where you could turn things into essence potions and then drink those potions. Smithing seems pretty flexible in what you can put in and get out.

It looks like my first step is to copy an existing race and just make all the recipes work and figure out how to make it so they can't use armor. After that I will worry about getting rid of their body.

My current plan is to see if I can store some kind of value for how many points there are in each essence (health regen, magicka regen, etc) and then calculate the actual effect based on that. This way if they are not balanced very well a different calculation can be used without changing the existing data.
User avatar
WTW
 
Posts: 3313
Joined: Wed May 30, 2007 7:48 pm

Post » Sun Nov 18, 2012 5:46 pm

Isn't the gemstone nif just graphic art work ? Couldn't a person in theory create a food object call it gem and assign the gem art work as the picture source ?
User avatar
A Boy called Marilyn
 
Posts: 3391
Joined: Sat May 26, 2007 7:17 am

Post » Sun Nov 18, 2012 6:22 pm

I am sure you could but I wanted this to work with existing objects so I did not have to create new loot tables etc. That is why I just wanted to add an eat option to existing ores and gems. Instead I will try to do it with smithing.

Should be interesting to figure out how to make the character not compatible with armor. I want to allow weapons and I should probably allow rings and amulets so that more quests will work at least unless I can figure out another way for them to work.
User avatar
Kelly Osbourne Kelly
 
Posts: 3426
Joined: Sun Nov 05, 2006 6:56 pm

Post » Sun Nov 18, 2012 4:54 pm

The problem you will have is that a character cannot currently eat a gemstone.

And I cannot think of a way of a charcater ACTIVATING a gemstone at all.
i don't see a problem with the activation, the vanilla gems are pickable objects after all.
the thing is though, in skyrim, nobody actually _needs_to_eat _ at all, so any "eat something else instead"-approach won't get you anywhere. instead, rather think of it as a plain necessity to acquire a gem every once in a given while, and if they fail, their health gets decreased (or, if they succeed, the gem removed from their inv, maybe some eating animation played and all is fine). this can easily be done with scripts, controller quests, packages or what not.

like the gem-eating folk idea, btw. :-)

ah yes, and for the nothing-equippable-part: i'm not sure what enables/disables actors from equipping stuff (think it's addon slots in the nif though), but anyhow, animals can't by default. so maybe you can just abuse some animal race to create yours. :-)
User avatar
April
 
Posts: 3479
Joined: Tue Jun 20, 2006 1:33 am

Post » Sun Nov 18, 2012 3:05 pm

I think there's a switch for can't where armor (isn't there?! ... Maybe I made that up ... but I'm sure there's an easish way ... Maybe I'm thinking of Weapons (there is an easy way to do that!)

Activator: You can pick gems up, but I don't think that's the same as activation.

HOWEVER: That did prompt me to think that the act of picking one up is captureable and scriptable ... So hold you horses on your (nice, I liked it) work-around with smithing.


Chase this for an hour or so, to see if it suits you:

You can script the OnContainerChanged Event: http://www.creationkit.com/OnContainerChanged_-_ObjectReference

So, if the player (and/or an NPC) picks up a gemstone it's oncontainerchanged event could be used to either fire off a load of scripts, or turn the genstone into ObjectB (which would be an activateable object, that you probably designed and modded yourself) that - when activated - runs your ton of scripts.


OR, you could (I think) use the StoryManager System (though if you have never used it before you might find it a bit frustrating to start with).

SM has "Player Add Item" and "Player Remove Item" events, which you could use to test if the "correct" gemstone had been added to the player's inventory (or removed from it) and then have a quest fire that sorts out your magika and effect scripts.


Either of those is worth a look.

But if you stick with the smithing idea ... "Craft Item" is a Story Manager Event that might help you out.



Best of luck, still think it's a nice idea :smile:
User avatar
Josee Leach
 
Posts: 3371
Joined: Tue Dec 26, 2006 10:50 pm

Post » Sun Nov 18, 2012 6:35 pm

Or you can add a Player alias to your quest that points to the player ... and then you get all sorts of fun events. Like "ItemAdded" or "OnObjectEquipped". So if you transform normal gems into your special equipable gems when they are added... Personally, I would make the custom item a "book". So that they can look at the gem before deciding to consume it. THen you can write a handler for when the book is "opened" or when the spell is taught.

Player Aliases are wierd. I find events dont always fire if I assign the player alias based on conditions via the alias setup screen. I find it is better to make the alias optional and then have an OnInit() block on the quest script that assigns the alias to Game.GetPlayer() when the quest is loaded. I also add a delay if th GlobalVaribale GameDaysPassed isn't greater than 1, as the person maybe starting a new game and the player object may not exist when the script runs. A little bit of work, but this seems to be more reliable if you are looking to receive player events.

As for a race that can't wear clothes, check our the werewolf race. And also... be careful with race changes. Werewolves and vampires are different races. So if you character trasnforms into a werewolf or vampire, they may not properly change back as the vanilla scripts are unaware of your custom race. YOu may need to extend the vanilla scripts to check for and change your character back to the proper race. Or ... maybe you just make your race "immune" to the disease that causes werewolf and vampire race changes.
User avatar
Horse gal smithe
 
Posts: 3302
Joined: Wed Jul 05, 2006 9:23 pm


Return to V - Skyrim