Mod Question Repository... Questions come in, answers go out - Page 31

Mod Question Repository... Questions come in, answers go out

Resources to get you going on your new project, or to help you over some emergent problems during your development cycle.

Moderator: Moderators

Locked
User avatar
rcdraco
Posts: 781
Joined: 22 Nov 2006, 02:50

Re: Mod Question Repository... Questions come in, answers go out

Post by rcdraco »

Rattle: send me a message with the cob or help in some way. :P

Krogoth: I've done that in cob/bos in the plot of war with my siege tank, it was on/offable for gun deployment.

Open the one in here:

https://files.bountysource.com/file/dow ... ar.sdd.rar

Extracted it will be a folder called theplotofwar.sdd drop it in mods to try it, etc. It is the "open" mod format, it's a larger file, but it doesn't need to be decompiled to screw with it.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: Mod Question Repository... Questions come in, answers go out

Post by rattle »

Browse through the thread, the code snippets should be all there (I'm too tired to do it now, it's 8 am).

What you need:
  • set/get HEADING
  • a seperate loop which compares the unit's position (your_old_position - current_position) over time in short intervals to see if it moves and how fast it goes
  • get UNIT_XZ(get MY_ID)
You need to run a seperate loop which checks in short intervals (25-50 ms) if the unit moves and how fast it moves, use PRINT to see what the value at maximum speed and your desired can't steer speed (use set MAX_SPEED for overrides etc.).

When your value is, say, at 20% of it's maximum value, save the current heading (get HEADING) if it wasn't stored before, and override HEADING with it. Once it's greater than 20% set your stored heading to -1 (as in unset it) to move it out of the 0-65535 range. I think spring never reports negative values through get HEADING, can be wrong though.

What ever that should be all you need. How do I shot BOS not included...
[Krogoth86]
Posts: 1176
Joined: 23 Aug 2007, 19:46

Re: Mod Question Repository... Questions come in, answers go out

Post by [Krogoth86] »

rcdraco wrote:Krogoth: I've done that in cob/bos in the plot of war with my siege tank, it was on/offable for gun deployment.
Well I'll use that as sort of a last solution if no one can help me with this issue. The disadvantage is that this little on/off button is very inconsiderable in comparison to a nice colored button which shows the unitpic plus an own label - the on/off button probably wouldn't get noticed by many first time players and so I'd like to keep that if possible...

Edit:
I now fixed the wrong orientation when undeploying - you mustn't get the unit heading in the Create() function at once but have to sleep for a short while before doing so... :-)
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Mod Question Repository... Questions come in, answers go out

Post by KDR_11k »

Try Kernel Panic Division Zero, we've got bugs that deploy.
[Krogoth86]
Posts: 1176
Joined: 23 Aug 2007, 19:46

Re: Mod Question Repository... Questions come in, answers go out

Post by [Krogoth86] »

KDR_11k wrote:Try Kernel Panic Division Zero, we've got bugs that deploy.
And which now has bugged behaviour Nr. 3... :mrgreen:
Just have a look at this video to see the bugs being stuck in a non-ending loop until you give a move or stop order which ends it...
http://www.files.to/get/228152/aa2tef6u4s

I now also have to tried to use morphing instead of replacing and for morphing there are no problems with having repeat activated. Unfortunately you cannot define your own label. Deactivating the repeat button isn't possible or is it?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Mod Question Repository... Questions come in, answers go out

Post by KDR_11k »

Use youtube instead of shitty file hosts

That's a COB issue I'd say, the morph anim restarts on each call instead of just continuing. I'll fix it for RC3.

EDIT: fixed with a simple mutex.
GenStryker
Posts: 6
Joined: 17 Mar 2008, 07:35

Re: Mod Question Repository... Questions come in, answers go out

Post by GenStryker »

Eh, is it possible to create a squad-like unit in a Spring mod that looks and behaves like the C&C 3 infantry? Like when it reaches a set amount of health, one of its members die, and etc...
[Krogoth86]
Posts: 1176
Joined: 23 Aug 2007, 19:46

