map changing
Displaying 1-20 of 21 total.
12 next
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
eltimo

I was wondering if soemone could give me an example of a code so that when you activate a zone you go to another map. Thanks!

El

Timo

Posted on 2005-12-12 15:38:08 (last edited on 2005-12-14 14:12:55)

Overkill


void ExitMyMap()
{
Map("myothermap.map");
}

Posted on 2005-12-12 17:05:10

rosh.r03

Quote:
Originally posted by Overkill


void ExitMyMap()
{
Map("myothermap.map");
}


so if we wanted it at a certain point would we type:

void ExitMyMap()
{
Map("myothermap.map" 5,5);
}
? because that really confuses me.

Posted on 2005-12-13 04:28:27

resident

No: By default, all you can do is switch the map, and then the engine will discard your current map and load the specified map and execute it's Verge C file, starting with the autoexec function you've chosen in Maped.

The Autoexec function will need to create a new entity and hand control of it to the player.

You'll need to add at least three global variables to your system VC.

int plr; // this is used to store the current player entity
int plrx;
int plry;

These will be used to store the position you want to create the entity at when you leave the current map (you can't use local variables, because they're attached to the map VC, and they'll be lost after you perform a map(); command.

Then, instead of calling the usual map command, you use mapswitch( <mapname>, <x>, <y> );

Add this function to your SYSTEM.VC

void mapswitch( string mapname, int x, int y)
{
plrx=x;
plry=y;
Map(mapname);
}

This takes a string, for the mapname, and the x and y co-ordinates you want to create the new player entity at. It then copies the X+Y co-ordinates into the global plrx, plry variables, for safekeeping, then executes the new map.

Then you add lines like the following to every MAP.VC that you create:

plr = EntitySpawn( plrx, plry, "art/chr/alex.chr");
SetPlayer(plr);



...Questions?

Posted on 2005-12-13 10:50:45

rosh.r03

thanks thats alright so far but after the string do you put .map after it or not? i'm guessing not.
(EDIT: do we actualy edit any thing on the zones in MapEd?)

(\__/)
( 0.o)
(> <)
wwwwwwww

Posted on 2005-12-14 10:15:59 (last edited on 2005-12-14 10:33:43)

eltimo

would this work then?


void mapswitch( string mapname, int x, int y)
{
plrx=5;
plry=5;
Map(tutorial2.map);
}

??????

Posted on 2005-12-14 10:29:34

eltimo

Posted on 2005-12-14 10:38:24 (last edited on 2005-12-14 14:11:57)

eltimo

Sorry, that was one of my retarded friends!
sorry!
would that work?????

Posted on 2005-12-14 10:42:11 (last edited on 2005-12-14 14:12:30)

Overkill

Quote:
Originally posted by eltimo

would this work then?


void mapswitch( string mapname, int x, int y)
{
plrx=5;
plry=5;
Map(tutorial2.map);
}

??????



Nope. Instead, put this in system.vc:

void MapSwitch(string mapname, int x, int y)
{
plrx = x;
plry = y;
Map(mapname);
}


Then use this function for anywhere you want to map switch. And here's an example of how:

MapSwitch("tutorial2.map", 5, 5);


Then it'll probably work.

Posted on 2005-12-14 14:31:16 (last edited on 2005-12-14 14:34:58)

eltimo

Thanks Overkill!!

Posted on 2005-12-14 15:51:53

eltimo

I entered this code exactly:
void MapSwitch(string mapname, int x, int y)
{
plrx = x;
plry = y;
Map(mapname);
}

MapSwitch("tutorial2.map", 5, 5);

and got an error message saying mising brace(MapSwitch)

Posted on 2005-12-14 16:02:46

CrazyAznGamer

Do this instead:

void MapSwitch(string mapname, int x, int y)
{
plrx = x;
plry = y;
Map(mapname);
}

void NextMap()
{
MapSwitch("tutorial2.map", 5, 5);
}

And in your MAP file, create a zone that will activate NextMap when you touch it.

Posted on 2005-12-14 16:08:59

resident

Only the void mapswitch(); function and the declaration of the three global variables has to go into the system.VC. Once you can do that, and get it to compile, you basically have an extra, soft-coded VERGE C function that you can use in place of the map command.

So anyplace in your map.VC's you'd call map("tutorial2.map"), you can instead call mapswitch("tutorial2.map", 5, 5); and use the x&y co-ordinates to specify where the new player entity should be spawned.

Posted on 2005-12-14 23:47:27

eltimo

it sez plrx isn't a recognised commeand

Posted on 2005-12-16 13:25:26

Overkill

*sighs* So, put the following in the system.vc then (with the other stuff, keep the other stuff you've already got in there):

int plrx, plry, plr;


Do that. For christ's sake, learn how to declare variables and functions! I'm getting fed up with this thread.

Posted on 2005-12-16 17:42:50

mcgrue

Don't get fed up because he doesn't know basic scripting, Overkill. He obviously needs to have a beginner's tutorial to cover the basics in easy-to-understand language and intuitive examples!

...ahem.

Posted on 2005-12-16 21:46:32

eltimo

I'd just like to say that although that was quite along time ago, by that point I had read all the manuals and a large amount of the documents and if i still didn't get it surely it was allright to ask?

Posted on 2006-01-13 13:27:57

eltimo

I'd just like to say that although that was quite along time ago, by that point I had read all the manuals and a large amount of the documents and if i still didn't get it surely it was allright to ask?

Posted on 2006-01-13 13:27:58

Overkill

Er, sorry. It is true that you're right. I was wrong to have gotten frustrated just because you couldn't figure it out right away. I really couldn't explain things in a straightforward way. But sometimes you have to teach yourself, rather than have others teach you.

I remember the many times I tried and failed as a kid trying to code, but eventually I learned. It helped by studying other people's games and examining how they did something with their code, and then taking the general steps to create something of my own.

Reading documents on code won't teach you everything. Their main purpose is for you to be able to teach yourself, since any example given is *almost* always smaller than a real issues you'll approach when making a game.

So yeah, just keep at it, and throw down your problems in the help thread, but remember that we can only help so much, and that ultimately it's up to you. No hard feelings, right? :D

Posted on 2006-01-14 15:22:10

resident

Another good trick is, rather than starting out from scratch, is to build off a base like Sully. Infact, I'd go so far as to say that's exactly what people should do first.

In some ways, it seems like cheating to use other people's work like that, but some of the most fondly remembered demos are V1 work, and Sully doesn't provide much more functionality than V1 used to (though it does do it so much better and more flashily, Grue)

The thing is, by building off Sully, you gain a decent understanding of the dev-tools and a basic understanding of Verge C, before you start out to create your own monster-RPG from scratch.

Posted on 2006-01-16 04:38:02


Displaying 1-20 of 21 total.
12 next
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.