Page 1 of 2

sniper!

Posted: Thu Aug 05, 2010 2:44 am
by pomakli
That's the first one, I want to add!

There is something missing in a Normandy campaign without a sniper-scenario !

:twisted:

We have the infantry units as a 3D game object and the squads.csv file!

Ican create a new ID with all the needed values in squads.csv file!

How to reduce the 3D game object to only one?

and how to create a new script (BSF.!) file?

Thanks in advance!

Posted: Thu Aug 05, 2010 3:27 am
by pipfromslitherine
Getting a single man unit is as simple as reducing the men in the unit to 1.

Adding a new command is explained in the modding documentation.

Cheers

Pip

Posted: Fri Aug 06, 2010 3:41 am
by jomni
There's already a sniper skill / command stated in the manual that is gained by infantry units at higher ranks.

on his way!

Posted: Fri Aug 06, 2010 4:28 am
by pomakli
jomni wrote:There's already a sniper skill / command stated in the manual that is gained by infantry units at higher ranks.
You are right!

But that's a skill for an infantry unit, which you can choose to act like a sniper if you want to give an order to this skilled unit!

There is no sniper unit (one-man show!), which can act from the start of the scenario with this skill!

But there will be one!

:twisted:

unit added in the editor, but...

Posted: Mon Aug 16, 2010 2:54 pm
by pomakli
OK!

I added a sniper ID to the squads.csv.

to the

C:\Program Files\Slitherine\Battlefield Academy\Data\Text

Text 1

IDS_UNITNAME100,"US Sniper",

and

IDS_UNITINFO100,"US Sniper",ONE SHOT, ONE KILL!

to units folder

US_sniper_0.4sf and us_sniper.txt

to the

C:\Documents and Settings\User\Belgelerim\My Games\BBCBA\CAMPAIGNS\campaignsofpom\Data\UI\Textures\Icons

US_sniper.dds and slot.dds.


I can add a sniper unit in the editor, but the name on the list always US_infantry, if I change it; error msg. appears!

And a sniper unit behaves in the game like a infantry unit! :?

sniper.bsf!

Posted: Mon Aug 16, 2010 2:57 pm
by pomakli
I eve changed the

sniper.bsf values:

"if ( ( GetUnitStatus ( me ) == 2 ) && ( GetAttrib (me, "Elite_Sniper") == 1) && ( GetUnitSide (me) != GetUnitSide(unit) ) )
{
// only allow if it is infantry/mg/mortar
if ( GetAttrib(me, "Blocking") == 0 )
{
// instead of hiding, only disable button if it is of the correct armour type & enemy
ret = -1 ;"

(me)==0 and (me,"Elite_Sniper"==0) so that the unit will be from the beginning on sniper and behaves like sniper!

I thought!

:cry:

Posted: Mon Aug 16, 2010 3:18 pm
by Merr
Pomakli,

I'm not a programmer but I have an idea ....

1. create a new Bonus called SNIPER using a modified DrillSgt code (add a Core/Bonus folder in your campaign folder)... instead of increasing the xp by 1, it will increase by 2, thus creating an elite unit with the sniper ability.
2. Ensure that you define a condition that only allows your new sniper unit to be selected.

Now, at the begining of turn 1, the player can use the SNIPER bonus to assign sniper's !!!

I can't think of any other way to do it since every unit begins the scenario as an FNG (Friggin' New Guy) with 0 xp.

Rob

Thanks!

Posted: Mon Aug 16, 2010 3:23 pm
by pomakli
Merr wrote:1. create a new Bonus called SNIPER using a modified DrillSgt code (add a Core/Bonus folder in your campaign folder)... instead of increasing the xp by 1, it will increase by 2, thus creating an elite unit with the sniper ability.
Thanks for the suggestion!

I'll test it!

Follow me!

:wink:

sorry, but..

Posted: Mon Aug 16, 2010 3:50 pm
by pomakli
Merr wrote:create a new Bonus called SNIPER using a modified DrillSgt code (add a Core/Bonus folder in your campaign folder)... instead of increasing the xp by 1, it will increase by 2, thus creating an elite unit with the sniper ability.
Sorry but it doesn't work!

I think, that I am making somewhere a mistake!

Added a bonus, by coping and chanching the name of the "srgt. drill" bonus; in it exp gain by the first time not 1, 2!

Added also to text 2 file, 3 times IDS text for sniper!

But no bonus!

:cry:

Posted: Mon Aug 16, 2010 4:01 pm
by Merr
Great!

Another idea ... If you get my first idea to work then you probably want to add lines of code to the AI file so it can create Sniper units.

Perhaps creating a "FUNCTION AI_CreateSniper" calling the SNIPER card bonus under the same conditions setup for the player.

I hope you'll post your work when you're done because I have idea's about Command units using the same technique .... create Command Bonus, assign command bonus, define Command Ability (same as load/unload but will increase a valid unit's morale by a random amount within a certain distance costing AP).