Re: Mod Question Repository... Questions come in, answers go out

Post by [Krogoth86] »

Well sort of this can easily be done via Cob. Just create a unit which consists of all soldiers and check the health that is left. When a specific level is reached you play a dying animation for one of your soldiers and then use the hide command to make him invisible...

Coding this might be a bit long winded though and you won't get an effect as nice as in C&C as for example the dying soldier still will get moved like all others are (i.e. as long as you won't try to do some movement prediction he won't just fall where he stands but gets dragged along with the others while the dying animation is played)...

If you want more you'd have to have a look at LUA scripting capabilities...
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: Mod Question Repository... Questions come in, answers go out

Post by rattle »

No it can't be easily done in BOS without
a) the unit looking retarded when it turns
b) the unit looking retarded on slopes
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Mod Question Repository... Questions come in, answers go out

Post by Argh »

You can do it with LUA, though.
[Krogoth86]
Posts: 1176
Joined: 23 Aug 2007, 19:46

Re: Mod Question Repository... Questions come in, answers go out

Post by [Krogoth86] »

I was trying to make mines passable and wanted to do this via the "c" yardmap and an enforced, static simulation of a lab that is opened. Unfortunately I had no success yet - does Spring have any restrictions here?

I've already tried various approaches but non of them seems to apply the order of turning the yardmap into a passable one. Any ideas on this?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Mod Question Repository... Questions come in, answers go out

Post by KDR_11k »

Factories are passable when they're building something, that's hardcoded though.

Mines are passable if they're kamikaze=1, in SVN yardmap=y works too.
[Krogoth86]
Posts: 1176
Joined: 23 Aug 2007, 19:46

Re: Mod Question Repository... Questions come in, answers go out

Post by [Krogoth86] »

KDR_11k wrote:Factories are passable when they're building something, that's hardcoded though.
Yeah that's what I tried to simulate. Is that possible or is it really available just for factories which build something (i.e. even if you use the very same code the factory uses except for the fact that nothing gets built it won't work)?
KDR_11k wrote:Mines are passable if they're kamikaze=1, in SVN yardmap=y works too.
Ah - k if they automatically get passable in SVN I think there's no need to fuzz around although I'd like to know if it would have worked... :wink:

I also still remember a video which showed gates in Spring and so I thought that they had been done that way (EDIT: Here it is http://video.google.com/videoplay?docid ... 2670759511 although when looking at it I'd guess it's done via morphing and putting y yardmaps in the middle)...

I know of putting the yardmap to "y" but the problem is you can build new mines on top of old ones as "y" means no footprint whatsoever which is something I don't want...
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Mod Question Repository... Questions come in, answers go out

Post by KDR_11k »

There's either blocking (no construction or walking over) or non-blocking (can be built and walked on), you cannot allow walking without allowing construction.
ironized
Posts: 172
Joined: 25 Jun 2007, 06:33

Re: Mod Question Repository... Questions come in, answers go out

Post by ironized »

stationery crane,

would it be opossible to have a crane that could relocate units for like a range of say 1000 ?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Mod Question Repository... Questions come in, answers go out

Post by KDR_11k »

Yes, I'm sure Zwzsg could give you a complete COB solution.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Mod Question Repository... Questions come in, answers go out

Post by lurker »

I'll make a quick gadget to stop building on top of mines. Someone yell at me if I've forgotten and haven't finished in 12 hours.
ironized
Posts: 172
Joined: 25 Jun 2007, 06:33

Re: Mod Question Repository... Questions come in, answers go out

Post by ironized »

i just wanted to know about it interfering with other buildings and such...
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: Mod Question Repository... Questions come in, answers go out

Post by bobthedinosaur »

is there a way to block sharing units with allies so that mods with a strong game play design of build limits for units isnt abused?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Mod Question Repository... Questions come in, answers go out

Post by KDR_11k »

bobthedinosaur wrote:is there a way to block sharing units with allies so that mods with a strong game play design of build limits for units isnt abused?
Yes, one of the earliest functions of LuaRules.
Locked

Return to “Game Development Tutorials & Resources”