Page 25 of 59

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

Posted: 14 Jan 2008, 15:12
by KDR_11k
I mean, is it an empty piece, a single vertex, two vertices or more? The piece might contain vertices that describe a zero vector.

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

Posted: 14 Jan 2008, 19:53
by Evil4Zerggin
Ah, that must be it then. After moving the fire point to a different piece it seemed to work as desired (except for firing from a different place that I wanted to, but that's to be expected). Thanks!

Now I have to figure out how to add fire pieces that do work... unfortunately I don't know anything about modeling.

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

Posted: 17 Jan 2008, 03:13
by bobthedinosaur
okay looking for away other than on/off (since on off is toggling the unit from movable to deployed) to choose between 2 weapons, only one or the other, besides fancy lua, got any idea?

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

Posted: 17 Jan 2008, 04:23
by Pressure Line
manual toggle? or an automatic system? ie tank has only a light laser gun while moving, when stopped it allows its big cannon to fire. that is doable in cob

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

Posted: 17 Jan 2008, 04:34
by bobthedinosaur
no it will be stopped when 'on' is engaged because that deploys it to attack, versus non attackable via moving. so the switch can not use the on/off or moving true to differentiate between the 2 weapon types..

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

Posted: 17 Jan 2008, 09:01
by KDR_11k
Within a gadget:

Code: Select all

CMD_WEAPON = 33319
desc = {
	name="Change Weapon", --button label
	type=CMDTYPE.ICON, --a button that activates when clicked on
	id=CMD_WEAPON,
	action="changeweapon"
}

--For new units
function gadget:UnitCreated(u,ud,defs)
	if UnitDefs[ud].customParams.canchangeweapon == "1" then
		Spring.InsertCmdDesc(u, desc) --add the command to the unit's list
	end
end

--Blocks commands that are invalid
function gadget:AllowCommand(u,ud,team,cmd,param,opt)
	if cmd == CMD_WEAPON then
		return UnitDefs[ud].customParams.canchangeweapon == "1" --makes sure CMD_WEAPPON can only be given to units that can change their weapon
	end
	return true
end

--Handles custom commands
function gadget:CommandFallback(u,ud,team,cmd,param,opt)
	if cmd == CMD_WEAPON then
		Spring.CallCOBScript(u, "ChangeWeapon", 0) --calls this COB function
		return true, true
	end
	return false
end
This creates a button that calls the COB function "ChangeWeapon()" when clicked. I'm sure it's possible to make this use a toggle button instead of a simple click button but I have no experience with those.

The button only appears for units with

Code: Select all

[customParams] {
    canChangeWeapon=1;
}
in the fbi.

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

Posted: 18 Jan 2008, 17:37
by Abokasee
Is there a way... to make a beam that fires constantly (like the beamer turret) to keep firing when sweep to another target?

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

Posted: 18 Jan 2008, 18:12
by [Krogoth86]
Try sweepfire=1 ... :wink:

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

Posted: 18 Jan 2008, 19:45
by Argh
The last time I tested, Sweepfire had some issues. Mainly, it seems to change targets without calling AimWeapon() again, so the beam goes in wonky directions. May have been fixed since I last messed with it, though, give it a try.

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

Posted: 19 Jan 2008, 14:20
by Abokasee
Yeah when they try to target something behind another unit, they go a bit mad, but other wise fine (targeterror was turned off)

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

Posted: 21 Jan 2008, 07:52
by Ba-
Wondering about shields... Apparantly some binary or something or other allows shields to block certain weapons.. anyway, I was wondering, a. is it possible to have more than one 'shield' per unit. b. Is it possible to forcibly turn shields on or off via script (and have there be no on/off option in gui - onoffable=0?) c. are shields technically weapons?

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

Posted: 21 Jan 2008, 08:04
by Argh
A. Yes, so far as I know, there are no limits on the number of Shields a Unit may have. Keep in mind they're fairly CPU-intensive, though.

B. Yes. See the Changelog for details. You could either use Activate() or a separate LUA button via the UI to control it.

C. Only in the broadest sense of the word. They don't call aiming conditions, etc.

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

Posted: 21 Jan 2008, 15:15
by KDR_11k
A shield runs AimWeaponX and if that returns true the shield is active. I'm making extensive use of shields in CvC, that might be worth a look.

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

Posted: 21 Jan 2008, 18:34
by Ba-
So i'm guessing shields on pretty much every unit that would be turning on and off would be too CPU-intensive? I know spring can have more than 3 weapons per unit... what is the max amount of weapons per unit tho? I heard somewhere that shields can actually deflect weapons, rather than just absorb them, can they do either? Shields, I'm assuming, are just the effect of blocking/deflecting a weapon, so you'd have to make a part of the model that 'looks' like a shield as well, correct?

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

Posted: 21 Jan 2008, 18:38
by KDR_11k
Shields can have a visible part if you set them to, you can make deflecting shields and destroying shields (i.e. projectiles hit them and explode). I don't think the on/off part will do much to the CPU, having the shields visible could eat FPS in large numbers due to the rendering tho.

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

Posted: 21 Jan 2008, 22:20
by bobthedinosaur
kdr, what does the bos look like using that widget?

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

Posted: 21 Jan 2008, 22:41
by [Krogoth86]
Ba- wrote:what is the max amount of weapons per unit tho?
It's 16 if I'm still right...
Ba- wrote:I heard somewhere that shields can actually deflect weapons, rather than just absorb them, can they do either? Shields, I'm assuming, are just the effect of blocking/deflecting a weapon, so you'd have to make a part of the model that 'looks' like a shield as well, correct?
At the end of this Wiki article you should find everything you want to know:
http://spring.clan-sy.com/wiki/Weapon_V ... scriptions

With that said - yes, you can either do a repulsor shield which reflects projectiles or you make some sort of "hard shield" where everything explodes when touching the shield surface. You also can set it to work like an umbrella (i.e. the shield doesn't affect anything that is inside the shield range or make it affect the whole spherical area it consumes. Well you'll find all the options in that Wiki article...
bobthedinosaur wrote:kdr, what does the bos look like using that widget?
Well you for example could put a variable in the active() function which gets set to 1 and so triggers a while loop you've put in the aiming function which returns a TRUE to activate the shield. The deactivate function then switches the variable to 0 and this way you deactivate your shield...

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

Posted: 21 Jan 2008, 23:16
by KDR_11k
bobthedinosaur wrote:kdr, what does the bos look like using that widget?
You have a ChangeWeapon() function that changes the active weapon.

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

Posted: 22 Jan 2008, 19:25
by bobthedinosaur
sorry i have not yet used the change weapon command, where would it go in the bos in order to receive widget triggers?

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

Posted: 22 Jan 2008, 23:03
by Archangel of Death
You'll just be adding a new function. You can place it in any position (well, not inside another function's block). Spring figures the rest out for you.