Page 1 of 1

Editor bug with starting items? Help needed!

Posted: Fri Jun 26, 2015 4:06 pm
by WaspUK1966
I'm doing a mod whereby the party start off with some items. The items are spawned in their hands at the start of the game as I intended, but this is the strange bit. At first, in the editor screen, you cant use them (clicking on them doesn't do anything). If you refresh the editor, then they work as intended. If you pick the said items up and put them in their hands, rather than spawning them, it works. I've exported the mod to test, and the items don't do anything in their hands. Clicking doesn't work. Any ideas? My code is below:

Code: Select all

local startwep = spawn("baton");
party.party:getChampion(1):insertItem(1,startwep.item);
party.party:getChampion(2):insertItem(1,startwep.item);


By the way, the same problem applies to ANY weapon I spawn in their hands! Any advice greatly appreciated as always.

George

Re: Editor bug with starting items? Help needed!

Posted: Fri Jun 26, 2015 5:22 pm
by AndakRainor
You should not insert the same item twice as in this code. Even if you need 2 "baton" items, you should spawn one for each champion's slot where you want to place it.

You could do something like that:

Code: Select all

local startwep1 = spawn("baton");
party.party:getChampion(1):insertItem(1,startwep1.item);
local startwep2 = spawn("baton");
party.party:getChampion(2):insertItem(1,startwep2.item);
or that :

Code: Select all

local startwep = spawn("baton");
party.party:getChampion(1):insertItem(1,startwep.item);
startwep = spawn("baton");
party.party:getChampion(2):insertItem(1,startwep.item);
or that :

Code: Select all

party.party:getChampion(1):insertItem(1,spawn("baton").item);
party.party:getChampion(2):insertItem(1,spawn("baton").item);

Re: Editor bug with starting items? Help needed!

Posted: Fri Jun 26, 2015 7:17 pm
by WaspUK1966
Hi. I've tried every combination that you've mentioned. The code I posted was a last resort one, I'd already used

Code: Select all

local startwep1 = spawn("baton");
party.party:getChampion(1):insertItem(1,startwep1.item);
local startwep2 = spawn("baton");
party.party:getChampion(2):insertItem(1,startwep2.item);
Nothing works. If you load up the mod first time into the editor, the items are there but nothing happens if you click on them. It is the same if you export it, they don't work. But if you load the mod into the editor, then refresh it a couple of times, they do work. Totally baffled.

Re: Editor bug with starting items? Help needed!

Posted: Sat Jun 27, 2015 11:01 pm
by bongobeat
for example here is what I use:
SpoilerShow

Code: Select all

    function startItems()

    local i = 1
       repeat
       if party.party:getChampion(1):getEnabled() then
          party.party:getChampion(1):removeItemFromSlot(i)
          end
       if party.party:getChampion(2):getEnabled() then
          party.party:getChampion(2):removeItemFromSlot(i)
          end
       if party.party:getChampion(3):getEnabled() then
          party.party:getChampion(3):removeItemFromSlot(i)
          end
       if party.party:getChampion(4):getEnabled() then
          party.party:getChampion(4):removeItemFromSlot(i)
          end
       i = i + 1
       until i == 33

    if party.party:getChampion(1):getEnabled() then
       party.party:getChampion(1):insertItem(2,spawn("torch").item)
       party.party:getChampion(1):insertItem(4,spawn("lurker_vest").item)
       party.party:getChampion(1):insertItem(5,spawn("voyager_pants").item)
       party.party:getChampion(1):insertItem(6,spawn("voyager_boots").item)
       party.party:getChampion(1):insertItem(7,spawn("voyager_cloak").item)
       party.party:getChampion(1):insertItem(9,spawn("voyager_gloves").item)
       party.party:getChampion(1):insertItem(13,spawn("bread").item)
       party.party:getChampion(1):insertItem(14,spawn("water_flask").item)
       party.party:getChampion(1):insertItem(15,spawn("water_flask").item)
       party.party:getChampion(1):insertItem(16,spawn("turtle_eggs").item)
       party.party:getChampion(1):insertItem(17,spawn("secret_key").item)
       end

    if party.party:getChampion(2):getEnabled() then
       party.party:getChampion(2):insertItem(4,spawn("voyager_valor").item)
       party.party:getChampion(2):insertItem(5,spawn("silk_hose").item)
       party.party:getChampion(2):insertItem(6,spawn("voyager_boots").item)
       party.party:getChampion(2):insertItem(7,spawn("voyager_cloak").item)
       party.party:getChampion(2):insertItem(9,spawn("voyager_gloves").item)
       end

    if party.party:getChampion(3):getEnabled() then
       party.party:getChampion(3):insertItem(4,spawn("voyager_valor").item)
       party.party:getChampion(3):insertItem(5,spawn("voyager_pants").item)
       party.party:getChampion(3):insertItem(6,spawn("shoes").item)
       party.party:getChampion(3):insertItem(7,spawn("voyager_cloak").item)
       party.party:getChampion(3):insertItem(9,spawn("voyager_gloves").item)
       end

    if party.party:getChampion(4):getEnabled() then
       party.party:getChampion(4):insertItem(4,spawn("doublet").item)
       party.party:getChampion(4):insertItem(5,spawn("silk_hose").item)
       party.party:getChampion(4):insertItem(6,spawn("shoes").item)
       party.party:getChampion(4):insertItem(7,spawn("voyager_cloak").item)
       party.party:getChampion(4):insertItem(9,spawn("voyager_gloves").item)
       end

    end


  