Rob

Re: sorry, but..

Posted: Mon Aug 16, 2010 4:03 pm
by Merr
pomakli wrote:
Merr wrote:create a new Bonus called SNIPER using a modified DrillSgt code (add a Core/Bonus folder in your campaign folder)... instead of increasing the xp by 1, it will increase by 2, thus creating an elite unit with the sniper ability.
Sorry but it doesn't work!

I think, that I am making somewhere a mistake!

Added a bonus, by coping and chanching the name of the "srgt. drill" bonus; in it exp gain by the first time not 1, 2!

Added also to text 2 file, 3 times IDS text for sniper!

But no bonus!

:cry:
Did you add a new card folder? Core/Cards (cards.txt) and define the new SNIPER bonus?

Re: sorry, but..

Posted: Mon Aug 16, 2010 4:58 pm
by pomakli
Merr wrote:Did you add a new card folder? Core/Cards (cards.txt) and define the new SNIPER bonus?
In Cards folder it was needed only to write

"SniperDelay 2"

and for defining the new SNIPER bonus, in Core/Bonus folder copied the "drillsrgt.bsf" file and renamed like written above msg!

:?

Posted: Mon Aug 16, 2010 8:07 pm
by Merr
Pomakli,

Ok, I was able to create a basic SNIPER bonus card but with no restrictions ... ie any unit can be increased to Elite status.

