Page 297 of 396
Re: Ask a simple question, get a simple answer
Posted: Fri Apr 05, 2019 6:48 pm
by Pompidom
function wardenrepair()
warden_2.brain:seek(16,17)
end
I disabled monster component
After the first step he gets stuck frozen. What am i missing?
the location he needs to walk to is 3 steps forward. There is nothing blocking him.
Re: Ask a simple question, get a simple answer
Posted: Fri Apr 05, 2019 7:49 pm
by Zo Kath Ra
Pompidom wrote: ↑Fri Apr 05, 2019 6:48 pm
function wardenrepair()
warden_2.brain:seek(16,17)
end
I disabled monster component
After the first step he gets stuck frozen. What am i missing?
the location he needs to walk to is 3 steps forward. There is nothing blocking him.
viewtopic.php?p=84148#p84148
Re: Ask a simple question, get a simple answer
Posted: Fri Apr 05, 2019 7:54 pm
by minmay
1. you should disable the BrainComponent, not the MonsterComponent, to stop the monster from moving on its own
2. seek() only takes one step, it doesn't put the monster into some kind of seeking state, it just takes one step towards the target
Re: Ask a simple question, get a simple answer
Posted: Fri Apr 05, 2019 11:47 pm
by Pompidom
https://www.youtube.com/watch?v=VUuQsmzIiQ4
hooked the scripts to a timer. Works great
Re: Ask a simple question, get a simple answer
Posted: Sat Apr 06, 2019 4:23 am
by vanblam
I think I'm missing something on my math here and I can't figure out what it is. I can't get "nothing" to spawn more then the others, I keep getting the same amount, definitely more then 80% its more like 20% even if I have my math set to 50%. Most likely I'm doing something wrong.
Code: Select all
local autoDecoFloorDetail2 = function(self)
local g = self.go
local choice = math.random()
if choice <= 0.04 then
spawn("rc_ground_tiles_04",g.level,g.x,g.y,math.random(0,3),g.elevation)
elseif choice <= 0.08 then
spawn("rc_ground_tiles_02",g.level,g.x,g.y,math.random(0,3),g.elevation)
elseif choice <= 0.12 then
spawn("rc_ground_tiles_05",g.level,g.x,g.y,math.random(0,3),g.elevation)
elseif choice <= 0.16 then
spawn("rc_ground_tiles_03",g.level,g.x,g.y,math.random(0,3),g.elevation)
elseif choice <= 0.20 then
spawn("rc_ground_tiles_01",g.level,g.x,g.y,math.random(0,3),g.elevation)
else
spawn("nothing",g.level,g.x,g.y,math.random(0,3),g.elevation)
end
end
That should spawn "nothing" 80% no?
Code: Select all
defineObject{
name = "nothing",
baseObject = "base_floor_decoration",
components = {
{
class = "Null",
},
},
editorIcon = 96,
}
That is my "nothing" object.
EDIT: Ok I think I found my problem LOL.. I can't do this can I?
Code: Select all
defineObject{
name = "base_cave_ground",
baseObject = "base_floor",
components = {
{
class = "Null",
name = "grass",
onInit = autoDecoFloorDetail,
},
{
class = "Null",
name = "tiles",
onInit = autoDecoFloorDetail2,
},
{
class = "Null",
name = "pebbles",
onInit = autoDecoFloorDetail3,
},
},
}
What would be the proper way to spawn 3 separate details on the same tile?
Re: Ask a simple question, get a simple answer
Posted: Sat Apr 06, 2019 6:22 am
by minmay
It's not clear to me what your objective is here. Why do you have this "nothing" object at all, instead of just not spawning anything there? You have three of these autoDecoFloorDetail functions but are only showing one of them, are the others similar?
The function you posted does spawn "nothing" 79.999999999999977796% of the time, so there's something you're not showing us.
Re: Ask a simple question, get a simple answer
Posted: Sat Apr 06, 2019 6:49 am
by vanblam
minmay wrote: ↑Sat Apr 06, 2019 6:22 am
It's not clear to me what your objective is here. Why do you have this "nothing" object at all, instead of just not spawning anything there? You have three of these autoDecoFloorDetail functions but are only showing one of them, are the others similar?
The function you posted does spawn "nothing" 79.999999999999977796% of the time, so there's something you're not showing us.
I am stupid ROFLMAO.. turns out when I was exporting my pebbles I had a floor tile not hidden on another layer hahahaha. so when I was running them all I thought I was getting more tiles. O M G .. face palm.
Yes I have 3 separate functions running on the same floor tile and I want there to be a chance nothing will spawn there. basically I want there to be a chance for a tile,pebble and grass with a mix of the 3. So you could have a grass and a tile, tile and a pebble, just a tile etc.
On another note how would I get nothing to spawn there on the "else"? or can you end it with "elseif"?
Re: Ask a simple question, get a simple answer
Posted: Sat Apr 06, 2019 6:54 am
by minmay
vanblam wrote: ↑Sat Apr 06, 2019 6:49 amOn another note how would I get nothing to spawn there on the "else"? or can you end it with "elseif"?
um...if you want to do nothing, you don't need an "else" at all, just put the "end" there!
Re: Ask a simple question, get a simple answer
Posted: Sat Apr 06, 2019 6:59 am
by vanblam
Code: Select all
if choice3 >= 0.4 then
spawn("rc_ground_pebbles_04",g.level,g.x,g.y,math.random(0,3),g.elevation)
elseif choice3 >= 0.5 then
spawn("rc_ground_pebbles_01",g.level,g.x,g.y,math.random(0,3),g.elevation)
elseif choice3 >= 0.6 then
spawn("rc_ground_pebbles_02",g.level,g.x,g.y,math.random(0,3),g.elevation)
elseif choice3 >= 0.7 then
spawn("rc_ground_pebbles_03",g.level,g.x,g.y,math.random(0,3),g.elevation)
end
So like that?
Re: Ask a simple question, get a simple answer
Posted: Sat Apr 06, 2019 7:13 am
by minmay
Exactly like that.