Solved NPC that runs away and throws items

Question that is answered or resolved.

Hyunchris

Member
I wanted to make an NPC that just spawns and runs off the screen, but leaves an item behind (like a power up, etc) I am having trouble finding out how to do this. Has this been done?
 
Solution
 
Solution
So I set the NPC as a striker and the NPC successfully drops the item. However, for some reason, the player cannot pick the item up. The same item can be picked up when it is dropped by a defeated enemy. However, when it is left behind by the striker (using summonframe) the item is not able to be picked up. Is there another way I should be doing this besides summonframe?
 
Have you tried using spawnframe instead?
Yes, I used spawnframe and also used custentity instead of subentity. Nothing seemed to work until I added the item to the NPC's spawn section in the level text and then it started working. I am not sure why because I didnt think this was needed since I was not trying to spawn the item when the NPC died. However, it seemed to cause the item to be able to be picked up? Whats weirder is that, as a test, I later removed that item from that same NPC's spawn section in the level's text document, and it still works. So maybe it was a glitch? Maybe I made another change to get it working and don't remember? Anyways it works now and thanks for writing the tutorial for the striker because it is exactly what I needed and thank you maxman for suggesting it.
 
Does the player use/have anim get or not? If not, you can use itembox if players don't use anim get.


Example:
Code:
name    BURGER
health    60
type    item
shadow    0
#icon    data/chars/misc/iconb.gif
gfxshadow 1
nolife 1

anim idle
    loop    1
    delay    100
    offset    16 16
    itembox    8 3 17 17
    frame    data/chars/misc/hambur.gif
    delay    20
    frame    data/chars/misc/hambur2.gif

Did you spawn the item around the NPC's anim death with spawnframe and subentity/custentity (especially to the last frame of it) before it disappeared?
 
the NPC successfully drops the item. However, for some reason, the player cannot pick the item up.

I may misunderstood this so I'll ask to confirm it: when you say successfully drop the item, the item is dropped on the level right? but when you say player cannot pick the item up, you mean the item is not there, right?

If that's the case, what you actually need is to load the item in NPC's header text with command like this:
load Item

In general, for any entity to be able to spawn other entity, the latter must be loaded first at least in the former's text.
 
Does the player use/have anim get or not? If not, you can use itembox if players don't use anim get.

Did you spawn the item around the NPC's anim death with spawnframe and subentity/custentity (especially to the last frame of it) before it disappeared?
I used itembox and a get animation. I did not spawn it near the death frame though, since the death happens offscreen, I spawned it in the attack frame. However, I got it to work somehow. I am wondering if my issue was the itembox was too small, thus it was hard for the player to pick up the item. I appreaciate the help
 
Back
Top Bottom