Attaching weapon model(s) to parent unit
Moderator: Moderators
Attaching weapon model(s) to parent unit
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?
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.
(imagine this was in LUA :P)
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);
}
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.