Page 1 of 1
Spawing a custom letter into inventory
Posted: Sat Jan 03, 2015 1:11 am
by TheStoryteller01
So far I can manage to spawn a stock letter into a hero's inventory
Code: Select all
function getlitem()
if party.party:getChampion(1):getEnabled() then
party.party:getChampion(1):insertItem(32,spawn("letter").item)
end
end
but I can't incorporate the custom text. I tried
but I can't get the syntax right
Any help would be appreciated.
Re: Spawing a custom letter into inventory
Posted: Sat Jan 03, 2015 2:04 am
by JohnWordsworth
Here is a sample script_entity that will give you an example of what you want to do. Note, in this case, I have done it in a delayedCall because the party's inventory seems to be wiped (reloaded) after the script_entities are loaded, but as long as you run "doIt" after the game has started (or probably even in the real game), it doesn't need to be delayed.
Code: Select all
function doIt()
if party.party:getChampion(1):getEnabled() then
local letter = spawn("letter");
letter.scrollitem:setScrollText("TEST");
party.party:getChampion(1):insertItem(32, letter.item);
end
end
delayedCall("test", 0.01, "doIt");
Re: Spawing a custom letter into inventory
Posted: Sat Jan 03, 2015 2:28 am
by TheStoryteller01
It works perfectly, thank you!
Actually I run it triggered from a floor trigger as the second script in a row. The first one cleans the inventory and adds starting equipment and so far the whole setup works with or without the delay.