Rope

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!
Post Reply
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Rope

Post by Emera Nova »

How do I make it so it can be used to climb down or up? Trying to make it so in a few area's the team is able to get down with out you know breaking all their legs. Also is there anything other than the healing crystals that will fix those types of wounds?
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Rope

Post by Drakkan »

Emera Nova wrote:How do I make it so it can be used to climb down or up? Trying to make it so in a few area's the team is able to get down with out you know breaking all their legs. Also is there anything other than the healing crystals that will fix those types of wounds?
not in the main campaign. Only healing potion and crystal could remove wound. In your custom mod you can use your imagination to create new features. scroll of healing, cure wounded limb spell etc.
Breath from the unpromising waters.
Eye of the Atlantis
MrChoke
Posts: 324
Joined: Sat Oct 25, 2014 7:20 pm

Re: Rope

Post by MrChoke »

Emera Nova wrote:How do I make it so it can be used to climb down or up? Trying to make it so in a few area's the team is able to get down with out you know breaking all their legs. Also is there anything other than the healing crystals that will fix those types of wounds?
I didn't try it but I would think you can add a LadderComponent to your rope object and it will act like a ladder. The harder part is all of the modeling work to make it look like a rope!
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Re: Rope

Post by Emera Nova »

Scripting wise what would I need to do to make it cure those different types of wounds, is there something I can look at that has all the correct terms for the different types of injuries?
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Rope

Post by Drakkan »

Jhaelen already made healing spell only for wounded limbs. you can modify / use that, also definition of injuries are there
SpoilerShow

Code: Select all

defineSpell{
   name = "recovery",
   uiName = "Recovery",
   skill = "earth_magic",
   requirements = {"earth_magic", 4, "concentration", 3},
   gesture = 587,
   manaCost = 0,
   icon = 72,
   spellIcon = 13,
   description = "Heals a champion which has one or more limb wounds.",
   onCast =
      function(champion, x, y, direction, elevation, skillLevel)
         local difference = 0
         local championToHeal = nil
         local nbrWounds = 0
         local healBaseCost = 0
         
         for i = 1, 4, 1 do
            if party.party:getChampion(i):getConditionValue("left_hand_wound") ~= 0 then
               nbrWounds = nbrWounds + 1
            end
            if party.party:getChampion(i):getConditionValue("right_hand_wound") ~= 0 then
               nbrWounds = nbrWounds + 1
            end
            if party.party:getChampion(i):getConditionValue("leg_wound") ~= 0 then
               nbrWounds = nbrWounds + 1
            end
            if party.party:getChampion(i):getConditionValue("feet_wound") ~= 0 then
               nbrWounds = nbrWounds + 1
            end
            if party.party:getChampion(i):getConditionValue("head_wound") ~= 0 then
               nbrWounds = nbrWounds + 1
            end
               
            if nbrWounds > 0 then
               championToHeal = party.party:getChampion(i)
               break
            end
         end
         
         if championToHeal == nil then
            hudPrint("Nobody has a limb wound")
            playSound("spell_fizzle")
            return false
         end
         
         healBaseCost = nbrWounds * 15
         
         if champion:getEnergy() >= healBaseCost then
            champion:regainEnergy(-healBaseCost)
            
            championToHeal:playHealingIndicator()
            championToHeal:setConditionValue("left_hand_wound", 0)
            championToHeal:setConditionValue("right_hand_wound", 0)
            championToHeal:setConditionValue("leg_wound", 0)
            championToHeal:setConditionValue("feet_wound", 0)
            championToHeal:setConditionValue("head_wound", 0)
            playSound("heal_party")
         else
            hudPrint("Not enough energy")
            playSound("spell_fizzle")
         end
               
         
      end
}

defineObject{
   name = "scroll_recovery",
   baseObject = "scroll_light",
   components = {
      {
         class = "Item",
         uiName = "Scroll of Recovery",
         
         gfxAtlas = "assets/textures/gui/items.tga",
         gfxIndex = 113,
         weight = 0.3,
      },
      {
         class = "SpellScrollItem",
         spell = "recovery",
      }
   },
}
Breath from the unpromising waters.
Eye of the Atlantis
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Rope

Post by minmay »

Emera Nova wrote:How do I make it so it can be used to climb down or up? Trying to make it so in a few area's the team is able to get down with out you know breaking all their legs.
Very simple. The code would probably look like this:
1. Make sure the party isn't moving or falling, and fail if so.
2. Make sure the target square has a floor or platform at a different elevation than the party's floor or platform, and fail if not.
3. If the target square has multiple platforms that could be climbed to, give the player some way to choose between them. Alternatively, you could enforce that the player has to climb along a wall when climbing upwards, which would make multiple targets impossible.
4. Make sure the party would be able to fall from the higher square to the lower square, i.e. make sure there are no enabled DynamicObstacleComponents, ExitComponents, ForceFieldComponents, MonsterComponents, ObstacleComponents, PlatformComponents, PitComponents, StairsComponents, or TeleporterComponents that are triggered by party* on the lower square at the higher square's elevation, and no enabled LadderComponents*, PortalComponents* or closed DoorComponents* that are on one of the squares, at the higher square's elevation, and facing the other square. Additionally, make sure that there are no enabled PlatformComponents or open PitComponents on the lower square at any elevation between the lower elevation and the higher elevation.

I marked some components with * because there are two different ways you might want to handle climbing up. One is to simply set the party's position to the higher square at the higher elevation, similar to how climbing down a pit works. The other, which is a bit more elegant, is to create LadderComponents for the party to climb up. If you do the second one, you would presumably not want to fail for TeleporterComponents, LadderComponents, PortalComponents, or DoorComponents when climbing up. Since this method is not possible with climbing down, you would still want to check for those when climbing down.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply