Page 150 of 396

Re: Ask a simple question, get a simple answer

Posted: Thu Aug 25, 2016 9:33 am
by Isaac
minmay wrote:Yes, but instead of exhaustively proving the difference, I will explain it more precisely.
...And it's appreciated.
It's a neat example, but I must be missing something; or have misread the instructions.
https://www.dropbox.com/s/cgoh72hr9dey5 ... e.avi?dl=0

**Also, what I had asked was ~can you prove that my suggestion wouldn't accomplish it... and it was rhetorical. I don't think it was a great suggestion, but I don't see why it wouldn't work; barring a better option.

Re: Ask a simple question, get a simple answer

Posted: Thu Aug 25, 2016 10:12 am
by minmay
Oops, you're right, that doesn't work as a single line. Paste it as two separate lines instead; execute this:

Code: Select all

s=spawn("beach_puzzle_statue")
 s.socket:setOffset(s.socket:getOffset()+vec(4,0,0))
 a=spawn("rapier")
 b=spawn("rapier")
 b.model:setEmissiveColor(vec(-1,0,1)) -- visually mark as the non-socket rapier
and then this separately:

Code: Select all

s.socket:addItem(a.item)
 b:setWorldPosition(a:getWorldPosition())
 b:setWorldRotation(a:getWorldRotation())
Isaac wrote:I don't think it was a great suggestion, but I don't see why it wouldn't work; barring a better option.
I explained exactly why it doesn't work: the pickup distance is wrong. I guess you could have a PartyComponent.onPickUpItem hook that tests the distance, but then you would need to enumerate the bounding boxes for all the item models in your dungeon in order to get truly correct results...

Trying to make an unpushable item is just not something I recommend in the first place though. I don't know if that was clear. The ItemConstrainBox hack at least actually accomplishes the task unlike a socket/surface hack, and it's easier than moving the socket, but it's still definitely not what ItemConstrainBox is intended for, and of course it will still constrain other items which is probably unwanted.

Re: Ask a simple question, get a simple answer

Posted: Thu Aug 25, 2016 4:19 pm
by Isaac
@zimberzimber

(If there is a bug, I'll have to fix it when I get back in a few hours.)

Code: Select all

defineObject{
   name = "river_sockets",
   baseObject = "base_floor_decoration",
   components = {
      {
         class = "Model", --"crystal_flower"
         name = "s1",
         offset = vec(0.35, 0, 1.49),
		 model = "assets/models/items/crystal_flower.fbx",
      },
      {
			class = "Clickable", 
			name = "crystalflower",
			offset = vec(0.35, 0, 1.49),
			size = vec(.2,.2,.2),
			frontCacing = false,
			debugDraw = true,
			maxDistance = 1,
			onClick = function(self) self.go.s1:disable() self.go.crystalflower:disable() setMouseItem(spawn("crystal_flower").item) end,
	  },

      {
         class = "Model", --"blooddrop_cap"
         name = "s2",
         offset = vec(-0.35, 0, 1.1),
		 model = "assets/models/items/blooddrop_cap.fbx",
      },
      {
			class = "Clickable", 
			name = "blooddropcap",
        	offset = vec(-0.35, 0, 1.1),
        	offset = vec(-0.35, 0, 1.1),
			size = vec(.2,.2,.2),
			frontCacing = false,
			debugDraw = true,
			maxDistance = 1,
			onClick = function(self) self.go.s2:disable() self.go.blooddropcap:disable() setMouseItem(spawn("blooddrop_cap").item) end,
	  },

      {
         class = "Model", --"etherweed"
         name = "s3",
         offset = vec(-0.35, 0, 0.4),
		 model = "assets/models/items/milkreed.fbx",
      },
      {
			class = "Clickable", 
			name = "etherweed",
         	offset = vec(-0.35, 0, 0.4),
			size = vec(.2,.4,.2),
			frontCacing = false,
			debugDraw = true,
			maxDistance = 1,
			onClick = function(self) self.go.s3:disable() self.go.etherweed:disable() setMouseItem(spawn("etherweed").item) end,			
	  },

      {
         class = "Model", --"brass_key"
         name = "s4",
         offset = vec(0.8, -0.05, 0.55),
		 model = "assets/models/items/key_brass.fbx",
      },
      {
			class = "Clickable", 
			name = "brasskey",
         	offset = vec(0.8, -0.05, 0.55),
			size = vec(.2,.2,.2),
			frontCacing = false,
			debugDraw = true,
			maxDistance = 1,
			onClick = function(self) self.go.s4:disable() self.go.brasskey:disable() setMouseItem(spawn("brass_key").item) end,			
	  },

      {
         class = "Model", --"skull"
         name = "s5",
         offset = vec(-0.5, 0, -0.85),
         rotation = vec(0, 0, 0),
		 model = "assets/models/items/skull.fbx",
      },
      {
			class = "Clickable", 
			name = "skull",
        	offset = vec(-0.5, 0, -0.85),
			size = vec(.2,.3,.2),
			frontCacing = false,
			debugDraw = true,
			maxDistance = 1,
			onClick = function(self) self.go.s5:disable() self.go.skull:disable() setMouseItem(spawn("skull").item) end,				
	  },

   },
   placement = "floor",
   editorIcon = 104,
}

Re: Ask a simple question, get a simple answer

Posted: Thu Aug 25, 2016 6:45 pm
by minmay
I considered mentioning that approach, but decided not to because stackable items are involved. You're supposed to be able to pick up several nearby stackable items at once; the player will notice something is wrong if they drop an etherweed near the "etherweed" in this object.
Also you still aren't checking the distance, have the wrong bounding box size, forgot to ensure that the mouse item is empty before setting it, forgot the etherweed and brass key particles, and forgot to find a way to mark the items as found (for statistics purposes).

Re: Ask a simple question, get a simple answer

Posted: Thu Aug 25, 2016 8:09 pm
by Isaac
minmay wrote:I considered mentioning that approach, but decided not to because stackable items are involved. You're supposed to be able to pick up several nearby stackable items at once; the player will notice something is wrong if they drop an etherweed near the "etherweed" in this object.
Also you still aren't checking the distance, have the wrong bounding box size, forgot to ensure that the mouse item is empty before setting it, forgot the etherweed and brass key particles, and forgot to find a way to mark the items as found (for statistics purposes).
The distance check was planned, but not added in time; [I had to leave unexpectedly, and uploaded it as-is]. Good point about stacks. I'm updating it now that I'm home.

Re: Ask a simple question, get a simple answer

Posted: Fri Aug 26, 2016 12:31 am
by Eleven Warrior
Hi all.

I am trying to make a Spell that cures the party of (Petrified State). The code checks to see which party member is Petrified and cures them.

I can get the condition petrified but but know the command to return the party member(s) back to normal state. The Spell below is not working and I don't know what I'm doing wrong. Please help me out here thank you.

Code: Select all

defineSpell{
   name = "cure_petrified_party_01",
   uiName = "Cure Petrification Spell",
   gesture = 123,
   manaCost = 10,
   skill = "earth_magic",
   --requirements = { "earth_magic", 1},
   icon = 60,
   spellIcon = 1,
   description = "Cures your entire parties petrified state.",
   onCast = function(champion, x, y, direction, skill)
      print("1")
      hudPrint(champion:getName() .. " Cures the parties petrified state.")
      for i = 1, 4 do
         local c = party.party:getChampion(i)
         if c and c:isAlive() then
            print(i.."1")
            print(c:hasCondition("petrified"))
            if c:hasCondition("petrified") then
               print(i.."2")
--- Help needed here ---
               c:setCondition("petrified", false)
            end
         end
      end
   end,
}

Re: Ask a simple question, get a simple answer

Posted: Fri Aug 26, 2016 1:15 am
by AndakRainor
You can use Champion:removeCondition(name)

Re: Ask a simple question, get a simple answer

Posted: Fri Aug 26, 2016 8:06 am
by zimberzimber
AndakRainor wrote:You can use Champion:removeCondition(name)
It doesn't work with petrified for some reason last I checked. The function just stops if it detects that a champion has the condition or when you apply a removeCondition, dont really remember which one was it.

Re: Ask a simple question, get a simple answer

Posted: Fri Aug 26, 2016 8:42 am
by Isaac
Petrified is permanent.

Use champion:setCondition("petrified", false)

Re: Ask a simple question, get a simple answer

Posted: Fri Aug 26, 2016 9:17 am
by AndakRainor
A petrified champion is not considered alive.