Thread Tools
Old September 8, 2002, 15:45   #1
Turambar
Call to Power II Democracy GameCivilization II PBEMCall to Power Democracy GameCTP2 Source Code Project
Prince
 
Local Time: 07:41
Local Date: November 1, 2010
Join Date: Apr 2002
Location: England
Posts: 310
SLIC problem
Ok here's a little problem for everyone. Basically when the code below runs the game stops/slows down for a couple of minutes and then returns to normal.

Quote:
HandleEvent(CreateCity) 'HomeCity' post {
city_t tmpCity;
unit_t tmpUnit;
location_t cityloc;
tmpCity = city[0];
int_t homecity[];
int_t tmpPlayer;
tmpPlayer = player[0];
cityloc = location[0];
CreateUnit(player[0], UnitDB(UNIT_WAR_CHIEF), cityloc, 0);
homecity[tmpUnit] = tmpCity.name;
message(tmpPlayer, 'five');
}
Basically what I want the SLIC to do is when a city is built, for my War Chief unit to be built with it and for the city the unit is built in to be stored so that I can find out the units home city in the future.

The line that is messing things up is:

Quote:
homecity[tmpUnit] = tmpCity.name;
I don't think this part even works so what am doing wrong? (I haven't been using SLIC very long if you haven't already guessed)

All I want to be able to do is get the home city of the unit when I want.

I hope some of that made sense .
Turambar is offline  
Old September 8, 2002, 17:37   #2
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 08:41
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
tmpCity.name is a string.
homecity[tmpUnit] is an integer.
The one cannot be stored in the other.

If you are doing what I think, that is, assign the unit's home city to the homecity[] array, then you need homecity[] to be a city_t array.

You also need to change
Code:
homecity[tmpUnit] = tmpCity.name;
to
Code:
homecity[tmpUnit] = tmpCity;
And that should sort it.

Its great to see you SLICing Turambar
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
Immortal Wombat is offline  
Old September 8, 2002, 17:43   #3
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 04:41
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Why would you want homecity[tmpUnit] to equal tmpCity.name ?

If it is for the message. just write {tmpCity.name} or {city[0].name}in the message it will read as the city name. It does not have to be in the code so delete this part.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand

Last edited by Pedrunn; September 8, 2002 at 18:08.
Pedrunn is offline  
Old September 8, 2002, 22:25   #4
Dale
Emperor
 
Dale's Avatar
 
Local Time: 17:41
Local Date: November 1, 2010
Join Date: Dec 2000
Posts: 3,944
IW:

Just the programming coming out of me, but why store the entire city (and filling a lot of RAM if you have MANY units) if you can just store the city location? A lot less RAM hungry. Just a thought. Another benefit is if you want your unit to go home, just pass homecity[tmpUnit] into it's movement path.
Dale is offline  
Old September 9, 2002, 13:54   #5
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 08:41
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
Yeah, I guess. Depends why Turambar's doing it I guess.
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
Immortal Wombat is offline  
Old September 9, 2002, 14:58   #6
Turambar
Call to Power II Democracy GameCivilization II PBEMCall to Power Democracy GameCTP2 Source Code Project
Prince
 
Local Time: 07:41
Local Date: November 1, 2010
Join Date: Apr 2002
Location: England
Posts: 310
Thanks for the responses I'll try them out soon.

The idea behind this is:

A War Chief unit (these upgrade the more they win) is created in each city and I want to store where it comes from so that, for example if another civ takes London then the war chief from there who may be in a 12 stack army (being the leader of it) might (I'm going to give them personalities) then disobey your orders (if you order him not to retake the city) and go and try to retake his home city.

Also if he dies then a replacement can be built in that city.

I'll also want to use it in messages.

I've a few other half developed ideas in addition to this too.

More questions to follow .
Turambar is offline  
Old September 11, 2002, 08:29   #7
Iroquois
Settler
 
Iroquois's Avatar
 
Local Time: 10:41
Local Date: November 1, 2010
Join Date: Sep 2002
Posts: 13
Hi, all
Does anybody know what mean BombRounds and BombardRange strings in Units.txt? Is it active or disabled?

Is it possible to write SLIC's for Civ-specific units and Run after bombard (if Unit have enough move point after bombard action)?

Regards.
Iroquois is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 03:41.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team