Programming three team CTF


#21

I’m stumped on what to do to fix this, this involves ai_cmd.c. I’m adding functions to the bot AI so that way it knows what to do while on the new green team.
I get this in Cygwin because of it:


Here’s what Notepad++ gives me:

Mind helping me out here @KuehnhammerTobias/@zturtleman? I don’t mean to be driving your patience through the roof, @KuehnhammerTobias, but I really do need your help at this point as this is the only thing keeping the first beta of my new mod from compiling.


#22

The output says you missed a } before the else if. at line 1744. This doesn’t mean you really missed the bracket at 1744! Could be somewhere above that line…
Nobody can say you, where you’ve missed the bracket, …
Well, this is why I said it 100 times, it st hard to help you this way, or by posting screenshots of your code. Sorry, I can’t help you with screenshots!
Good luck!


#23

I figured out where it was, & fixed it. Thanks for the help however @KuehnhammerTobias!


#24

How do you suppose you give a function a new member? In this case “cgMedia_t”. The compilation currently errors because it doesn’t have “greenQuadShader”. EDIT: I need to use grep -ri more often… found it.


#25

This one’s a bit more puzzling… I have the } character in there already but it doesn’t wanna for some reason…
Here’s what Cygwin says:


Notepad++ gives me this however:

Any ideas? Could someone help please? Any ideas, @KuehnhammerTobias?


#26

GitHub source for 3wctf is @: https://github.com/coltongit/3wctf if you’re interested.


#27

Line 1717: https://github.com/coltongit/3wctf/blob/406ae2be9d884359398804dab57487af96784887/code/game/ai_cmd.c#L1717 has an opening brace, but no closing brace. Hmm, I think this won’t work, though, didn’t test the rest of your code in detail yet.


#28

You’re invited to help fix it for me. GitHub’s surely the way to go, isn’t it? Just needs remote tracking & that’s it. I had forgot to modify bg_misc.c to account for the new team (and to try to put back in the original CTF sounds from pak0.pk3). I’ll send it to the page shortly.


#29

No Sir!, I have enough work (and problems) with my own mint-arena fork(s)! Anyways, I hope you’ll succeed!
Nice to see you finally started to work on your 3 Team CTF mod! :thumbsup:


#30

I’ve been working on it for a while now… if any of you have some spare time, I’ll most likely see if I can get it working for all of you, & working good so that way I can help bugtest…


#31

In my sparse sparetime I do some coding, or I play mint-arena. In my sparetime from ‘sparetime coding’, I go fishing or riding my bicyle…
It’s your work, we will see if we can help you. It doesn’t really make sense to bugtest your work for us!


#32

We’ll see when that happens… Oh well, that means we could all bugtest together then.


#33

…sounds somehow weird to me :laughing:


#34

I can’t blame you one bit either :laughing:


#35

Also it seems I try to fix it but it just gets worse… I replaced the ai_cmd.c & I’ll be uploading the bg_misc.c shortly… EDIT: Welp, it’s uploaded.


#36

Uh, I had a look at your current work…,sorry to say, but I think you have some fundamental errors in your coding style. Some operations aren’t possible (allowed) in C, e.g.:

if (x) {
do something
}else{
do something else
}else{
do something else
}

isn’t possible. You already have an ‘else’!
see: https://github.com/coltongit/3wctf/blob/master/code/game/g_team.c#L1652

Also, have a look at: https://github.com/coltongit/3wctf/blob/master/code/game/g_team.c#L186
This is wrong!
eventParm = ( team == TEAM_RED ) ? GTS_REDTEAM_TOOK_LEAD : GTS_BLUETEAM_TOOK_LEAD
Reads as "eventParm = if team is red than GTS_REDTEAM_TOOK_LEAD else GTS_BLUETEAM_TOOK_LEAD
In other words: = ? something : _something_ reads as if/else
So eventParm = ( team == TEAM_RED ) ? GTS_REDTEAM_TOOK_LEAD : GTS_BLUETEAM_TOOK_LEAD : GTS_GREENTEAM_TOOK_LEAD;
doesn’t work.

You can’t simply copy/paste some code here and there. Simply expand every line with ‘green’ where ‘red/blue’ already is doesn’t work!

You don’t need to deal with ai_cmd for now, it will never work, because you have no ‘green’ goal yet (LTG_GETFLAG)…

Hmm, I don’t want to discourage you but I think you should learn some fundamentals about C programming first!
e.g.: http://www.cprogramming.com/tutorial/c/lesson1.html
or: http://www.tutorialspoint.com/ansi_c/c_introduction.htm


#37

I’ll upload a replacement to that that should fix that error, @KuehnhammerTobias. Thanks for reminding me.


#38

Also, I would like to have the white team display the default player skins/models by having the game parse the %skin_default.skin files for them, except in special cases where the player skin for that player must be used, thus %skin_playername.skin inside whatever player model they are a skin of would be used for the team skin instead. For example, Daemia uses %skin_daemia.skin. Any idea on how I could do that, @KuehnhammerTobias/@zturtleman?


#39

@KuehnhammerTobias, I fixed up g_team.c for ya - sorry it wasn’t shortly. Real life got in the way…


#40
	eventParm = ( otherTeam == TEAM_RED ) ? GTS_REDTEAM_TOOK_LEAD; 
	eventParm = ( otherTeam == TEAM_BLUE ) ? GTS_BLUETEAM_TOOK_LEAD; 
	eventParm = ( otherTeam == TEAM_GREEN ) ? GTS_GREENTEAM_TOOK_LEAD;

???

Seems a bit like ‘lottery’ programming. Rearange code until it works, eh! :unamused: