Page 2 of 8
Re: Huge script request - new party member(s)
Posted: Mon Dec 08, 2014 8:55 am
by Drakkan
JKos wrote:
Feel free to improve and develop it further.
Jkos in case you will be around, please could you somehow add to the script following condition --- in case there are some free "slots" for champion (means for example champ 2-4 are disabled), then defined party member will automatically join in some of these slots instead replacing some champion (if not say by script).
And please if you can modify following code:
Code: Select all
champions.script.defineChampion(champ) -- define new champion
champions.script.storeChampion(party.party:getChampion(2)) --store champion 2
champions.script.loadChampion('Test Man',party.party:getChampion(2)) -- replace champion 2 with ''Test Man'
What I need if some champ is joing party, he will replace another champion based on name, not on champion number. I have problem with these numbers in general, because player could move party members around, so script could eventual replace incorrect champion. So script should tell for example: if there are no free slots,then replace champion Drakkan, with new defined champion Jkos.
Thanks
D.
Re: Huge script request - new party member(s)
Posted: Mon Dec 08, 2014 10:45 pm
by JKos
Well that's pretty easy, just add these helper functions to champions script entity:
Code: Select all
function getChampionByName(name)
for i=1,4 do
if party.party:getChampion(i):getName() == name then
return party.party:getChampion(i)
end
end
return false
end
function getDisabledChampion()
for i=1,4 do
if not party.party:getChampion(i):getEnabled() then
return party.party:getChampion(i)
end
end
return false
end
and then you can do something like this:
Code: Select all
...
champions.script.defineChampion(champ)
local freeSlot = champions.script.getDisabledChampion()
if freeSlot then
champions.script.loadChampion('Test Man',freeSlot)
else
hudPrint("No room for a new champion.")
end
or
Code: Select all
local champ = champions.script.getChampionByName('Drakkan')
champions.script.loadChampion('Test Man',champ)
replaces Drakkan with Test Man
Re: Huge script request - new party member(s)
Posted: Mon Dec 08, 2014 11:46 pm
by msyblade
You're such a ninja, JKos. Thanks from the lot of us.
4 Kudos awarded!
Re: Huge script request - new party member(s)
Posted: Wed Dec 10, 2014 11:19 pm
by JKos
Just for heads up, I'm currently making a GUI for recruiting champions, not quite ready yet but here are some images for you.
No champion selected
Champion selected
Re: Huge script request - new party member(s)
Posted: Wed Dec 10, 2014 11:37 pm
by Drakkan
JKos wrote:Just for heads up, I'm currently making a GUI for recruiting champions, not quite ready yet but here are some images for you.
impressive ! Hope you will finish this before christmas
and in case you will have some time can you make some easy GUI as was in LOG1 for hiring new champion when there are already four in the party ? (with some easy function to drop all items from "kicked" member)
Re: Huge script request - new party member(s)
Posted: Thu Dec 11, 2014 12:44 am
by Eleven Warrior
God that's so awesome Jkos as Drakkan said +2 Man this will be totally awesome thxs for the update
Re: Huge script request - new party member(s)
Posted: Fri Dec 12, 2014 10:55 pm
by JKos
Here is the first release version with demo dungeon:
https://github.com/JKos/log2doc/archive/master.zip
Unzip to somewhere and move the /Champions folder to your /Legend of Grimrock 2/Dungeons folder
Sorry for the messy GUI code, could be much cleaner.
Re: Huge script request - new party member(s)
Posted: Sat Dec 13, 2014 12:47 am
by Eleven Warrior
As Mysblade say 10 Kuddos. This is awesome Jkos and I am adding this to my mod. The things I can do with system will be totally cool eg: You would need to recruit a new champ to complete a level etc... Very good work man
I am sure Drakkan will love this to yeah. I checked the dungeon out and there are 2 Scripts that call for scripts outside of the editor, there was a problem before with this that in a normal game it crashed, it think that's what it use to do?
This script allows for easy champ adding as well cool
The only thing is what are you going to add this awesome work? I assume it will be cool
Anyway thanks, and I am glad your still with this community.
Re: Huge script request - new party member(s)
Posted: Sat Dec 13, 2014 1:04 pm
by Drakkan
Eleven Warrior wrote: there was a problem before with this that in a normal game it crashed, it think that's what it use to do?
this was alredy solved in one of the previous patch, so no prob. And even if yes you can easily just copy the script from outside to "inside " script
JKos
I made some first tries and it is working precisely as I wished, you have my huge thanks. This is one of last pieces I am missing to my mod. In case you would want improve this script a little is - the only problem I can now see is with starting champion items - I think it´s perfectly ok, that new champion just replace old one with whole inventory, however what if I want new champion with already some items equipped ?
Not sure if there is some other solution that just to rewrite script from Log1 that all items from old champion will be dropped on ground, while you define starting items for new champ (which maybe could be by some implementation of starting items script inside champion script ? Not sure if possible, would welcome any ideas.
here is easy script for starting items written by Sutekh
viewtopic.php?f=22&t=8342&p=84331&hilit ... ems#p84331
as for original "drop" script from Log1 I think you are aware where to look because I think you cooperated with thomson on it with original grimwidgets ?
Ps: another solution in my mind would be just spawning starting items for new champion on the ground before party. this could be much more easy regarding scripting.
Re: Huge script request - new party member(s)
Posted: Sat Dec 13, 2014 6:46 pm
by Mysterious
Jkos good work man
10 Kudos??? What is a Kudo if you don't mind me asking? I guess that's the scoring system here? I think I just asked a stupid question, but ill stick my neck out lol.