What you're trying to do is use CreateItemU1() to make some item from its itemsheet id, then use the GET_ITEM event to grab that ID. This is half right and half wrong.
Basically the issue is that it doesn't make sense to define a user-defined item's behaviour entirely from a player script, so you can't. EV_GET_ITEM in player scripts is only triggered from the predefined items.
We have item scripts for that -- item scripts are just a slightly-specialized script used to generate various items. An item script looks like pretty much all other scripts:
@Initialize{
let dir = GetCurrentScriptDirectory();
LoadItemData(dir~"item_data.dnh");
}
@Event{
alternative(GetEventType())
case(EV_GET_ITEM){
let itemType = GetEventArgument(0);
let objItem = GetEventArgument(1);
}
case(EV_USER+100000){
CreateItem(200, 200);
}
}
task CreateItem(x, y){
let obj = CreateItemU1(1, itemX, itemY, 0);
// maybe do other things?
}
Now this is pretty much all you need, on a really basic level. Load the item data, have a GET_ITEM event, and some user event to call in order to create your item.
You should already have the item data stuff understood. The GET_ITEM event when inside an item script does what you already assume it should: grab the item type (as defined in the item data) from the event arguments and then do other stuff, probably by checking which item type it is and performing some action accordingly. The CreateItem() task should also be pretty clear, especially since as written it just spawns the actual item. I only put it in a task to illustrate that you can (and should, generally).
The special part is the script interaction. To run this script as an item script, you call StartItemScript(path_to_script). Once that's done, the item script initializes and is ready for work. So now the only part left is the user-defined event. It works like any other event, you just have to trigger the event yourself from some other script. This could be from the player script or your enemy script or whatever, but all you do is call NotifyEventAll(EV_USER+100000, *value*) when you want to spawn the item. The item script's event is triggered, it calls CreateItem() which in turn calls CreateItemU1() and makes the item. When the player collects it, the GET_ITEM event is triggered. Hooray, it works.
If you really want to have an item where you can define behaviour from the player script, you can define a barebones item script like above, notify a different user event on collection and then have the player read that event, that's all.