VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 123[4] ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 20:21:07 08/15/05 Mon
Author: SomeNick
Subject: Adding units to the game
In reply to: SomeNick 's message, "Re: how to add new units to barracks?" on 20:07:47 08/15/05 Mon

To add a unit to the game you need to do a series of things. Suppose you want to add an unit for the terrans/humans:

1) You would have to edit the \scripts\human\units.lua file to contain the new unit. Follow the pattern of the existing ones and you will know your way aroudn soon enough. Make sure that the first argument in the DefineUnitType instruction is unique, as this is how Stratagus tells the units internally.

2) You need to edit the \scripts\wc2.lua file to add the unit you just created in the units.lua Suppose you called the unit unit-h-sabertroop, you need to add this after the last unit- you see, so Stratagus can internally recognize this new unit as valid.

3) Now you need to add a button to a building so this unit can be built. For this, look into the \scripts\human\buttons.lua file and add the button under the building you want this unit to be created at.

For example, this is what adds the button so Soldiers can be built:

DefineButton( { Pos = 1, Level = 0, Icon = "icon-footman",
Action = "train-unit", Value = "unit-h-soldier",
Key = "s", Hint = "TRAIN ~!SOLDIER",
ForUnit = {"unit-h-barracks"} } )

You would probably have to add your new button at pos 3 or something so it does not overlap an existing one.


4) Still, you have to yet modify another file, the /scripts/human/upgrade.lua file, and insert a DefineAllow instruction so that the engine knows that the player can build this type of unit from a building, that in fact is for general use.

For example, the soldier is allowed via this code:
DefineAllow("unit-h-soldier", "AAAAAAAAAAAAAAAA")

Add a similar line for your unit and all should be ok.

Additionally, you may also edit the /scripts/editor.lua so the unit can also be placed from the editor.

This can be a bit tricky in the beginning, and need some patience, but this is just about all you actually need to do to add a new unit to the game. If you experience some trouble and can't figure out, let me know in this forum.

Just one thing: Add new units, but please do not override or delete existing ones (this way the game remains cool). Well, you can, but I don't know if Astroseries players will appreciate it :-| (assuming that you are making an Astroseries expansion, that is).

Good luck, and please let us know of your progress! :-)

-SomeNick (Alvaro Perez)


>
> I am not an expert at adding units, but I actually
>did add units. Astroseries actually has more units
>than Wargus, so necesarily I had to add new ones. I
>will be back in a bit with extra information on how to
>add units.
>
>-SomeNick
>
>>I'm not sure, it probably has to do something with the
>>rules.ini file or whatever kacamazi file it uses to
>>control AI. I've done some unit editing with Red Alert
>>and I have heared people complaining about problems
>>with units. Mabye each unit has its own limit, like
>>say you build a particular unit once, then it dies
>>"like you said." and never being able to build it
>>again. Some older games have this style. Example:
>>Unit-foxmcloud\buildlimit=1000
>>this means that u can build this unit a thousand times
>>and after that, it completely despences (leaves) the
>>game never to be built again unless you put the unit
>>manually back into the game. I don't really know, but
>>this is just a wild guess so its worth a try. I doubt
>>SomeNick knows how to make units, all he did was
>>modify the units in the Wargus game.
>>
>>Soldier>tek Sniper>Saber Trooper>Shocker
>>Whats the Nagoran layout?
>>
>>>im gonna add a whole lot of units, but i dont know
>how
>>>to make it so that the barracks can build them. I
>>>already have lots of them ready, but i have to
>>>manually put them into the game and they can only be
>>>used 1 before they die. How do i add units to the
>>>barracks?
>>>
>>>Soldier>tek Sniper>Saber Trooper>Shocker

[ Next Thread | Previous Thread | Next Message | Previous Message ]


Replies:


[ Contact Forum Admin ]


Forum timezone: GMT-5
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.