Attaching weapon model(s) to parent unit

Attaching weapon model(s) to parent unit

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Attaching weapon model(s) to parent unit

Post by MadRat »

If someone wants to use a mounted weapon, like a missile on the rail, its pretty straight forward how to display the weapon model. My question is, how do you get the model to reappear only when its reached the set reload time? I know I can set this value up manually in a cob. I would rather have the cob automatically figure out the timing so that when balancing weapons and reseting the time to reload on the weapon it does this automatically, too, so I don't have to recompile the cob files each time. Is there a simple way to do this?
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Yeah, by using Cob->Lua, Lua->Cob.

I'd call a LUA function from within the script in the Create() function. The LUA function then calls a COB function for n times.

Code: Select all

for (n=0; n < unit->weapons.size(); n++) {
	COB_GetReloadTimes(n, unit->weapons[n]->reload);
}
(imagine this was in LUA :P)
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post by MadRat »

Thanks for the reply. I'll have to read up more on lua. The language looks fairly complicated for a nonprogrammer.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post by yuritch »

Actually, there is a SetMaxReloadTime(time) call in COB (often used in OTA Cavedog scripts) that sets a variable to highest reload time of all the weapons the unit has. So no need to use LUA for something the engine already does. This was discussed way back here.
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post by MadRat »

Awww, much nicer solution for me at this moment. But I still need to explore LUA.
Post Reply

Return to “Game Development”