Project X Forums



It is currently Thu Mar 28, 2024 10:32 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Create destructible terrain to landscape, with code?
PostPosted: Sat Aug 13, 2016 1:26 pm 
Offline
User avatar

Joined: Mon Aug 31, 2015 5:28 pm
Posts: 74
Javelin lib have a way to draw sprites on terrain but this is not what i mean.
Is there a way to draw *new* terrain, just like girder does but trough code?

This seems like something trivial, its a game about destroying terrain after all.
But i cant find any topic or even a library .. except for CLandscape which has the functions to create holes.


Top
 Profile  
Reply with quote  
 Post subject: Re: Create destructible terrain to landscape, with code?
PostPosted: Sat Aug 13, 2016 8:55 pm 
Offline
Betatester

Joined: Fri Oct 16, 2009 3:26 pm
Posts: 155
Javelin lib and possessed lib both create landscape. You can do girder, or any sprite. Here short guide:


0) Add sprite similarly to aforementioned libs (for simplicity try 1frame, like possessed.pxl does).
Code:
require utils;
CBitmap32* girderv2Bitmap;
void possessed::InitGraphic()
{
    local spr       = GetAttachment("girderv2.png");     
    girderv2Bitmap     = LoadImage(spr);
}

1) Create copy of teleport weapon (lets name it "girder v2").
2) At firefinal checkname("girder v2"), if true ->

local bmp = girderv2Bitmap;
GG->land->Draw(bmp, SelectX/65536;, SelectY/65536;));
3) return, so teleport would not trigger. My hns lib operates with fake teleport weapons btw.
4) super afterwards, for all weapons that are not named "girder v2"

If you want a method to smoothly draw terrain, you can create it using sprites, similarly to steps' painter.

_________________
Skype - verygooder1
ICQ - 420622934
Steam - http://steamcommunity.com/id/jarent/

use steam coz im too lazy to log into icq and skype


Top
 Profile  
Reply with quote  
 Post subject: Re: Create destructible terrain to landscape, with code?
PostPosted: Sun Aug 14, 2016 12:40 pm 
Offline
User avatar

Joined: Mon Aug 31, 2015 5:28 pm
Posts: 74
I watch the replay of possessed and the shield is drawn as terrain but my code is not working, it only drawn on top of existing terrain.

Edit: The problem was its not drawing outside map boundaries. This is an issue because mole maps cant have crates spawning at roof.


Top
 Profile  
Reply with quote  
 Post subject: Re: Create destructible terrain to landscape, with code?
PostPosted: Sun Aug 14, 2016 1:02 pm 
Offline
Betatester

Joined: Fri Oct 16, 2009 3:26 pm
Posts: 155
Use bigger map? I don't think girder can be put outside of the map boundaries as well.

I'm not sure, but it may be possible to create fake terrain, by creating 1x1 object that will represent a pixel, and recreate all terrain behavior in it's code. It is might lag the game out though...

edit: i realized what you mean by "crates that are spawning on roof". Maybe custom spawning manager will help? Instead of regular spawns, using scripts to put crates at random locations not on top of the map. This is pretty complex solution though :D. Maybe catch all crates that are spawning on "roof" (if y < i) and teleport them at random locations "under roof" is easier. This will require landscape checking, similar to the one in codesnippets..

_________________
Skype - verygooder1
ICQ - 420622934
Steam - http://steamcommunity.com/id/jarent/

use steam coz im too lazy to log into icq and skype


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 29 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Skin by Lucas Kane