|
Re: Strategy game snippet
[Re: Minamato]
#385509
10/19/11 10:41
10/19/11 10:41
|
Joined: Mar 2011
Posts: 3,150 Budapest
sivan
Expert
|
Expert
Joined: Mar 2011
Posts: 3,150
Budapest
|
just check stratego 2 in AUM-11 ( http://aum.gstools.de/aum/aum11/code.html), it is much easier to be converted to lite-C in AUM42 there is a download link for C&C Chapter 1, which should be good for you ( http://aum.gstools.de/aum/aum42/user.html) somewhere on the forum I found its translation to lite-C called cc_chapter1_reload. if you don't find I can upload. if you need a TotalWar like camera system, you can download my example I posted as a bug report, the link is somewhere in the 'Ask the Developer' section moreover, I'm planning to provide such codes on my webpage in Nov-Dec for supporting my new standalone 3D Gamestudio editor at http://mapbuilder.zxq.net
|
|
|
Re: Strategy game snippet
[Re: Minamato]
#386037
10/27/11 10:29
10/27/11 10:29
|
Joined: Feb 2009
Posts: 80 STRING* location = "Germany";
Minamato
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
|
While translating the code to lite-c, I am confronted with a problem: If I leave the following lines like they are, I will get the error message "Error in line 138: 'enable_click': is not a member of 'ENTITY'".
my.enable_click = on;
my.enable_entity = on;
my.enable_block = on;
But if I change them to the following lines, I will get the error message "Error in line 138: syntax error".
my.ENABLE_CLICK = ON;
my.ENABLE_ENTITY = ON;
my.ENABLE_BLOCK = ON;
Can somebody help me?
|
|
|
Re: Strategy game snippet
[Re: Minamato]
#386044
10/27/11 12:47
10/27/11 12:47
|
Joined: Dec 2008
Posts: 1,660 North America
Redeemer
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,660
North America
|
In Lite-C flags are no longer treated as structure elements but bit flags. The standard entity flags, like INVISIBLE, BRIGHT, and PASSABLE can be accessed by referencing the bits of the entity.flags variable. The entity event flags, like ENABLE_CLICK, ENABLE_ENTITY, and ENABLE_BLOCK can be accessed by referencing the bits of the entity.eflags variable. There are macros built into Lite-C so you don't have to use OR and AND operators to access the bits of the entity.flags variable, and can instead use more simple commands like the following (red is c-script, green is lite-c):
my.invisible = on; // turns on flag
my.invisible = off; // turns off flag
if( my.invisible == on ) // returns 1 if flag is on
if( my.invisible == off ) // returns 1 if flag is off
set(my,INVISIBLE); // set flag on
reset(my,INVISIBLE); // set flag off
if( is(my,INVISIBLE) ) // returns 1 if flag is on
if( !is(my,INVISIBLE) ) // returns 1 if flag is off
Unfortunately for the event flags in entity.eflags no such macros exist, so you must access the bits yourself with boolean operators such as AND and OR. Here are some examples:
my.eflags |= ENABLE_CLICK; // set flag on
my.eflags &= ~ENABLE_CLICK; // set flag off
if( my.eflags & ENABLE_CLICK ) // returns 1 if flag is on
if( !(my.eflags & ENABLE_CLICK) ) // returns 1 if flag is off
|
|
|
Re: Strategy game snippet
[Re: Minamato]
#386076
10/27/11 20:00
10/27/11 20:00
|
Joined: Dec 2008
Posts: 1,660 North America
Redeemer
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,660
North America
|
In C-Script, "pos" was a term used to reference the position vector of an entity. It is no longer valid in Lite-C, but you can get the same results by writing: Note that "temp" is no longer a predefined variable in Lite-C. You must define it yourself in your own script, and it cannot be used for multiple purposes. If you need to use the "temp" variable as a vector, declare it as one like this: or if you need to use it as a float, declare it like this: But as with any variable, temp cannot be redefined multiple times throughout a script.
|
|
|
Re: Strategy game snippet
[Re: Minamato]
#386078
10/27/11 20:19
10/27/11 20:19
|
Joined: Feb 2009
Posts: 80 STRING* location = "Germany";
Minamato
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2009
Posts: 80
STRING* location = "Germany";
|
the thing with "temp" to be predefined by myself I knew before, but thanks reminding me =) but there is still some work to do ![grin grin](/ubb7/images/graemlins/default_dark/grin.gif)
trace_mode = IGNORE_ME | IGNORE_SPRITES | IGNORE_MODELS | USE_BOX;
my.z -= trace(my.x, temp); // place the unit on the ground (it has been spawned in the air)
my.target_x = 100000;
"Error in line 143: 'trace' undeclared identifier" I know that "trace" has to be replaced with "c_trace", but I am a little bit confused with the statement "my.z -= trac(my.x, temp)". How do I have to rewrite it? I hope I do not sound too stupid ![grin grin](/ubb7/images/graemlins/default_dark/grin.gif)
|
|
|
Re: Strategy game snippet
[Re: Minamato]
#386113
10/28/11 20:22
10/28/11 20:22
|
Joined: Mar 2011
Posts: 3,150 Budapest
sivan
Expert
|
Expert
Joined: Mar 2011
Posts: 3,150
Budapest
|
check c_trace in manual, and AUM 101 or 100 dealt with c_trace a lot... but anyway, it is the LiteC version, if temp is a VECTOR (if var, use 3 vars: vector(tempx,tempy,tempz) or something like this... ) :
my.z -= trace(my.x, temp , IGNORE_ME | IGNORE_SPRITES | IGNORE_MODELS | USE_BOX);
|
|
|
|