Follow these steps below ... (I'm starting fresh or new) ... note, I don't want to use SNIPER.bsf because this file already exists in battles/scripts.

1. Create a new folder called Bonus ... Documents\My Games\BBCBA\CAMPAIGNS\your_campaign\Bonus
2. Copy/paste the drillsgt.bsf into the Bonus folder and rename it ... eg SniperMan.bsf
3. Open the SniperMan.bsf file and follow these steps ;
a. Change all _DRILL to read _SNIPERMAN
b. Change all "drillsgt" to read "sniperman" ... exception, DO NOT rename the .tga entries because we want (for now) to use the drillsgt tga's. Later you can create a sniperman.tga and go back and change this.
c. change the code that reads "if( GetUnitStatus(unit) == 1)" to read "if( GetUnitStatus(unit) == 2)"
d. Save the sniperman.bsf file

4. Create a new folder called Cards ... Documents\My Games\BBCBA\CAMPAIGNS\your_campaign\Cards
5. Copy/paste the cards.txt file from the main folder Campaigns\0tutorial\cards folder
6. Add this line .... SniperManDelay 2
8. Save the new cards.txt file

9. Open your text1.txt file located in your campaign folder
10. Add these lines ;

IDS_BONUS_SNIPERMAN, "Sniper",
IDS_TT_BON_SNIPERMAN, "Create Sniper",

11. Save the text1.txt file

12. Start the Editor and load your scenario
13. Select the ADD SIDE BONUSES .... you should see the new SniperMan.bsf
14. Select the SniperMan.bsf to add it, then save scenario

That's it!!

Of course, you need to add your special code so only your new sniper unit can be selected instead of everyone!

Hope this helps,
Rob

Yes!

Posted: Tue Aug 17, 2010 5:13 am
by pomakli
Merr wrote:,9. Open your text1.txt file located in your campaign folder

11.Of course, you need to add your special code so only your new sniper unit can be selected instead of everyone!

Hope this helps,
Rob
It works!

Thank you VERY MUCH, Merr!

I did every step the way you written, only for (9), I opened text2.txt file, because text1.file having another text!

What do you mean by 11?

2 problems!?

Posted: Tue Aug 17, 2010 10:37 am
by pomakli
OK; I created even the sniper unit (from the infantry unit, with 1-man count-value and copied a bulge scenario with a sniper in the MP!

It's playable, but we have 2 problems!

1- by defensive fire he acts like infantry and fires more salvos; I think, because his "asset filename" is "german infantry"! How and in which folder should I create a sniper?

2-Twice I wanted to move it, there was a message:

"We lost a track!"

:shock:

Not a joke!

Posted: Thu Aug 19, 2010 1:45 am
by Merr
Pomakli,

Sorry not to get back to you sooner but I was spending time figuring out how it all works.

Good news!! I know how to add a new unit with a new special ability!

If you can wait, I'm going to write a tutorial that includes a Sharpshooter Scenario soon explaining "how-to".

In the meantime I'll give you some hints because I know you want to figure this out on your own ....

1. Read page 3 in the STUB Engine Documentaion .... line 3 (changed 3bulge to read my_campaign) ;
Copy the Data\Battle\Scripts directory into e.g. My Documents\My
Games\BBCBA\Campaigns\my_campaign\Data\Battle\Scripts.
2. Copy/Paste the SNIPER.BSF file (from my_campaign\data\battle\scripts)onto itself (same folder), don't worry it won't overwrite and will be called SNIPER - COPY.BSF.

3. Change SNIPER - COPY.BSF to your unit name ... eg US_Sniper.bsf

4. Open US_Sniper.bsf and add this code to the top ;

Code: Select all

include "$default.bsf"
This is REQUIRED otherwise you will get error's that relate to the code in US_Sniper not being defined.

5. With US_Sniper.bsf still open, rename all the FUNCTION to something unique. Ensure that you also change any code inside the function that calls for any of the original function names to the new names.

6. Change code ...

Code: Select all

( GetUnitStatus ( me ) == 2 )

to read ...

Code: Select all

( GetUnitStatus ( me ) >= 0 )

This will ensure that when your sniper levels-up he will keep the sniper shot skill.

7. Save the US_Sniper.bsf !!!

Now, this should work, and you now start the scenario with a Level 0 Sniper !!! No need to use the bonus card anymore.

Hope this helps,

Rob

Posted: Thu Aug 19, 2010 2:17 am
by pipfromslitherine
Exactly! You can set up specific abilities in that way, while still keeping all the default behaviours.

Cheers

Pip

Posted: Thu Aug 19, 2010 2:25 am
by insidius
Hm, this looks good. Good job guys.

back again!

Posted: Sun Aug 22, 2010 6:18 am
by pomakli
Hello!
Merr wrote:

Code: Select all

include "$default.bsf"
This is REQUIRED otherwise you will get error's that relate to the code in US_Sniper not being defined.

5. With US_Sniper.bsf still open, rename all the FUNCTION to something unique. Ensure that you also change any code inside the function that calls for any of the original function names to the new names.
I am not sure, if I added the code correctly!

Is thist the right way? I mean with "code" and so on!

Code: Select all

include "$default.bsf"
and what means rename all the FUNCTION to something unique?

I chanced all the text after EACH FUNCTION to "FUNCTION GermanSniperAttack"??

But it doesn't wortk!

You should use the bonus card and it works like a truck if you want to move the sniper!!

:cry:

Re: back again!

Posted: Sun Aug 22, 2010 8:54 am
by Merr
pomakli wrote: I am not sure, if I added the code correctly!

Is thist the right way? I mean with "code" and so on!

Code: Select all

include "$default.bsf"
Yes.
I chanced all the text after EACH FUNCTION to "FUNCTION GermanSniperAttack"??
But it doesn't wortk!
Cannot have all functions the same name, each function must be named differently. Also, change any code inside the function that calls for the old name, ie ... if the old name was FUNCTION SniperAttack, new name FUNCTION GermanSniperAttack, check for old code inside the function with the name FUNCTION SniperAttack and change this to new name.

I will provide post my sniper code in a few hours as an example ...