Page 331 of 400

Re: Ask a simple question, get a simple answer

Posted: Wed Oct 02, 2019 10:10 pm
by melierax

Code: Select all

defineObject {
       name = "exploding_barrel_block",
       baseObject = "barrel_crate_block",
       components = {
          {
             class = "Health",
             health = 30,
             onDie = function(c)
                if ( c.property ~= nil ) then
                   --print("BLOCKED")
                   return
                end
                
                c.property = 1;
                local i, j;
                
                for i = -1, 1 do
                   for j = -1, 1 do
                      spawn("fireburst", c.go.level, c.go.x + i, c.go.y + j, 0, c.go.elevation)
                   end
                end
             end
          }
       }
    }

 defineObject {
       name = "nour_barrel_block",
       baseObject = "barrel_crate_block",
       components = {
          {
             class = "Health",
             health = 15,
             onDie = function(c)
                if ( c.property ~= nil ) then
                   --print("BLOCKED")
                   return
                end
                
                c.property = 1;
                      spawn("nour_barrel_crate_block_damaged", c.go.level, c.go.x, c.go.y, 0, c.go.elevation)
             end
          }
       }
    }


defineObject {
       name = "nour_barrel_crate_block_damaged",
       baseObject = "barrel_crate_block_damaged",
       components = {
          {
             class = "Health",
             health = 15,
              onDie = function(self)
    local foodList = {"ice_lizard_steak", "baked_maggot", "boiled_beetle", "rat_shank", "pitroot_bread", "herder_cap"}
    local many = math.random(1, 4)
    local facing = (party.facing + 2)%4

    for i = 1, many do
    spawn(foodList[math.random(1, #foodList)], self.go.level, self.go.x, self.go.y, math.random(0, 3), self.go.elevation)

    end
       end
          }
       }
    }


Re: Ask a simple question, get a simple answer

Posted: Thu Oct 03, 2019 8:02 am
by Eleven Warrior
melierax wrote: Wed Oct 02, 2019 10:10 pm

Code: Select all

defineObject {
       name = "exploding_barrel_block",
       baseObject = "barrel_crate_block",
       components = {
          {
             class = "Health",
             health = 30,
             onDie = function(c)
                if ( c.property ~= nil ) then
                   --print("BLOCKED")
                   return
                end
                
                c.property = 1;
                local i, j;
                
                for i = -1, 1 do
                   for j = -1, 1 do
                      spawn("fireburst", c.go.level, c.go.x + i, c.go.y + j, 0, c.go.elevation)
                   end
                end
             end
          }
       }
    }

 defineObject {
       name = "nour_barrel_block",
       baseObject = "barrel_crate_block",
       components = {
          {
             class = "Health",
             health = 15,
             onDie = function(c)
                if ( c.property ~= nil ) then
                   --print("BLOCKED")
                   return
                end
                
                c.property = 1;
                      spawn("nour_barrel_crate_block_damaged", c.go.level, c.go.x, c.go.y, 0, c.go.elevation)
             end
          }
       }
    }


defineObject {
       name = "nour_barrel_crate_block_damaged",
       baseObject = "barrel_crate_block_damaged",
       components = {
          {
             class = "Health",
             health = 15,
              onDie = function(self)
    local foodList = {"ice_lizard_steak", "baked_maggot", "boiled_beetle", "rat_shank", "pitroot_bread", "herder_cap"}
    local many = math.random(1, 4)
    local facing = (party.facing + 2)%4

    for i = 1, many do
    spawn(foodList[math.random(1, #foodList)], self.go.level, self.go.x, self.go.y, math.random(0, 3), self.go.elevation)

    end
       end
          }
       }
    }

Thank you :)

Re: Ask a simple question, get a simple answer

Posted: Thu Oct 03, 2019 8:57 am
by Eleven Warrior
How do I add a walking sound in this Tile below. The floor is wood and i have a sound that sounds like the party is walking on a wood floor but i dont know how to add the code into the tile code ty :)

Code: Select all

defineTile{
  name = "sx_ship_arena",
  editorIcon = 112,
  color = {120,120,45,125},
  randomFloorFacing = false,
  solid = false,
  builder = "dungeon",
	floor = {
	"sx_ship_floor", 1,
	},
	automapTile = "ground",
}

Re: Ask a simple question, get a simple answer

Posted: Thu Oct 03, 2019 9:43 am
by bongobeat
you add moveSound ="my_sound", in the definition

Code: Select all

defineTile{
  name = "sx_ship_arena",
  editorIcon = 112,
  color = {120,120,45,125},
  randomFloorFacing = false,
  solid = false,
  builder = "dungeon",
	floor = {
	"sx_ship_floor", 1,
	},
	automapTile = "ground",
	moveSound = "my_sound",
}
then you have to define your moveSound.

Re: Ask a simple question, get a simple answer

Posted: Fri Oct 04, 2019 4:40 am
by Eleven Warrior
How do I add a stack of 4 rocks to the Mouse Pointer ty :)

EDIT: Dump sorry.

Re: Ask a simple question, get a simple answer

Posted: Fri Oct 04, 2019 5:35 am
by Eleven Warrior
How do I get this script to check the ID of the item eg: rock_1 not just the UI name rock?

Code: Select all

-- Check if party is carrying item the door opens --
function dooropen01()
if party.party:isCarrying("rock") then
	dungeon_door_iron_1.door:open()
		hudPrint("You have the rock to open the door.")
else
	dungeon_door_iron_1.door:close()
		hudPrint("You need a rock to open this door friends.")
 end
end

Re: Ask a simple question, get a simple answer

Posted: Fri Oct 04, 2019 5:25 pm
by 7Soul
Eleven Warrior wrote: Fri Oct 04, 2019 5:35 am How do I get this script to check the ID of the item eg: rock_1 not just the UI name rock?
Try this

Code: Select all

local rock = false
for c=1,4 do
	local champion = party.party:getChampionByOrdinal(c)
	for slot=1,ItemSlot.MaxSlots do
		local item = champion:getItem(slot)
		if item and item.go.id == "rock_1" then
			rock = true
			break
		end
	end
end
if rock then
	-- has rock_1
else
	-- doesn't have it
end

Re: Ask a simple question, get a simple answer

Posted: Fri Oct 04, 2019 8:17 pm
by Eleven Warrior
Thank you kindly for the Script mate :)

EDIT: It needs to be a function. A floor_trigger activates the script checks for the item then stuff happens sorry.

Re: Ask a simple question, get a simple answer

Posted: Sat Oct 05, 2019 12:29 am
by 7Soul
Eleven Warrior wrote: Fri Oct 04, 2019 8:17 pm Thank you kindly for the Script mate :)

EDIT: It needs to be a function. A floor_trigger activates the script checks for the item then stuff happens sorry.
Put it in a function then

Re: Ask a simple question, get a simple answer

Posted: Sat Oct 05, 2019 10:00 am
by Zo Kath Ra
7Soul wrote: Sat Oct 05, 2019 12:29 am
Eleven Warrior wrote: Fri Oct 04, 2019 8:17 pm Thank you kindly for the Script mate :)

EDIT: It needs to be a function. A floor_trigger activates the script checks for the item then stuff happens sorry.
Put it in a function then
Genius :)