Jump to content

[Help] Adding a new Level


Malacath

Recommended Posts

So I was trying to do something that sounds rather simple but I'm having a rather hard time at it.
I want to add a Level that is only accessible one specific way and no other way. I thought the "Up and Away" code would help me a bit there, but what simplex and debugman18 (sorry, just had to pull you two here in hope of getting some help) have done there is totally out of reach to me...

 

So the way I understood it was that a LEVELTYPE.SURVIVAL can be choosen on startup, which I don't want. A LEVELTYPE.CAVE can be randomly choosen when entering the cave, also not an option. And a LEVELTYPE.ADVENTURE is randomly started on using the adventure portal which is obviously also not what I want.

 

Can anyone clear up any big misunderstandings here and/or point me in the right direction? Would be much appreciated ^^

Link to comment
Share on other sites

So I was trying to do something that sounds rather simple but I'm having a rather hard time at it.

I want to add a Level that is only accessible one specific way and no other way. I thought the "Up and Away" code would help me a bit there, but what simplex and debugman18 (sorry, just had to pull you two here in hope of getting some help) have done there is totally out of reach to me...

 

So the way I understood it was that a LEVELTYPE.SURVIVAL can be choosen on startup, which I don't want. A LEVELTYPE.CAVE can be randomly choosen when entering the cave, also not an option. And a LEVELTYPE.ADVENTURE is randomly started on using the adventure portal which is obviously also not what I want.

 

Can anyone clear up any big misunderstandings here and/or point me in the right direction? Would be much appreciated ^^

Well, you're right about adventure levels. They're randomly generated (mostly) so it's not an especially viable option. The first version of the mod was actually an adventure level.

 

Caves, however, are completely viable. The Up and Away world is actually, technically, at its base level, a cave. If you look in scripts/upandaway within the mod, the climbable component may help you some. What we're actually doing is using a negative level height... The mod uses @simplex's Wicker framework, and I'm not very familiar with it yet.

Link to comment
Share on other sites

Well, you're right about adventure levels. They're randomly generated (mostly) so it's not an especially viable option. The first version of the mod was actually an adventure level.

 

Caves, however, are completely viable. The Up and Away world is actually, technically, at its base level, a cave. If you look in scripts/upandaway within the mod, the climbable component may help you some. What we're actually doing is using a negative level height... The mod uses @simplex's Wicker framework, and I'm not very familiar with it yet.

Yeah, I knew that much. That you're using a negative cave hieght is kinda genious if you ask me but when I looked I totally didn't see or maybe plainly didn't understand how you declared the height of the cave level. Maybe I was looking in the totally wrong place.... I'll have another look.

Link to comment
Share on other sites

This is actually something I'm really dreading, myself - I'm going to have to do this for Link's Dungeons and Shopkeepers... but I just know it's going to be nightmarish...

 

I know exactly how I want them to work... I just have no idea how to make it happen. |D

 

 

I think the important thing with this is making sure that the numbers don't clash. There's talk of an undersea mod - which I really want to see, and if it's got the right team behind it, will be spectacular - and it might be clever to use "-20" for that. It's something that the modders are going to need to pay attention to.

 

Edit: How did I only just realise I'd written -40 when I meant -20. >.<

Stupid...

Link to comment
Share on other sites

I think the important thing with this is making sure that the numbers don't clash. There's talk of an undersea mod - which I really want to see, and if it's got the right team behind it, will be spectacular - and it might be clever to use "-40" for that. It's something that the modders are going to need to pay attention to.

Really? Who wants to create an underwater mod? I wanna see that!

 

This is actually something I'm really dreading, myself - I'm going to have to do this for Link's Dungeons and Shopkeepers... but I just know it's going to be nightmarish...

 

I know exactly how I want them to work... I just have no idea how to make it happen. |D

I took another look into the Up And Away mod and I have to tell you simplex and debugman are two geniuses if they understand what they're doing. I don't even get 95% of that code. It might actually not be to difficult but the chances of breaking something seem so great to me that I feel I just don't want to do that. If I could just create a new LEVELTYPE, idk maybe LEVELTYPE.UNDERWATER and the create a function that sends me there I'd feel a lot more confident in attempting something like that.

 

