It is currently Mon Dec 18, 2017 1:20 am

All times are UTC + 9:30 hours




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Modding tutorials
PostPosted: Sun Apr 05, 2009 6:45 pm 
Offline
User avatar

Joined: Tue May 08, 2007 6:19 am
Posts: 1363
In this topic we discuss how to mod the CW1 engine to make it do things we want. You can ask me questions about the inner workings of CW1. I don't know everything but I will try to answer to the best of my knowledge.

Kiwi asked me how to make landers capture stuff. So this is how.

In ContextMenu.java, find the part that says

Code:
//CAPTURE & LAUNCH
//is the unit an infantry type?
if(u.getUType()==0 || u.getUType()==1) {

This is the beginning of the code that determines if the "capture" command will appear in the context menu.

10 is the type index for lander. (0 and 1 are infantry and mech)

So, change the last line to

Code:
if(u.getUType()==0 || u.getUType()==1 || u.getUType()==10 ) {

We're not done yet. We have to locate the code where the actual capturing is done.

This is found in Property.java.

There is a method called capture. Inside it we find:

Code:
//is the capturing unit the right kind? (Infantry/Mech)
if(u.getUType()==0||u.getUType()==1) {

I guess this redundancy is for security. We'll do the same thing as before:

Code:
if(u.getUType()==0 || u.getUType()==1 || u.getUType()==10 ) {

Now, the lander should be able to capture. (if I haven't forgotten anything crucial)

IF we want to change the unit's capture rate like I did in Ad Hoc Commander, we need another change.

Just below the code we just tampered with there should be a line that says

Code:
//reduce cp by the unit's HP
cp -= u.getDisplayHP()*u.getArmy().getCO().getCaptureMultiplier()/100;

Change this to

Code:
//reduce cp by the unit's HP
int unithp = u.getDisplayHP();
               
if (u.getUType()==10) unithp/=2;
               
cp -= unithp*u.getArmy().getCO().getCaptureMultiplier()/100;

Now the code halves the capture rate if the unit's type is lander. This is probably not good code but it works.


Top
 Profile  
 
 Post subject: Re: Modding tutorials
PostPosted: Mon Apr 06, 2009 8:19 am 
Offline

Joined: Thu Aug 30, 2007 2:32 pm
Posts: 1575
thanks verily
so you wanna work on the AI?

yeah me neither
We all know you got mad art skills, but do you know how the engine itself handles graphics?
like that shoal bug, if you wanna talk eyesores, that's an eyesore.


Top
 Profile  
 
 Post subject: Re: Modding tutorials
PostPosted: Tue Apr 07, 2009 1:37 am 
Offline
User avatar

Joined: Tue May 08, 2007 6:19 am
Posts: 1363
The "shoal bug" is a misplaced tile in the terrain sheet nothing more.

BTW the version name, which is used for version identification by the server, is a string in options.java... This is kind of a small thing but I think you would want to prevent people from joining to crap wars games with the wrong version and messing things up.


Top
 Profile  
 
 Post subject: Re: Modding tutorials
PostPosted: Tue Apr 07, 2009 5:26 am 
Offline

Joined: Sat Aug 02, 2008 12:14 pm
Posts: 110
Location: Montreal, Quebec, Canada
Ever heard of steel horizons? Well landers could capture ports at 5 cap points a day (The idea is that landers drop troops in etc.) Mebbe do the same thing with landers but to prevent abuse it has to have troops in it?


Top
 Profile  
 
 Post subject: Re: Modding tutorials
PostPosted: Tue Apr 07, 2009 6:05 am 
Offline
User avatar

Joined: Tue May 08, 2007 6:19 am
Posts: 1363
How would you abuse that anyway? Requiring a lander to carry troops to be able to capture is just unneededly complicated.


Top
 Profile  
 
 Post subject: Re: Modding tutorials
PostPosted: Fri Apr 10, 2009 12:03 am 
Offline
User avatar

Joined: Thu Sep 07, 2006 3:04 pm
Posts: 875
The WWN guys want a hex-based grid.

Before the graphics and all that, can the engine even handle it, or would it require entirely new code?

_________________
AWBW; BHHQ; WC; WWN


Top
 Profile  
 
 Post subject: Re: Modding tutorials
PostPosted: Fri Apr 10, 2009 1:56 am 
Offline
User avatar

Joined: Tue May 08, 2007 6:19 am
Posts: 1363
Yes, it would require major rewriting of the code, as the CW engine was never designed with hex-based maps in mind. If you wanted a hex-based AW it would probably be easier to mod Wesnoth to have AW units and rules than add hexes to CW.


Top
 Profile  
 
 Post subject: Re: Modding tutorials
PostPosted: Tue May 05, 2009 6:51 am 
Offline
User avatar

Joined: Thu Sep 07, 2006 3:04 pm
Posts: 875
Do you happen to know which file has the code that administers black boat repairs?

I wanted to try buffing it to 2.

_________________
AWBW; BHHQ; WC; WWN


Top
 Profile  
 
 Post subject: Re: Modding tutorials
PostPosted: Wed May 06, 2009 1:28 am 
Offline
User avatar

Joined: Tue May 08, 2007 6:19 am
Posts: 1363
I'm pretty sure it's somewhere in BattleScreen.java but I can't be arsed to check. Just search for "repair" and you should find it there.


Top
 Profile  
 
 Post subject: Re: Modding tutorials
PostPosted: Sat May 23, 2009 1:57 am 
Offline

Joined: Thu Aug 30, 2007 2:32 pm
Posts: 1575
ok so is the shoal misplacement fixed just by un-misplacing it or what?
when I got bored enough to go in there and try switching the south and west shoals, I got THIS

I call it London Bridges After Snowstorm


Top
 Profile  
 
 Post subject: Re: Modding tutorials
PostPosted: Sat May 23, 2009 2:07 am 
Offline
User avatar

Joined: Tue May 08, 2007 6:19 am
Posts: 1363
Whatever program you used doesn't support transparent gifs or you just forgot to check the setting while saving, which caused the transparent pixels to be replaced, causing there to be a white rectangle on top of every tile obscuring whatever lies behind.


Top
 Profile  
 
 Post subject: Re: Modding tutorials
PostPosted: Tue Jun 02, 2009 5:45 am 
Offline
User avatar

Joined: Fri Feb 22, 2008 2:31 am
Posts: 14
putting this image in [CW folder]/images/terrain/ (overwriting old terrain_CW.gif file) will fix the shoal glitch and add graphic for sea pipes.

Result:
Image


Top
 Profile  
 
 Post subject: Re: Modding tutorials
PostPosted: Tue Jun 02, 2009 6:10 am 
Offline

Joined: Thu Aug 30, 2007 2:32 pm
Posts: 1575
whoa all this time we've had sea pipes? I will have to EXPERIMENT

thanks man


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC + 9:30 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Blue Moon by Trent © 2007
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group