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

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
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Post by Pressure Line »

KDR_11k wrote:Not really but you can use Lua to trigger on UnitDamaged and add random extra damage.
iirc you can do that with hitbyweapon() too
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Post by bobthedinosaur »

really how?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

HitByWeaponId(x, z, id, damage)


The value it returns is the % of the damage the weapon should cause.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Yeah but that requires coding all your damage values into the COBs and having the function in every unit script instead of a single gadget that allows quick changes.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Well you could include the function from an external file and write a quick batch which compiles all scripts with cobbler.
hamsate
Posts: 122
Joined: 21 Jun 2007, 00:25

Post by hamsate »

Hello guys, I'm new and just wanted to ask for some help.

So far I've created just one simple unit. No animations, nothing. Let's say I wanted to replace XTA commander's model. How would I do that?

For some background information, I'm pretty sure I've got the unit right. I've made it in Wings3D, UV-mapped it with a tutorial, and went through the UpSpring mess. I have a .s3o file, with the UV pictures in .tga format with alpha channels.

So with that, I went and copied XTA. Went into the directory for FBI files and edited something in the 'External' section. I can't remember what it was, but I changed it to replace the .3do file with my .s3o file.

Now whenever I start Spring, it crashes. I think I still have the info log the crash, and if anyone needs it, just ask. :wink:

Anyways, my main question is what did I do wrong? Can anyone supply me with a good tutorial to follow, or just give me some basic instructions? Thanks for all your guy's help in advance. :wink:
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Spring can crash upon loading up a new model for several reasons:

1. You've borked the reference to the model, or the internal path to the textures in the .S3O are borked.

For example, your model is called UberCoolDroid.

In the unit .FBI, you need to have the following three lines, like this:

Code: Select all

Name=Uber Cool Droid;
UnitName=UberCoolDroid;
ObjectName=UberCoolDroid.s3o;
Name tells Spring what name to display to players via the GUI. That's all that line does. It can be anything.

UnitName tells Spring what COB animation script is being used, and is used for a wide variety of other internal references (COB ties into a bunch of things). If you aren't totally consistent about names throughout your game, then it's going to crash, basically.

ObjectName tells Spring what 3D file to load, and what type it is. However, it's a little more complicated than that. When .S3Os are loaded in Spring, they look for the texture in the \unittextures\ sub-directory. If you haven't saved that texture there, then it will crash. I've tried using sub-directories within \unittextures\, and it doesn't work as of the last time I tested, which is annoying, since any large-scale project can involve dozens and dozens of files.

Lastly, .S3Os require two textures- one for the diffuse / teamcolor map, and one for glow / reflect / 1-bit transparency. They aren't optional. And the file format of the images needs to be TGA, DDS or PNG. Preferably TGA or DDS, for completely reliable results.

2. Or, it may be something completely different. You really haven't given us enough information about the crash to judge- you may think it's the new model, but it may be lots of other crap, too- Spring's very forgiving, but there are plenty of things where if it hits a null value, it'll lock.

For all we know, it's because you've hosed a reference to a CEG, or something like that- there are a number of things like that that can cause a hard crash in 0.75b2. Using XTA's Commander, which I assumed you just ripped out and have started a new game from scratch with, is probably a bit tricky because of these issues. I'd suggest, frankly, to start with my "minimal unit" file from NanoBlobs 0.63, which you can get from unknown-files.net, and working up from there, instead of with a unit from an OTA conversion that, unless they've cleaned up their FBIs lately, is probably still full of OTA crap that doesn't work in Spring, is poorly formatted, etc., etc... better to start from the ground up, reading in the Wiki about what FBI tags do X, Y or Z, than have to work backwards from something in a finished game, frankly- you're going to miss out on a lot if you hack backwards from OTA clones.
User avatar
Abokasee
Posts: 222
Joined: 03 Nov 2006, 21:51

Post by Abokasee »

Is it possible for a weapon (beam in this case) to have a minium range, so that if there target gets close they have switch to something else
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Nope.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Lastly, .S3Os require two textures- one for the diffuse / teamcolor map, and one for glow / reflect / 1-bit transparency. They aren't optional
Texture 2 is entirely optional.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Texture 2 is entirely optional.
It is? Since when? Last time I tested that, it resulted in a crash. Therefore, I just use a default null texture that's teeny-tiny...
hamsate
Posts: 122
Joined: 21 Jun 2007, 00:25

Post by hamsate »

Argh wrote:It is? Since when? Last time I tested that, it resulted in a crash. Therefore, I just use a default null texture that's teeny-tiny...
And how could you make that? Would a blank white picture file work?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Argh wrote:
Texture 2 is entirely optional.
It is? Since when? Last time I tested that, it resulted in a crash. Therefore, I just use a default null texture that's teeny-tiny...
Since forever. (No, really, seen as I was one of the first to make a working s3o using the 3ds plugin)
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Post by bobthedinosaur »

can you change the damagemodifier via script? if so that cold technically achieve random like damage? just have that randomly fluctuate?

also, im trying to make a factory appear as a unit drop point, and i was wondering if i made it time limited, such as to kill the drop point after so long, could i find a way s that the killing of it due to time limit isnt registered as a kill against that play, kind of a dissolve instead? and dont just say "LUA LUA magic", unless it is only possible using lua.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

You can change the actual damage by returning a value different from 100 in HitByWeaponId(z,x,id,damage). You can even react to the weapon id and give different ranges for each weapon.

In SVN there's the COB value 102 now, use get KILL_UNIT(0,0,1) to delete the unit. No idea if it's considered a death though, it's a reclaim (those were counted as deaths in OTA IIRC).
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Post by bobthedinosaur »

kdr, how would that look in a script? ie: eample script.
i understand you can read the damage and id but how would you go about changing the damage received to that unit?

bah good enough, buts is svn huh?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

The return value is the % of the damage that is actually dealt so return 100 means normal damage, return 200 double damage, etc.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Post by bobthedinosaur »

would it look like

damage = damage*2 ? for 2x or would it be a def?

another thing im trying to read up on the unitdef.h, how the heck do you use that with cobs? im so lost... :oops:
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I said return 200, what part of that is so hard to understand?

Unitdef has nothing to do with COBs, it stores the FBI values. Look into COBinstance.cpp.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Post by bobthedinosaur »

but how would it know what to return specifically?
Locked

Return to “Game Development Tutorials & Resources”