no worries, guys, i solved this problem by myself, thanks to Isaac help
here is the defineObjet about a general object you have to use. let's stay on the example. so a brush to paint a wall:
Code: Select all
defineObject{
name = "brush",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/env/brush.fbx",
offset = vec(0, 0, -1.5),
},
{
class = "Item",
uiName = "Brush",
gfxAtlas = "mod_assets/textures/brush_atlas.tga",
gfxIndex = 26,
impactSound = "impact_blunt",
weight = 20,
primaryAction = "paint",
projectileRotationX = 0,
projectileRotationY = 0,
description = "It's a Brush, don't use on walls, Vandal!!!",
},
{
class = "ItemAction",
name = "paint",
uiName = "Brush",
cooldown = 4,
onAttack = function(self, champion, slot)
--THIS IS FOR WALLS ARE FACING YOU
reit = 0
local dx, dy = getForward(party.facing)
for wal in party.map:entitiesAt(party.x, party.y) do
if string.match(wal.name, "wall") then
if wal.elevation == party.elevation and wal.facing == party.facing and reit == 0 then
local ladx, lady = getForward(wal.facing)
-- [PAINT FUNCTION HERE]
reit = reit +1
end
end
end
--SOME ASSETS HAS WALLS YOU CAN SEE FROM BOTH SIDES SO THEY COULD STAY REVERSAL, NOT FACING YOU. SO...
for wal in party.map:entitiesAt(party.x+dx, party.y+dy) do
if string.match(wal.name, "wall") then
if wal.elevation == party.elevation and wal.facing == (party.facing+2)%4 and reit == 0then
-- [AGAIN PAINT FUNCTION HERE]
reit = reit +1
end
end
end
end,
},
},
placement = "floor",
editorIcon = 666,
tags = { "KrougH" },
}
it MOSTLY works...
problems are:
it desn't work on mine's walls and beach's walls... and .. .don't remember...
by the way i used almost the same defineObject than the Horn . at the beginning of the game, first Bossfighting. you stand in a circle of rocks and play the horn. in the same way you place in front of a wall and paint. i think you could use for every other idea like...
using a magnifying glass on a leaf...
or... you know the tiny_rats??? using a wood for hitting them...
should be funny!!!
imagine having a butterfly net, capturing fireflies in the forest than you can use them for making a lamp!!!
well, please let me know if you have a better way to compile this defineObject.
P.S. : errata corrige, i changed a bit the code. it was wrong. now it works good!
P.P.S: errata corrige 2, i found a problem with decorations on wall that has "wall" in their name. so it find 2 "walls" and he make the action 2 times. that's bad, so changed again.
still open to suggestions