yo wonderin if you could help
Displaying 1-20 of 52 total.
12 3 next
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
eltimo

I'm struggling with the enitity stalk and was wonderin why it wont work.
I put:
EntityStalk(crystal.chr, player_ent);

and it said: could not resolve identifier chr

do i have to state the name of the entity because i have tried that and it didn't work either. It's makin me really confused.

Posted on 2006-06-12 15:13:02

mcgrue

Well, according to the docs:
http://www.verge-rpg.com/docs/view.php?libid=1&function=102

Entity stalk has a signature of:
void EntityStalk(int stalker, int stalkee)

Basically, you need to have an integer handle to the stalker, not a filename.

What you want to do is an entityspawn first:
http://www.verge-rpg.com/docs/view.php?libid=1&function=100
int EntitySpawn(int x, int y, string chr)

Like:

int crystal_ent = EntitySpawn( 10, 10, "crystal.chr" );
EntityStalk( crystal_ent, player_ent );

...that example assumes player_ent is valid, and crystal.chr is a valid chr file in the verge project's base directory.

Posted on 2006-06-12 15:41:27

eltimo

THanks, but... i gt the same message

Posted on 2006-06-13 15:00:31

Overkill

Okay. There's a likelihood that either the error is triggered outside of the code you think it is, or there's a larger likelihood that the error did, in fact, change (even slightly).

What does it say it can't resolve this time? Copy and paste the error out of v3.log, and also, why not paste the map's updated vc code while we're at it! :D

This would be helpful to figure out where you went wrong.

Posted on 2006-06-13 16:27:03 (last edited on 2006-06-13 16:28:32)

eltimo

actually now it says:

could not resolve identifier player_ent

Posted on 2006-06-15 12:22:56

eltimo

here is my island.vc text:



void MapInit()
{
player = EntitySpawn(1,2,"darin.chr"); // Spawn the entity
SetPlayer(player); // Give control to the player
HookButton(4,"Menu"); // Make our menu callable from the map
}

void Crystal stalk()
{
int crystal_ent = EntitySpawn( 7, 1, "evil crystal.chr");
EntityStalk( crystal_ent, player_ent );
}

void TalktoCrystal()
{
TextBox("Darin:","Hey!","whats up?","");
TextBox("Crystal:","Cut the crap!","Lets do this thing","");
TextBox("Crystal:","All you need to know is space to get your menu up","and alt to put it down","");
TextBox("Darin:","So why you so pissed?","","");
TextBox("Crystal:","Its obvious isn't it","","");
TextBox("Crystal:","Your not the same","","");
TextBox("Crystal:","Change back!","","");
}

Posted on 2006-06-15 12:25:08

Overkill

My guess is that you need to change player_ent into player on the EntityStalk() line.

If it still doesn't work, make sure you declare player in system.vc.

Hope that helps you.

Posted on 2006-06-15 14:20:28

eltimo

the code works now but the entity stalk function isnt doing anything. how do i declare the player. Sorry, this must be annoying. Would i write:

int player = darin.chr

Posted on 2006-06-15 14:37:11

Overkill

Actually, if the code ran, it means you already declared player. The reason it doesn't work is because in your map's code, I see:

