TriggerGod Posted August 22, 2009 Share Posted August 22, 2009 Just a minor scripting issue that I am having. And by minor, I mean something that any good (or average ) scripter could probably figure out. I am trying to spawn a custom item into the Exile's footlocker on the Harbinger. I made a script and had VP revise it quickly for me. Here is my current script: void main (){ CreateItemOnObject( "[color="DeepSkyBlue"]item_tag[/color]", GetObjectByTag("g_tresmillow007")); } item tag is my... item's tag. (of course... >.>) Link to comment Share on other sites More sharing options...
Star Admiral Posted August 22, 2009 Share Posted August 22, 2009 If I'm not mistaken, the tag for the PC's footlocker is "MilLowFootLker". - Star Admiral Link to comment Share on other sites More sharing options...
TriggerGod Posted August 22, 2009 Author Share Posted August 22, 2009 If I'm not mistaken, the tag for the PC's footlocker is "MilLowFootLker". - Star Admiral I was under the impression that it was the resref I would put in the script. But it didn't matter. For some reason, the script didn't fire correctly even with MilLowFootLker as the placeable tag. I could try to use the tag in my old script, before VP revised it. EDIT: Still nothing. Old script: void main () { object oItem=CreateItemOnObject( "item_tag", GetObjectByTag("MilLowFootLker")); } Link to comment Share on other sites More sharing options...
Nirran Posted August 22, 2009 Share Posted August 22, 2009 CreateItemOnObject("item_tag", GetObjectByTag("MilLowFootLker"),1); the 1 is saying create 1 of those items,what is triggering the script?that maybe why Nirran Link to comment Share on other sites More sharing options...
TriggerGod Posted August 22, 2009 Author Share Posted August 22, 2009 CreateItemOnObject("item_tag", GetObjectByTag("MilLowFootLker"),1); the 1 is saying create 1 of those items, I didn't have to put a 1 in an older script that spawned my inheritor model in a custom footlocker, so I don't see why I would have to put one in this one. Besides, my problem is that it isn't spawning in the placeable at all. what is triggering the script? the first line that kreia says right after you notice your room. "Are you alright?" or something like that. Thats when I have my script go off. Link to comment Share on other sites More sharing options...
zbyl2 Posted August 22, 2009 Share Posted August 22, 2009 There are few placeable objects with the same tag in this module. It probably spawns an item, but in another footlocker. Not sure if it would do anything, but you might try replacing GetObjectByTag() with GetNearestObjectByTag(), so it'll spawn item in the nearest footlocker instead of some random one. If it won't work, it might be necessary to edit .utp file of "player's footlocker" to have unique tag. Link to comment Share on other sites More sharing options...
DarthStoney Posted August 22, 2009 Share Posted August 22, 2009 I made some custom items, for personal use, to spawn in the Exile's locker. It was actually easier to use the TSL patcher and install the item(more or less) directly into that footlocker. Link to comment Share on other sites More sharing options...
TriggerGod Posted August 22, 2009 Author Share Posted August 22, 2009 There are few placeable objects with the same tag in this module. It probably spawns an item, but in another footlocker. Not sure if it would do anything, but you might try replacing GetObjectByTag() with GetNearestObjectByTag(), so it'll spawn item in the nearest footlocker instead of some random one. If it won't work, it might be necessary to edit .utp file of "player's footlocker" to have unique tag. It didn't work. And I would like to keep mod compatibility issues down, so I can't just edit the placeable's name, because the game won't recognize the new placeable unless I edit the module itself. Of course, if I had a script that would let me get rid of/destroy the current placeable, than replace it with a new one... Link to comment Share on other sites More sharing options...
Star Admiral Posted August 22, 2009 Share Posted August 22, 2009 Try adding SendMessageToPC( GetFirstPC(), "I ran." ); to the script just to see if it fires at all. If it did, the message should appear in the player's journal. - Star Admiral Link to comment Share on other sites More sharing options...
VarsityPuppet Posted August 22, 2009 Share Posted August 22, 2009 It didn't work. And I would like to keep mod compatibility issues down, so I can't just edit the placeable's name, because the game won't recognize the new placeable unless I edit the module itself. Of course, if I had a script that would let me get rid of/destroy the current placeable, than replace it with a new one... No need. I got your script. However, zbyl is partially right: the PC locker has the same tag as another empty footlocker. You might want to give the PC locker a unique tag first though... Anyways, since the script for some reason was just not firing, I decided to simply add it to the a_openpcdoor script, since obviously that one was working. void main() { object oPCDoor = GetObjectByTag("PCDoor", 0); AssignCommand(GetFirstPC(), ActionOpenDoor(oPCDoor)); object oPCbox = GetObjectByTag("[color="DarkOrange"]container_tag[/color]", 0); CreateItemOnObject("[color="DarkOrange"]item_tag[/color]", oPCbox, 1, 0); } save it as "a_openpcdoor" and compile it. It worked for me. If you want to get more complex and use dialog embedded script parameters and whatnot then that'll be a bit more compatible... Link to comment Share on other sites More sharing options...
TriggerGod Posted August 22, 2009 Author Share Posted August 22, 2009 Try adding SendMessageToPC( GetFirstPC(), "I ran." ); to the script just to see if it fires at all. If it did, the message should appear in the player's journal. - Star Admiral Curious. I put that into my script, and it ran perfectly. I had a thought about scripting, so I opened up the footlocker. It was there. I decided to test my thoughts out, and I removed the SendMessageToPC line from the script, and compiled. Apparently, if you have a singular function on its own in a script, it won't run. But if its longer than the one function, such as with the SendMessage line, it run perfectly. Anyways, thanks for the help, everyone. Link to comment Share on other sites More sharing options...
R2-X2 Posted August 23, 2009 Share Posted August 23, 2009 You could use a space for the message sent to the Pc, so you'll get your item, but there's no message. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.