Jump to content

can a magic effect be applied via inventory item?


bombchu

Recommended Posts

BTW I'm not sure if there is a way you can directly apply a magic effect via script, you need to make it into a spell and use SpellName.Cast(akNewContainer) Correct me if i'm wrong :tongue:

I think you are correct. I had to do a similar thing with the dialogue portion.

Link to comment
Share on other sites

  • Replies 40
  • Created
  • Last Reply

Top Posters In This Topic


 

 

Oh, I see. Stupid mistake thinking the containers had to have object references attached to them. But i can't seem to attach a script to my item :/ The dropdown menu is empty and the [...] button does nothing. It's an apple, if that helps. Is there something I'm missing?

 

Yeah certain items such as food can't have scripts attached to them, make a miscitem with the apple model and use that instead.

Edited by Anikma
Link to comment
Share on other sites

All object references can have scripts, so if it's a particular apple you can attach it to the specific apple's reference. But that means the apple needs to be placed in the world somewhere that it can then be picked up. It's probably easier and better to just make a misc. item that has the apple mesh (which can also prevent the player from accidentally eating it).

Link to comment
Share on other sites

All object references can have scripts, so if it's a particular apple you can attach it to the specific apple's reference. But that means the apple needs to be placed in the world somewhere that it can then be picked up. It's probably easier and better to just make a misc. item that has the apple mesh (which can also prevent the player from accidentally eating it).

Also I believe that if the player had other apples in their inventory they would stack and break the script. Just do the miscitem.
Link to comment
Share on other sites

The apple is one of my own making, and shouldn't affect/be affected by the properties of any other apple in the game. For my own personal taste regarding presentation and immersion, I really like the idea of it being stored in the food pouch, and have been careful not to make any changes that would affect that. Also, even though there's no reason for the player to eat it (other than curiosity), I love the idea of them being able to if they choose, and have even made a separate effect for that event. But I definitely see the merit in making it a misc item, and will likely end up doing so before it's said and done.

 

As for now, I'm playing with applying the effect with a player owned spell that only affects actors with the item in their inventory. I haven't been able to get the condition to work, however. On the page that Anikma linked me to earlier, it says this: "Once an object has been added to a container it is no longer valid to call functions on it. Functions on self will fail to run with an error." I would imagine this means that I can't reference items in actor inventories under conditions. If anyone knows a way do make this work please let me know.

 

Thanks again :)

Link to comment
Share on other sites

Here is the wiki page about functions.

 

You can add an OnEquip event to apply the eating effect, just have the script remove the apple and play the eating sound and it will almost be exactly the same as if it was food. I would just go with the miscitem man :P

Link to comment
Share on other sites

Yea, that's what I decided to do, and the script that cdcooley suggested is working beautifully. Thanks man ;) I do have a few questions though, if that's ok. I realize that this information is out there just waiting to be researched, but I have terrible trouble staying focused and I always end up with 15 browser tabs open, forgetting what I was even looking for.

 

1) What is the specific code for playing the "eat" sound and animation?

 

2) Is there a way to add a description to a misc item?

 

3) Is there a script function for delaying an event by a set number of seconds?

 

 

I really appreciate the help here. You guys are awesome :)

Link to comment
Share on other sites

1) I can't find the name of the sound file as I'm typing this from my phone but the script command you would use is MySound.Play() I'll have a look for the sound file when I get home.

 

2) Not sure about this, again I'll have a look when I can.

 

3) To execute a delay in a script use Utility.Wait(x) with x been the number of seconds to wait.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...