put it in a script entity and connect a timer to it, where your party start.
The timer should be running when you start the map and disable itself right after.

Re: Editor bug with starting items? Help needed!

Posted: Sun Jun 28, 2015 9:31 am
by Eleven Warrior
This may help you out.

Code: Select all

local c = party.party:getChampion(1)
--Champ 1--
c:setName('Tifa Lockhart')
c:setClass('fighter')
c:setRace('ratling')
c:setSex('female') 
--Items--
c:insertItem(3,spawn("peasant_cap").item)
c:insertItem(4,spawn("peasant_tunic").item)
c:insertItem(5,spawn("peasant_breeches").item)
c:insertItem(6,spawn("sandals").item)
 c:gainExp(10)
c:setPortrait('assets/textures/portraits/ratling_female_03.tga')
c:setBaseStat('strength',16)


local c = party.party:getChampion(2)
--Champ 2--
c:setName('Fiddler Thain')
c:setClass('rogue')
c:setRace('ratling')
c:setSex('male')
--Items--
c:insertItem(3,spawn("peasant_cap").item)
c:insertItem(4,spawn("peasant_tunic").item)
c:insertItem(5,spawn("peasant_breeches").item)
c:insertItem(6,spawn("sandals").item)
c:gainExp(10)
c:setPortrait('assets/textures/portraits/ratling_male_04.tga')
c:trainSkill('missile_weapons',1)
c:trainSkill('throwing',1)
c:setBaseStat('strength',12)

local c = party.party:getChampion(3)
--Champ 3--
c:setName('Thourun Wisthoff')
c:setClass('wizard')
c:setRace('ratling')
c:setSex('male')
--Items--
c:insertItem(3,spawn("peasant_cap").item)
c:insertItem(4,spawn("peasant_tunic").item)
c:insertItem(5,spawn("peasant_breeches").item)
c:insertItem(6,spawn("sandals").item)
c:gainExp(10)
c:setPortrait('assets/textures/portraits/ratling_male_06.tga')
c:trainSkill('fire_magic',1)
c:trainSkill('earth_magic',1)
c:trainSkill('firearms',-1)
c:setSkillPoints(-1) 
c:setBaseStat('strength',8)

local c = party.party:getChampion(4)
--Champ 4--
c:setName('Zala Lockhart')
c:setClass('alchemist')
c:setRace('ratling')
c:setSex('female')
--Items--
c:insertItem(3,spawn("peasant_cap").item)
c:insertItem(4,spawn("peasant_tunic").item)
c:insertItem(5,spawn("peasant_breeches").item)
c:insertItem(6,spawn("sandals").item)
c:gainExp(10)
c:setPortrait('assets/textures/portraits/ratling_female_04.tga')
c:trainSkill('alchemy',1)
c:trainSkill('firearms',1)
c:setBaseStat('strength',8)

Re: Editor bug with starting items? Help needed!

Posted: Sun Jun 28, 2015 4:21 pm
by WaspUK1966
Thanks for that. Didn't realise that I had to delay the script first. Not like LOG1. Working fine now. Thanks again for all your help (as always!)
George