Two scripting questions, very relevant to my project

Post » Wed Dec 09, 2009 4:27 am

I have two questions regarding scripting.

A: What is the script to add to an object, that when selected from a container blocks it from being transferred to the player's inventory? The default "NoPickup" script works on items in the environment, but not items in containers. I need to be able to see the contents of the container in the game world, but the container I need this for already has a script on the container itself, which if I removed that script would break my project, so the script has to go on the individual items.

B: What is a good script I can apply to creature objects that will prevent them from walking or attacking, but makes them unkillable and unprovokable? Basically I want to do "animated creature mannequins".
User avatar
celebrity
 
Posts: 3522
Joined: Mon Jul 02, 2007 12:53 pm

Post » Wed Dec 09, 2009 10:26 am

I do not know of any method to prevent the player from picking up an item that is in inventory (either the player's or a container's). There are methods to prevent the player from equipping the item if that is ultimately what you are after. It is possible to remove/replace the item after the player has placed it in his/her inventory, but that would not look very good. If you give us a clearer idea of what you hope to achieve, we might have a solution that does not rely on the present elements.

I am not certain what you mean by an "animated creature mannequin'" since you specify that you do not want it to move, but I will take a guess. You should set their AI fight to 0 in the construction set (these are unique creature, yes?). Also set the creature's health to something ridiculously high (e.g. 9999). Attach the following script to prevent the creature from moving (head will still move however), responding to attacks and dying:

Begin mor_MannequinScript; Local script attached to (creature ID); Prevents animation, attacks and deathshort OnPCHitMeSkipAnimif ( OnPCHitMe == 1 )    set OnPCHitMe to 0    StopCombat player    SetFight 0    SetHealth 9999endifEnd mor_MannequinScript

This script does not provide for the player to activate the creature/mannequin to access its inventory. If the head movement is unacceptable (e.g. these are statues) It might be possible to paralyze them to prevent all movement.
User avatar
Darlene DIllow
 
Posts: 3403
Joined: Fri Oct 26, 2007 5:34 am

Post » Wed Dec 09, 2009 1:57 am

I completed the creature test using a copy of Dagoth Ur, who will stand by a door in my project. The creature script is exactly what I needed. I also deleted the default "Wander" package that shows up in the AI, to prevent walking. I will complete the rest of the creature mannequins tomorrow. Thanks!

The containers are mannequins, which are basically NPC's with a special script already attached, so if preventing taking items from them cannot be done on the original items maybe the script can be amended with a "no taking" instruction. However, their inventories need to be visible. Perhaps there is a way to code it so if the player takes an item, it disappears from the player's inventory and reappears in the container.
User avatar
Mariaa EM.
 
Posts: 3347
Joined: Fri Aug 10, 2007 3:28 am

Post » Wed Dec 09, 2009 5:32 am

I'm going on a new direction with the inventory thing. Because the mannequins are NPC objects, I'm going to remove the part of the script which causes them to show inventory and instead create a no-topic dialog block for each one which says what they carry. Therefore, I currently no longer need scripting help (right now at least).

One question: if I use the default "NoPickup" script on a few books, can they still be read?
User avatar
Danny Blight
 
Posts: 3400
Joined: Wed Jun 27, 2007 11:30 am

Post » Wed Dec 09, 2009 6:05 am

Ignore the book comment, issue resolved earlier. I took the creature script and improved it: by removing the stop-animation line, and deleting the default "Wander" package from the AI, and setting base AI values to 0, I have fully animated creature mannequins that never walk/fly/swim, never attack, and are indestructible! Note: it is important to create a copy of the creature object first- never change the base object or you could break your gamepath permanently!!!
User avatar
Prisca Lacour
 
Posts: 3375
Joined: Thu Mar 15, 2007 9:25 am


Return to III - Morrowind