Code for Ressurection Spell

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: Code for Ressurection Spell

Post by JohnWordsworth »

Yeah, with regards to balance... In Lands of Lore - when you've cast the full heal on your party, you're generally out of Mana - so if you're in the middle of a big fight - you've used a big majority of your offensive power on the resurrection - which really puts the pressure on!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: Code for Ressurection Spell

Post by Xanathar »

Balance is a very difficult thing to achieve. Those comments regarding balance should be treated, imho, as "according to the maingame guidelines, it would be unbalanced", which are actually the only guidelines we have for an already difficult process.

To be entirely true, I have a pet peeve against healing spells(*): they are totally difficult to balance right. Either they are next to useless (EOB), or they quickly become the only spell you cast (LOL) because healing is really both offensive (keeping the fighters alive for longer) and defensive, relegating offensive spells to corner cases (the encounter with 3284293 1HP goblins, or the one with the big monster with a 500% weakness against fire).

(*) -> with healing spells I mean spells giving back HPs. Cure poison, disease, raise dead (as long as they don't also heal too much) aren't in this category, because they are either situational (cure xxx) or not usable during combat (raise dead) and so they are more "utility" spells, which I want aplenty (specially if the game has a "memorize before you rest" rule :D).
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
User avatar
Isaac
Posts: 3182
Joined: Fri Mar 02, 2012 10:02 pm

Re: Code for Ressurection Spell

Post by Isaac »

Batty wrote:
msyblade wrote:Wow Xanathar! this is Perfect for an Altar. Aka "Altar of Vi". Use"Remains_of_" that you must sacrifice on the altar to recover a character. Wouldn't it be cool if we could spawn "remains_of_yourdeadcharacter" upon death, and use those on the altar?
I think we need a item:setUIName("name") function to do that. Would be a good function to ask for next time petri gets beer.
I think you are right.

This doesn't work; (but it almost does):

Code: Select all

-- Adds the onDie hook to spawn one of the four defined corpse objects. 
cloneObject{
name = "party",
baseObject = "party",
onDie = function(self)
	print("spawning Corpse of "..self:getName())
	spawn("pc_remains_"..self:getOrdinal(), party.level, party.x, party.y, party.facing, self:getName())
	return false --(needed temporarily ~but prevents PC deaths)
	end,
}

-- definition function for creating a corpse with the user chosen name used as the UiName, with a description than mentions them by that name.
-- Called four times.
local function pcRemains(bodyId)
   cloneObject{
	name = "pc_remains_"..bodyId:getOrdinal(),
	baseObject = "remains_of_toorum",
	uiName = bodyId:getName(),
	description = "This is the remains of "..bodyId:getName()..".",
                  }
end

-- Loop that calls the Corpse definition function four times, using the tables of the PCs 
for myX = 1,4 do
pcRemains(party:getChampion(myX))
end
But.... The "party" object returns nil here (where if used in a Lua script Object ~in-game, party:getChampion(1) would return the PC's table), or I'd think we could define the corpse objects with the character names.

[Anyone] Am I doing something(s) wrong in the code? My assumption has been that the Party object is not yet accessible at the time this is run; (or from where it is run?).

If I just do the defines manually, using hard coded names and minor changes, then the corpses spawn on death.

A setUiName() function would seem to make this possible (and easier) to do.
User avatar
maneus
Posts: 246
Joined: Mon Jun 17, 2013 10:42 pm
Location: Switzerland

Re: Code for Ressurection Spell

Post by maneus »

I´ve a problem with the Resurrection Spell.

If someone in my party is dead, all works fine but if all party members are alive and my mage cast the Resurrection Spell then the editor close without a message.

I´ve changed the original spell, so that only one party member can be resurrected with it and the correct name of the resurrected member is shown.

This is my onCast Hook:

Code: Select all

onCast = function(caster, x, y, direction, skill)
	local conditions = { "poison", "diseased", "paralyzed", "haste", "rage", "fire_shield", "shock_shield", "poison_shield", "frost_shield", "invisibility" }

	local heal_amount = math.random(2,4)*skill
	  local character_to_heal = 5
	  local least_health = 10000
	  local max_health = 10000
	  local percentage_health = 1
	  local champName = "No-one"

	  for j=1,4 do
 	   if party:getChampion(j):getEnabled()
	    then
   	   if party:getChampion(j):getStat("health") / party:getChampion(j):getStatMax("health") * 1 < percentage_health
   	   then
   	     least_health = party:getChampion(j):getStat("health")
   	     max_health = party:getChampion(j):getStatMax("health")
    	    percentage_health = least_health / max_health * 1
   	     character_to_heal = j
   	   end
  	  end
 	 end
	  if (character_to_heal < 5)
	  then
 	   champName = party:getChampion(character_to_heal):getName()
	    party:getChampion(character_to_heal):setStat("health", 1)
		end
	  for _, cond in ipairs(conditions) do
 		party:getChampion(character_to_heal):setCondition(cond, 0)
		end
		playSound("heal_party")
		party:playScreenEffect("teleport_screen")
		hudPrint(champName.. " is risen from the dead.")
		end
} 
It would be good when text will be shown if anybody in the party is alive like "Anybody is alive and no-one must be resurrected."

Can anyone help me please?

*EDIT: I have found a way with the help of Xanathars script.
Post Reply