Aller au contenu

Photo

Need Help with basic Item script


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
Bischofk

Bischofk
  • Members
  • 1 messages
Hey guys, I am brand new to this forum and modding NW2.

I have been trying to read through several tutorials, and have figured much out on my own, but I cannot for the life of me get scripts to fire when using the "on used script" for a placable.

Here is my situation.  I want to create a part of a quest where  you find a skeleton and want to click on it, and receive an item, to return to the quest starter.  I have made the placable (skeleton) usable etc, and created a basic script that uses the ga_give_item script to give the item that I want, the script just does not seem to ever fire.  On the skeleton I have placed my script under the "On Used Script".  Is there something I am missing?

Could somone point me to a basic example of what im trying to do?  Is there a way to pass parameters to a script automatically, similar to how you can pass custom parameters in a conversation when firing a script? 

Thx for any help ahead of time!!!

#2
Morbane

Morbane
  • Members
  • 1 883 messages
The "ga" script is a global action script meant for conversations - so it will not work the way you are trying.

There is a method of scripting called "tag based scripting" google it for nwn2 and you should get some good examples.

Items are never actually "used" - placeables can be used but not items. Items are activated. Try doing those things then post what your new question will be - I think you might get a fair bit before you need to ask because tag based scripting isn't too difficult once you do it once or twice + help from the forums of course.

Cheers.

#3
Morbane

Morbane
  • Members
  • 1 883 messages
Ok - I re-read your post - you want a skeleton to get used - so it must be a placeable. Have a look at this example:

void main()
{
object oPC = GetLastUsedBy();

object oItem = GetObjectByTag("skeleton");

CreateItemOnObject("item_res_ref", oPC);
}

Try that out for starters - I just whipped that up so it compiles but it is not tested in game.

#4
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
The easiest thing to do here for this situation is in the skeleton's/placeable's properties to click flase (unchecked) Static, true (checked) Useable, and true (checked) Has Inventory. Then go to the inventory tab on the properties and give it whatever it is you want the player to find. In game, when the skeleton is clicked on an inventory screen will open and the player can take the item (same way a chest would work).

#5
Morbane

Morbane
  • Members
  • 1 883 messages
Yep, Just give the placeable an inventory - lol - I do it all the time, I didn't think to apply that here. I use this method on things like a rock, as if something was hidden beneath it.

If you make a placeable useable it will also get highlighted when the playes presses the 'z' key.

Modifié par Morbane, 08 mai 2011 - 01:24 .