[Help] Execute a script only if some party members not there
[Help] Execute a script only if some party members not there
I want to execute a script only if some party members are not present. Anyone has a clue ?
The Lurker
- montagneyaya
- Posts: 103
- Joined: Tue May 01, 2012 11:08 pm
Re: [Help] Execute a script only if
Use hook party:onDie
Door on floor placement: http://grimrock.nexusmods.com/mods/120
- cromcrom
- Posts: 549
- Joined: Tue Sep 11, 2012 7:16 am
- Location: Chateauroux in a socialist s#!$*&% formerly known as "France"
Re: [Help] Execute a script only if
You can try
if party:getChampion(whomever):isAlive() == false then "whatever_script" end
if party:getChampion(whomever):isAlive() == false then "whatever_script" end
A trip of a thousand leagues starts with a step.
Re: [Help] Execute a script only if
By present, do you mean alive or enabled ?
This code levels up any alive and enabled character. The getEnabled part is required to support the Toorum mode or other scenarios in your mod where characters could get disabled (if any).
Instead this:
This will detect dead party members and work also in Toorum mode and with disabled characters.
Code: Select all
for c = 1, 4 do
if (party:getChampion(c):getEnabled() and party:getChampion(c):isAlive()) then
party:getChampion(c):levelUp()
end
end
Instead this:
Code: Select all
local aliveCount = 0
local allCount = 0
for c = 1, 4 do
if (party:getChampion(c):getEnabled() then
allCount = allCount + 1
if (party:getChampion(c):isAlive()) then
aliveCount = aliveCount + 1
end
end
end
if (aliveCount < allCount) then
-- here at least one character is dead
end
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
Re: [Help] Execute a script only if
Many thanks to all ! I didn't realize that party:getChampion(whoever):getEnabled() returned if a party member was enabled or not and I am using it elsewhere in my mod. I guess I will know this one now.
The Lurker