Forum

Ogres?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Ogres?

Postby redrum » Tue Oct 16, 2007 10:30 pm

Guys, I'm running into a little trouble here. I'm adding ogres to my QW mod. Here's the code:

void() create_ogre =
{
local entity ogre, spawn_spot;

// start entity and place it in world
ogre = spawn();
spawn_spot = SelectSpawnPoint ();
ogre.origin = spawn_spot.origin + '0 0 1';
ogre.angles = spawn_spot.angles;
ogre.fixangle = TRUE;
spawn_tfog (ogre.origin);
spawn_tdeath (ogre.origin, ogre);

// set size and shape
setsize (ogre, VEC_HULL2_MIN, VEC_HULL2_MAX);
ogre.solid = SOLID_SLIDEBOX;
ogre.movetype = MOVETYPE_STEP;
setmodel(ogre, "progs/ogre.mdl");
ogre.flags = ogre.flags | FL_MONSTER;
ogre.takedamage = DAMAGE_AIM;

// define his animation
ogre.th_stand = ogre_stand1;
ogre.th_walk = ogre_walk1;
ogre.th_run = ogre_run1;
ogre.th_die = ogre_die;
ogre.th_melee = ogre_melee;
ogre.th_missile = ogre_nail1;
ogre.th_pain = ogre_pain;
ogre.health = 200;

// polish him up
ogre.classname = "monster_ogre";
ogre.ideal_yaw = bot.angles * '0 1 0';
ogre.yaw_speed = 120;
ogre.view_ofs = '0 0 22';
bprint("an ogre joins the game\n");

// begin his thinking
ogre.nextthink = time + 0.1 + random();
ogre.think = bot.th_walk;
};

The line in bold seems to be the problem. Here is the error:

Type mismatch for = (entity and void)

What does that mean?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Entar » Tue Oct 16, 2007 11:00 pm

I take it you want SelectSpawnPoint to return a position for the ogre to spawn at. spawn_spot should be declared as a vector (local vector spawn_spot) and the SelectSpawnPoint function should be declared as a vector as well, though I'm not quite sure if that's legal in QC, I forget.
User avatar
Entar
 
Posts: 439
Joined: Fri Nov 05, 2004 7:27 pm
Location: At my computer

Postby Orion » Tue Oct 16, 2007 11:37 pm

SelectSpawnPoint() is in client.qc, if it is void() SelectSpawnPoint, change it to entity() SelectSpawnPoint.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Wed Oct 17, 2007 12:18 am

Thanks guys, I'll give it a go!

It already is entity() SelectSpawnPoint = in client.qc :?


Code: Select all
I tried this:

  void() create_ogre =
{   
        local entity ogre;
        local vector spawn_spot;
        etc...


Now I get - type mismatch for = (vector and void) :?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Orion » Wed Oct 17, 2007 1:41 am

Maybe has another declaration of SelectSpawnPoint() instead of the function itself in client.qc.

SelectSpawnPoint() doesn't return a vector, it returns an entity, so keep spawn_spot an entity in create_ogre().

If you find void() behind SelectSpawn..., change it to entity().

The declaration might be above create_ogre().
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Wed Oct 17, 2007 2:25 am

You tha man!
I had put - void() SelectSpawnPoint; in defs.qc! :P
I changed it to entity()...

Got the ogre to spawn! :D
He doesn't move :x
He launches pineapples, turns, his feet move like he's walking but he doesn't go anywhere?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Orion » Wed Oct 17, 2007 1:40 pm

In create_ogre(), setsize() should be AFTER setmodel(), otherwise you may get funky bounding boxes, causing the ogre to get stuck.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Thu Oct 18, 2007 3:46 am

Where would I be without you???
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby scar3crow » Fri Oct 19, 2007 1:45 pm

I would imagine somewhere in the gulf, assuming his position in Brazil acts as a balancing act to keep you in New York. Magnetism and all that.
User avatar
scar3crow
InsideQC Staff
 
Posts: 1054
Joined: Tue Jan 18, 2005 8:54 pm
Location: Alabama

Postby Sajt » Fri Oct 19, 2007 1:54 pm

'The' gulf?
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest