• Welcome to Battlezone Universe.
 

News:

Welcome to the BZU Archive dated December 24, 2009. Topics and posts are in read-only mode. Those with accounts will be able to login and browse anything the account had access granted to at the time. No changes to permissions will be made to be given access to particular content. If you have any questions, please reach out to squirrelof09/Rapazzini.

Main Menu

Dll Object placement Help

Started by shane ward, November 10, 2008, 02:05:02 PM

Previous topic - Next topic

shane ward

Yep need a little help, how can I get my children to be good ;)

Oopss, sorry wrong thing... Never mind, I thought I know everything about using the scriptor but even I gets into a little trouble, OK Down to business.

What I am after is a way or command to get objects that are placed in a map to face a given position, like dropships,

I need my dropships to face each other and units will then come out of them into a centre point, Like the dropships are all in a circle formation then the doors open and the ships all come out into the middle of the circle.

But I need the dll to add the landing dropship, replace it with the flying one and then take off.  But I am not sure how to get the dropships to face in the correct angle..

Thanks
Shane
Battlezone 2 Mod and Map Maker.
See my site: -
http://www.shanesdoomwads.freeservers.com/bz2

GSH

To set an angle, pass in a matrix to BuildObject. To set the angle you want, look at http://en.wikipedia.org/wiki/Rotation_matrix -- given an angle, you can build the matrix you want.

Some sample code, based on the wiki matrices:

Matrix m;

// Make matrix rotated around X axis
memset(&m, 0, sizeof(m)); // clear to all 0's
m.right.x = m.positw = 1.0f;
m.up.y = m.front.z = portable_cos(angle); // angle needs to be in radians, i.e. degrees * 180.0f / Pi
m.front.y = portable_sin(angle);
m.up.z = -m.front.y; // == -1.0f * portable_sin(angle);


// Make matrix rotated around Y axis
memset(&m, 0, sizeof(m)); // clear to all 0's
m.up.y = m.positw = 1.0f;
m.right.x = m.front.z = portable_cos(angle); // angle needs to be in radians, i.e. degrees * 180.0f / Pi
m.right.z = portable_sin(angle);
m.front.x = -m.right.z; // == -1.0f * portable_sin(angle);

etc

-- GSH

shane ward

Thanks very much for the help GSH, But I one major disavantage. I cannot code in C++ or whatever the dll's are made, I am using the dll scriptor, so I need the command for the scriptor...

Hay I bet the people that made the dll's when the game was being made wished they had all the tools we have now ;)

Shane
Battlezone 2 Mod and Map Maker.
See my site: -
http://www.shanesdoomwads.freeservers.com/bz2

GSH

Knowing what I do now, if we had the chance for a do-over, I'd make the DLL & AIP files big lua files. Then again, lua wasn't really in a usable state back in 1998. I know some people would prefer python, but I've used lua far more, and its memory footprint is far more reasonable, which would have been important in 1999/2000.

-- GSH

shane ward

Would be easy if the dll's where just simple script laid out like the dll scriptor and I think the aip files are fine, remember it is easy for modders to learn and make, but I do believe the dll's are far more complicated which can throw a lot of people of making mods if it was not for the dll scriptor, just imagine if the game was popular back then.

I also find it useful that everything is not all bunched into one big file, ODF, Graphics, Shell, Cfgs, maps, sounds and that. Makes it easy to know what you are doing, but can get into a mess if the modder is not organised

shane
Battlezone 2 Mod and Map Maker.
See my site: -
http://www.shanesdoomwads.freeservers.com/bz2

Nielk1

DLLs are simple scripts! That is when they are still in C++ source code form.

I need to see how to replace an object with C++, IIRC, there is no replace command, which means what the scriptor does is actually remove and place an item in the same area. I have to look, there might have been a replace.

Click on the image...

OvermindDL1

Quote from: GSH on November 10, 2008, 02:59:57 PM
Knowing what I do now, if we had the chance for a do-over, I'd make the DLL & AIP files big lua files. Then again, lua wasn't really in a usable state back in 1998. I know some people would prefer python, but I've used lua far more, and its memory footprint is far more reasonable, which would have been important in 1999/2000.
True, lua is much better for basic game scripting.  I only used Python because at the time LUA did not have coroutine support (I did make a LUA scriptor for BZ2 as well, and it is functional, might still be to this day, I have the source code around here somewhere, just needs to be updated from version 4.0 to the current), and full coroutine support is just way to freaking nice for scripts like these missions. :P

Generated by OvermindDL1's Signature Auto-Add Script that OvermindDL1 did manually since Greasemonkey does not work in Firefox 3.1 yet...


GSH

Quote
I need to see how to replace an object with C++, IIRC, there is no replace command, which means what the scriptor does is actually remove and place an item in the same area. I have to look, there might have been a replace.

Replace is just a remove and create. It's not hard to do this in C++:

// Replaces an object with a new one sharing characteristics. Returns 0 on any problems.
Handle ReplaceObject(Handle h, char* odf)
{
if(h == 0)
return 0;

float healthRatio = GetHealth(h);
float ammoRatio = GetAmmo(h);
int team = GetTeamNum(h);
Matrix m;
GetPosition(h, m);

RemoveObject(h);

Handle newH = BuildObject(odf, team, m);
if(newH == 0)
return 0;

SetCurHealth(newH, healthRatio * GetMaxHealth(newH));
SetCurAmmo(newH, ammoRatio * GetMaxAmmo(newH));
return newH;
}

If I can do this in 3-4 minutes eyeballing scriptutils.h, so can you.

-- GSH

Warfreak

I don't know why, but i can READ lua, jsut cant WRITE in it, i tried once.... lets jsut the game completely crashed.  :cry:

TheJamsh

i can only use .dll scriptor... learning C++ is jsut something i dont have time for these days.


BZII Expansion Pack Development Leader. Coming Soon.

AHadley

Why have both of you both spelt jsut wrong?

I have got to learn C++ and other languages... any ideas where I can go?

gotta learn scriptor too, maybe I'll do that first.

Warfreak

http://www.functionx.com

Has tutorials on C++ and all derivatives of it. Even has tutorials on how to use the programming enviroments that are avaliable.

AHadley

Ouch, that's gonna take a while.

GSH

I recommend Bruce Eckel's Thinking in C++ as a reference to learn C++. It's a free download from http://www.mindview.net/Books/DownloadSites/ -- his main site is http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html .

There are recommendations for *how* to compile & modify C++ DLLs included w/ the DLL source that's been released with the 1.3 patches.

-- GSH

AHadley

Hmm, thanks!

*looks*

Sheesh, that's gonna take even longer!