[FIXED (2.1.15) - BUG] Item spawning directly to champion

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

[FIXED (2.1.15) - BUG] Item spawning directly to champion

Post by NutJob »

....
Last edited by NutJob on Wed Nov 12, 2014 5:29 am, edited 5 times in total.
NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

Re: I need to squash this problem once and for all

Post by NutJob »

Also, if anyone tries to reproduce this "bug" (is it?, maybe not) remember to look around. The item will be there but could be facing another way because the item will drop the direction of whatever you used to trigger your script.

And if you can reproduce this, please, do tell, here. If you can't, still please do tell and call me a Butt. It's en vogue... sorry I'm a time traveler.
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: I need to squash this problem once and for all

Post by Batty »

I'm able to reproduce both cases so you're not losing it...yet :lol:

Funny thing is if you put:

Code: Select all

party.party:getChampion(1):insertItem(1, spawn("dagger").item)
in a script that executes when you start, you get a dagger on the floor but no dagger in hand...weird. The script has to be triggered to get the double dagger result.

I did this:

Code: Select all

d = spawn("dagger", party.level, party.x, party.y, party.facing, party.elevation, "dagger_x")
party.party:getChampion(1):insertItem(1, d.item)
d:destroy()
and I got a dagger in hand and no dagger on the floor. This is strange though.
Last edited by Batty on Wed Nov 05, 2014 2:33 am, edited 1 time in total.
NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

Re: I need to squash this problem once and for all

Post by NutJob »

Batty wrote:I'm able to reproduce both cases so you're not losing it...yet :lol:

Funny thing is if you put:

Code: Select all

party.party:getChampion(1):insertItem(1, spawn("dagger").item)
in a script that executes when you start, you get a dagger on the floor but no dagger in hand...weird. It has to be triggered to get the double dagger result.

I did this:

Code: Select all

d = spawn("dagger", party.level, party.x, party.y, party.facing, party.elevation, "dagger_x")
party.party:getChampion(1):insertItem(1, d.item)
d:destroy()
and I got a dagger in hand and no dagger on the floor. This is strange though.
I believe *our* scripts are loaded in before they have access to top-level global functions like spawn(). I believe this is why. And yes, I put the above examples in a script on a timer to execute after the game is fully loaded.

Edit: and to follow up this reply, yes, destroy() does clear up the problem of duplicates but I read a few times on LoG1 forums to never destroy the item once given to a champion. Unclear why (mostly because I forgot and now I can't find these threads) but it was stressed quite extensively.
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: I need to squash this problem once and for all

Post by petri »

There seems to be something wrong here. I'll dig deeper into this later today.

Btw. You can give nil instead of the id to spawn() and it will automatically created a unique id. This is actually recommended.
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: I need to squash this problem once and for all

Post by petri »

Ok, ghost item bug confirmed. Will be fixed in 2.1.15.
User avatar
Doridion
Posts: 256
Joined: Tue Jun 10, 2014 9:23 pm

Re: I need to squash this problem once and for all

Post by Doridion »

Thanks petri, can finally give the [BUG] mark ;)
NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

Re: I need to squash this problem once and for all

Post by NutJob »

Thank you for the upcoming fix and my weird tutorial directions.
Post Reply