What I wanted to do is that when your player receives a particular item in his inventory it should update the quest/journal with the message you have the item.
How to do this?
I found something called:
ITEM_SEND_ACQUIRED_EVENT
http://social.biowar.../index.php/Item
And:
EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED
http://social.biowar...N_ITEM_ACQUIRED
I found the ITEM_SEND_ACQUIRED_EVENT in the varible list of the item.
It is default at 0.
The wiki is saying that when true, EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED is sent to the module's event script when the item is aquired.
If I look at EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED the wiki is saying:
case EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED:
{
object oAcquirer = GetEventCreator(ev); // item acquierer
object oItemAcquired = GetEventObject(ev, 0); // the item that's been acquired
// Insert event-handling code here.
break;
}
I anyway presume I have to put a script somewhere with the above code in it.
I already have a script in my area (wich replaces the area_core) with a case EVENT_TYPE_TEAM_DESTROYED in it wich updates my journal, wich workes. Can I put it in the same script, as another case?
What do 'object oAcquirer' and 'object oItemAcquired' exactly mean?
I presume the first ones gives (stores) the name of the person/creature who acquired the item.
The second gives (stores) wich item is acquired.
So for what I want to do I need the second one I guess.
Can I compare that value with a particular item in an if statement?
So, can I check if the item wich is acquired is an item called gen_im_pelt_swerewolf.uti (in my case) for example?
If yes, how can I compare these two values?
I specificly don't know how to handle the gen_im_pelt-swerewolf.uti part of that, I have no experience with this language, I usually learn the most of (working) examples, but there's a lack of that kind of stuff for now.
Help needed: How to make a journal update when item received?
Débuté par
Tyharo
, nov. 09 2009 09:32
#1
Posté 09 novembre 2009 - 09:32
#2
Posté 04 décembre 2009 - 04:42
Tyharo I'm having the same problem, by any chance have you figured this out. I'm asking because I haven't seen any update on this problem. I'm hoping that you have figured this out. Please let me know if you have.
#3
Posté 04 décembre 2009 - 04:51
EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED is sent to the module, when you set the item's ITEM_SENT_AQUIRED_EVENT variable to 1.
So basically you use the "put item in player's pockets" example, using a custom module event script, and within instead of testing for EVENT_TYPE_MODULE_LOAD and giving an item you test for ITEM_SENT_AQUIRED_EVENT and update the journal.
GetEventCreator(ev) is the character who aquired the item, the item itself is GetEventObject(ev,0)
So for example:
So basically you use the "put item in player's pockets" example, using a custom module event script, and within instead of testing for EVENT_TYPE_MODULE_LOAD and giving an item you test for ITEM_SENT_AQUIRED_EVENT and update the journal.
GetEventCreator(ev) is the character who aquired the item, the item itself is GetEventObject(ev,0)
So for example:
void main()
{
event ev=GetCurrentEvent();
if (GetEventType(ev)==ITEM_SENT_AQUIRED_EVENT)
{
object oItem=(GetEventObject(ev,0);
object oPC=GetEventCreator(ev);
if (GetTag(oItem)=="gen_im_pelt_swerewolf")
DisplayFloatyMessage(oPC,"Wow! What a nice "+GetName(oItem));
}
}
Modifié par J.O.G, 04 décembre 2009 - 05:15 .
#4
Posté 04 décembre 2009 - 08:51
Ah, I'm trying the same kind of thing. Essentially I'm trying to collect an item, and once I have it, have it be reflected in the quest log.
I tried doing it in the style of the Wiki scripting tutorial, but then as J.O.G. pointed out, the event sends the message to the module rather than the room the player is in, so I'm not sure of how to use the info sent to the module.
Perhaps you could elaborate on what you mean by your example code. How would I run that script in the editor/ingame? When trying to use your if statement...
if (GetEventType(ev)==ITEM_SEND_ACQUIRED_EVENT)
I get a compiler error about invalid operands, and am lost from that point on.
I'm rather clueless to the whole method of having this script read whether or not your player picked up a quest item, so any further help would be greatly appreciated.
I tried doing it in the style of the Wiki scripting tutorial, but then as J.O.G. pointed out, the event sends the message to the module rather than the room the player is in, so I'm not sure of how to use the info sent to the module.
Perhaps you could elaborate on what you mean by your example code. How would I run that script in the editor/ingame? When trying to use your if statement...
if (GetEventType(ev)==ITEM_SEND_ACQUIRED_EVENT)
I get a compiler error about invalid operands, and am lost from that point on.
I'm rather clueless to the whole method of having this script read whether or not your player picked up a quest item, so any further help would be greatly appreciated.
#5
Posté 04 décembre 2009 - 09:16
The script is supposed to be put into your module's script. (File/Manage module/properties)
forgot the include and used the wrong constant:
The module's event script runs whenever there is any event.
EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED is sent to the module when the player aquires an item with the variable ITEM_SEND_AQUIRED_EVENT to 1. so that's the first thing to check.
If we got such an item. then we check whether it's the one that interests us, in this case by looking if the item's tag is "gen_im_pelt_swerewolf". If so then print out some pointless text over the player's head.
forgot the include and used the wrong constant:
#include "events_h"
void main()
{
event ev=GetCurrentEvent();
if (GetEventType(ev)==EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED)
{
object oItem=GetEventObject(ev,0);
object oPC=GetEventCreator(ev);
if (GetTag(oItem)=="gen_im_pelt_swerewolf")
DisplayFloatyMessage(oPC,"Wow! What a nice "+GetName(oItem));
}
}
should compile now.The module's event script runs whenever there is any event.
EVENT_TYPE_CAMPAIGN_ITEM_ACQUIRED is sent to the module when the player aquires an item with the variable ITEM_SEND_AQUIRED_EVENT to 1. so that's the first thing to check.
If we got such an item. then we check whether it's the one that interests us, in this case by looking if the item's tag is "gen_im_pelt_swerewolf". If so then print out some pointless text over the player's head.
Modifié par J.O.G, 04 décembre 2009 - 09:27 .
#6
Posté 11 décembre 2009 - 08:34
If you want it reflected in a quest, you got to do it a bit differently. After your if item = whatever, enter a line like WRSetPlot_flag (plot name, plot flag name, TRUE). Make sure you reference the plot in the include up top (#include "plt_nameofyourplot"). This changes a specific flag to true in the referenced file, so a npc with a different conversation tag if said flag is true will recognize it.
Modifié par wyvern14, 11 décembre 2009 - 08:37 .





Retour en haut