void Crystal stalk()
{
...

If it didn't error because of that, something small's bugged with verge. :D You can't split the event names into multiple words. You've gotta go something like this instead:

void CrystalStalk()
{
...

Then make absolutely sure you set that event to your zones or whatever.

Alternatively, call it from whereever you want to use it by going like this later on:

CrystalStalk();

Posted on 2006-06-15 15:31:17 (last edited on 2006-06-15 15:33:17)

eltimo

nah, i had already changed that to:



void TalktoCrystal2()
{
int crystal_ent = EntitySpawn( 7, 1, "evil crystal.chr");
EntityStalk( crystal_ent, player);
}

It's got to be somewhere else.

Posted on 2006-06-15 15:51:26 (last edited on 2006-06-15 15:52:06)

Overkill

Hm. Oh okay :D.

Where do you call TalktoCrystal2() from, exactly? Is Evil Crystal spawned at (7, 1)? If not, I'd assume that it might not be actually calling that function.

Posted on 2006-06-15 20:46:44

Gayo

A good debugging trick when you're not sure if certain blocks of code are being executed is to insert log() calls in them, then check the log after running.

I usually use exit() instead of log(), because I'm perverse.

Posted on 2006-06-17 21:29:53

Overkill

Heh... usually my debugging boils down to slapping unintelligible Log()s in my code and terminating with an Exit() , much like the following :


void CodeThatDoesNotWork()
{
Log("Hello!");
...
Log("Hello?");
...
Log("Hello?????");
...
Log("ARGGHH");
...
Log("ARGGHH 2");
...
Exit("SUCCESSED.");
}

Posted on 2006-06-17 23:21:50

eltimo

crystal is definitely at (7,1)

could you give me an example of the log thing using some of my code because i haven't come across this before

Posted on 2006-06-18 09:55:16

Overkill

Quote:Originally posted by eltimo

crystal is definitely at (7,1)

could you give me an example of the log thing using some of my code because i haven't come across this before



void TalktoCrystal2()
{
Log("Spawning Crystal -- the evil one, that is.");
int crystal_ent = EntitySpawn( 7, 1, "evil crystal.chr");
Log("Crystal's stalking Darin! Watch out.");
EntityStalk(crystal_ent, player);
Exit("Well, at least we know it 'works'.");
}

Posted on 2006-06-18 11:21:51

eltimo

thanks. i forgot that i hadn't put TalktoCrystal2 in my map. So my OnActivate line only worked with the first command. I can't believe i was soooo stupid. Thanks anyway.

Posted on 2006-06-18 16:25:20

eltimo

ONly slight problem is that its a clone that stalks him but thats nno biggy. Anyway to get rid of an entity?

Posted on 2006-06-18 16:35:50 (last edited on 2006-06-19 10:27:38)

Overkill

There's no way to remove an entity completely from the system, but you can make them invisible, and also make them not obstruct the player.
entity.visible[whatever_the_entity_index] = 0;
entity.obstruct[whatever_the_entity_index] = 0;
'course, you can always reuse entities too if you wanted, so then you just change the sprite of an entity, rather than spawn a new one at the exact same spot as them:
ChangeCHR(whatever_the_entity_index, "CharacterToChangeTo.chr");
Alternatively:
entity.chr[whatever_the_entity_index] = "CharacterToChangeTo.chr";

Posted on 2006-06-19 13:55:41 (last edited on 2006-06-19 13:56:39)

eltimo

yeh. I've worked that out but i still have to problems with my game:
1) Can someone explain the earthquake funcion 2 me and possibly give me an example.

void Earthquake( int x_intensity, int y_intensity, int duration )

I got this bit but i need the next.

2) My mapswitch function works but the entity doesn't appear. Any ideas???

Thanks!

Posted on 2006-06-20 16:11:53

Overkill

1) Hm. Okay, so the Earthquake function in the Sully libs:
// shakes the screen horizontally with a magnitude of x_intensity and 
// vertically with a magnitude of y_intensity for duration time
void Earthquake( int x_intensity, int y_intensity, int duration )
{
int original_x, original_y, original_camera;

original_camera = cameratracking;
cameratracking = 0; //turn off cameratracking
original_x = xwin;
original_y = ywin;

timer = 0;
while ( timer < duration )
{
xwin = original_x;
ywin = original_y;

xwin = xwin+Random(0-x_intensity,x_intensity);
ywin = ywin+Random(0-y_intensity,y_intensity);

Render();
ShowPage();
}

xwin = original_x; //restore original camera position
ywin = original_y;

cameratracking = original_camera; //restore cameratracking to the player-entity
}
Well, an example of how to use it would be as follows:
// An earthquake that lasts 3 seconds and shakes the camera
// at an intensity of 30 pixels offset in both horizontal and vertical
// directions.
Earthquake(30, 30, 300);
2) After you mapswitch, does your new map's script setup the entity? Or are you trying to set it up right after the map switch in your code? If you mapswitch, it exits whatever events/functions the script's in and moves on to the new map. So you need to set up all your important stuff before you switch maps.

Example:
Your event that triggers the map switch:
...
// Spawn Bob on the next map.
flags[FLAG_SPAWN_BOB] = 1;
Map("mynewmap.map");
// Nothing after the map switch in whatever this event is will actually be executed.
Your event that's called when the new map is started.
...
// If we were told to spawn bob...
if (flags[FLAG_SPAWN_BOB])
{
EntitySpawn(4, 4, "EvilGenius.chr");
// Don't worry about spawning Bob after now, unless we're told to again.
flags[FLAG_SPAWN_BOB] = 0;
// Optionally, set another flag called flags[FLAG_MET_BLOB],
// Which makes sure the other maps don't do this again.
}
...

Posted on 2006-06-20 16:54:20 (last edited on 2006-06-21 18:58:30)


Displaying 1-20 of 52 total.
12 3 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.