home home

downloads files

forum forum

docs docs

wiki wiki

faq faq

Cube & Cube 2 FORUM


Make a weapon that modifies blocks

by vinny on 06/25/2015 22:02, 5 messages, last message: 12/28/2015 21:02, 1499 views, last view: 04/23/2024 06:14

I'm trying to replicate the following Cube 2 mod in Tesseract:

[url]https://www.youtube.com/watch?v=dKng8p4YNlM[/url]

So far, i dug around octaedit.cpp and weapon.cpp, and made the following modification to the hit() method:

Added this:
[code]
selinfo sel;
sel.cx = 0;
sel.cy = 0;
sel.cxs = sel.s[R[0]]*2;
sel.cys = sel.s[C[0]]*2;
sel.o = at.o;
edittrigger(sel, EDIT_DELCUBE)
[/code]

But nothing happens. Does anyone know i can trigger block changes to whatever wall a weapon hits? EDIT_DELCUBE is just an example. I'll make a struct for different types of weapons, determining which weapon does what. One creates cubes, another deletes, another can push the edges, one can paint textures, etc, etc.

   Board Index   

#1: ..

by suicizer03 on 06/26/2015 00:16

Not 100% sure, but for this you don't need to modify the source code. It could be done with cubescript by shooting to a cube, then let it toggle to edit-mode (edittoggle), select the cube on sight (dragging), execute to delete the selection (editdel) and toggle back to normal mode again.

reply to this message

#2: ..

by suicizer03 on 06/26/2015 02:11

if you do still want to work by modifying the source code, perhaps it's because you're not in edit-mode?

reply to this message

#3: ..

by vinny on 06/26/2015 15:50

I have disabled the edit mode "if" inside the edit commands, allowing them to be run during normal play.

reply to this message

#4: Re: ..

by suicizer03 on 06/26/2015 21:52, refers to #3

Then perhaps you should try the cubescript version. I wouldn't be able to help any further than that as I'm not a coder.

reply to this message

#5: ..

by chasester on 12/28/2015 21:02

the reason is two fold:

1. is that edittrigger doesnt do the deleting, this just tells the game that you are trying to delete a cube, so you can tell the server.

2. You need to disable a command called noedit. if you allow this it will delete the cube in the selection spot of your last edit update (meaning last time you where in edit mode). Thats not what we want, so...

3. You need to make the selinfo update even when not in the edit mode. So in rendereditcursor (in octaedit.cpp). You need to allow this to run even when in noneditmode, so what you need is to first have this run when its not edit mode, then set hidecursor to true so that the cursor doesnt render but the selinfo updates :)

Note: Now you can manually update this like you did above just look at the way its done in that method.

Then you can do the following

void SOMERANDOMCOMMANDNAME()
{
if(!noedit(false, false, true); //add another paramater bool force;
edittrigger(sel, EDIT_DELCUBE)
editmode = true;
delcube(); //delcube is in octaedit so make sure this command can see it
editmode = false;
}

reply to this message

   Board Index   


Unvalidated accounts can only reply to the 'Permanent Threads' section!


content by Aardappel & eihrul © 2001-2024
website by SleepwalkR © 2001-2024
53747031 visitors requested 71515846 pages
page created in 0.020 seconds using 10 queries
hosted by Boost Digital