Hiring party member(s) script - SOLVED

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!
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Huge script request - new party member(s)

Post by Drakkan »

Isaac wrote:
Drakkan wrote:Hi Jkos, I have following problem - in case I set any custom portrait to champion script (in part

portrait='assets/textures/portraits/human_female_04.tga',

editor crash when I try to display champions portrait in displayed GUI (just hover with mouse over name of the champion). DO need that picture have something special ? It was working for previous version of your GUI system.
Image
** I think that Xanathar may have run into the same problem in his own mod... It was the same situation; and was the image at fault, but I don't recall what the actual problem was.

** Could it be that the dds file must not be compressed?

(Also... Is it a DDS file that you are using?)
I was playing with it a little and solved it at the end - the "problem" was that GUI using different format than just regular portrait icons. For normal you have portrait in .tga format, refered to .tga, however this takes only .DDS format which refer to .tga...
still thanks for your replies guys, I spent with this minor problem more time then wanted to :)
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: Huge script request - new party member(s)

Post by JKos »

Ok, new version is up.
- party cannot move or turn when the gui is open (mosters still do move).
- Support for multiple "recruiting spots"
- New entity: champion_recruit, just place it in to your dungeon. See details from the demo dungeon.

https://github.com/JKos/log2doc/archive/master.zip
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Huge script request - new party member(s)

Post by Drakkan »

JKos wrote:Ok, new version is up.
- party cannot move or turn when the gui is open (mosters still do move).
- Support for multiple "recruiting spots"
- New entity: champion_recruit, just place it in to your dungeon. See details from the demo dungeon.

https://github.com/JKos/log2doc/archive/master.zip
100% accomplished with this. Thanks JKos, this will definitely help many modders and I am able to finish my mod with it in the future.
EDIT: JKos please how can I modify some champion to be hired automatically ? (or as a default) I need to hire starting champion as a default , in previous version I just disabled all champions and then call champion function add...(champion name), and it added hero into first free slot. This is not working now. I do not even need GUI for starting champion. I could probably make some starting point which will not allow player to move until champion named... is hired, but thats little bit clunky. maybe another option just make close button optional somehow ? Thanks for response
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: Huge script request - new party member(s)

Post by JKos »

Try this: in demo dungeon add these lines to the end of champion_recruit_1

Code: Select all

....
function setStartingParty()
	champions.script.setStore(self.go.id)
	champions.script.loadChampion('Minotaur With really long name',party.party:getChampion(1))
	champions.script.loadChampion('Lab Rat',party.party:getChampion(2))
	champions.script.loadChampion('Test Woman',party.party:getChampion(3))
end
delayedCall(self.go.id,0.1,'setStartingParty')
Hope you got the idea.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Huge script request - new party member(s)

Post by Drakkan »

JKos wrote:Try this: in demo dungeon add these lines to the end of champion_recruit_1

Code: Select all

....
function setStartingParty()
	champions.script.setStore(self.go.id)
	champions.script.loadChampion('Minotaur With really long name',party.party:getChampion(1))
	champions.script.loadChampion('Lab Rat',party.party:getChampion(2))
	champions.script.loadChampion('Test Woman',party.party:getChampion(3))
end
delayedCall(self.go.id,0.1,'setStartingParty')
Hope you got the idea.
working fine, thanks !

another small request if you will be around hopefully the last one :) I have full party and I want hire new champion (called Mortimer)- what Id like to do is that this champion could only replace champion called for example Drakkan, other ones should not appear in the "who will go" menu. Is that possible ?
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Hiring party member(s) script - SOLVED

Post by Eleven Warrior »

Hi Jkos. Wow man this Script is awesome and imam using it no cool :) Is there away to keep the deleted Camp in memory so you can retrieve that Champ later on eg:

Taliah has to leave the party so Yule can do a Quest with the party. When the Quest is finished i can go back to the Inn and get Taliah back and ditch Yule.
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: Hiring party member(s) script - SOLVED

Post by JKos »

I was going to implement that, but we don't have access to the portrait of the champion so I could't implement it.
And there is a one big problem with this script, it's impossible to downgrade the level of the champion, so you have to make sure that all recruitable champions are at least at the same level as the highest level party member.
These problems are the result of limitations of the modding api and can not be solved without new modding features.
We need at least:
champion:getPortrait() -- returns the file path to the champion portrait.
champion:setLevel(number)

I hope Petri finds some time to implement these.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: Hiring party member(s) script - SOLVED

Post by JKos »

new version(works with LoG II version 2.2.4):

- Champion levels works now as the should (see previous post)
- Traits are now shown in champion details
- Some minor gui tweaking (like nicer cancel button)
- party.onMove, party.onTurn-hooks are not needed anymore
so you can just remove them.
- monster AI is disabled when the gui is open.
- Script now uses party.onDrawGui-connector instead of the hook so you must remove the line:
champions.script.gui(g)
from your party.onDrawGui-hook
- moved the champion_recruit object definition to mod_assets\jkos\init_champions.lua
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Hiring party member(s) script - SOLVED

Post by Eleven Warrior »

Hi Jkos so you mean you can now set the party member level(s)? I hope that's what you mean if it does then AWESOME :) Ohh where is the new version mate, did I miss something lol :)
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: Hiring party member(s) script - SOLVED

Post by JKos »

Yeah, you can now set levels freely, Petri was so kind that he implemented Champion:resetExp() method for us.
Well actually you must set exp to match the desired level:
1 = 0 - 999
2 = 1000 - 2999
3 = 3000 - 5999
4 = 6000 - 9999
5 = 10000 - 14999
6 = 15000 - 20999
..etc
so the gap to the next level = level*1000, it always rises by 1000 exp/level.

The new version can be found from here
https://github.com/JKos/log2doc/archive/master.zip
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
Post Reply