Maybe you'll be smarter than me when looking at the UaA code  ; )  So good luck

Link to comment
Share on other sites

Really? Who wants to create an underwater mod? I wanna see that!

 

I took another look into the Up And Away mod and I have to tell you simplex and debugman are two geniuses if they understand what they're doing. I don't even get 95% of that code. It might actually not be to difficult but the chances of breaking something seem so great to me that I feel I just don't want to do that. If I could just create a new LEVELTYPE, idk maybe LEVELTYPE.UNDERWATER and the create a function that sends me there I'd feel a lot more confident in attempting something like that.

 

Maybe you'll be smarter than me when looking at the UaA code  ; )  So good luck

 

I am no coding genius. I'm actually quite the novice, actually. I had a very hackish method of going to the cloud realm initially. I'm sure I would've figured it out at some point, but simplex came along as a collaborator and implemented his Wicker framework to make our lives a little easier.

 

Anyways, I've been digging around in the code for you, and I think I'll be able to point you in a very good direction. If you take a look at beanstalk.lua, you'll see how we actually put the player into the cloud realm. This is the important part:

--Makes the beanstalk climbable.local function OnActivate(inst)        SetPause(true)        local function startadventure()        SetPause(false)            inst.components.climbable:Climb()    end        local function rejectadventure()        SetPause(false)        inst.components.activatable.inactive = true        TheFrontEnd:PopScreen()    end                local options = {        {text="YES", cb = startadventure},        {text="NO", cb = rejectadventure},      }    TheFrontEnd:PushScreen(PopupDialogScreen(        "Up and Away",    "The land above is strange and foreign. Do you want to continue?",        options))    end

And this specifies which direction you want to send the player:

    inst:AddComponent("climbable")    inst.components.climbable:SetDirection("UP")

 

You'll notice it uses our climbable component to actually do the dirty work. The part of climbable.lua that you want is right here:

 -- Climbs in the configured direction. Raises an error if there isn't any.function Climbable:Climb()    assert( self.direction, "Attempt to climb a climbable without a direction set." )    local function doclimb()        if self:Debug() then            self:Say("Climbing ", self:GetDirectionString(), " into cave number ", self:GetEffectiveCaveNumber(), ". Current height: ", Climbing.GetLevelHeight(), ".")        end        Climbing.Climb(self.direction, self.cavenum)    end    if not self.cavenum and should_have_cavenum(self) then        self.cavenum = SaveGameIndex:GetNumCaves() + 1        SaveGameIndex:AddCave(nil, doclimb)    else        doclimb()    endend

 

Those won't function all by themselves, but it's certainly a good direction.

 

This brings something to my attention. Since this mod is the first to add such refined world addition, perhaps @simplex and I could post a sample world mod for interested coders. I'm sure people would find it very useful.

Link to comment
Share on other sites

This brings something to my attention. Since this mod is the first to add such refined world addition, perhaps @simplex and I could post a sample world mod for interested coders. I'm sure people would find it very useful.

That would be awesome  :D

 

Concerning the other stuff you wrote, Thanks a lot! Though I found all that already and I'm even quite sure I understand how to put a player into a certain cave. But my main issue is creating that cave with all that's necessary (layouts, biomes, tasks, cavenum, depth...)

 

But don't bother yourself to much with it right now (at least not for me, maybe Dana needs it more urgently) I'll postpone that issue to a later date when I'm not that busy anymore. Then I'll come crying back to you  ; )

Link to comment
Share on other sites

This is actually something I'm really dreading, myself - I'm going to have to do this for Link's Dungeons and Shopkeepers... but I just know it's going to be nightmarish...

 

I know exactly how I want them to work... I just have no idea how to make it happen. |D

 

 

I think the important thing with this is making sure that the numbers don't clash. There's talk of an undersea mod - which I really want to see, and if it's got the right team behind it, will be spectacular - and it might be clever to use "-20" for that. It's something that the modders are going to need to pay attention to.

 

Edit: How did I only just realise I'd written -40 when I meant -20. >.<

Stupid...

 

I want to be part of that undersea mod. Where is it?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...