Spring.SetUnitWeaponState not changing range

Spring.SetUnitWeaponState not changing range

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Spring.SetUnitWeaponState not changing range

Post by CarRepairer »

I want to reduce the weapon range of a unit with a single weapon.

Code: Select all

echo('set range', wrange)
Spring.SetUnitWeaponState(unitID, 0, {range = wrange})
echo ( 'range is ', Spring.GetUnitWeaponState(unitID, 0, 'range') ) 
The echo shows that the number updated. However the weapon range definitely didn't change.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Spring.SetUnitWeaponState not changing range

Post by CarRepairer »

**
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Spring.SetUnitWeaponState not changing range

Post by FLOZi »

User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Spring.SetUnitWeaponState not changing range

Post by jK »

incorrect weaponnum?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Spring.SetUnitWeaponState not changing range

Post by FLOZi »

jK wrote:incorrect weaponnum?
I was reasonably sure that weapons start at 0 myself but, I may well be mistaken.

(S44 ammo gadget seems to comply, but it's not exactly the most reliable heap of junk in the galaxy :lol: )
Last edited by FLOZi on 01 Jan 2011, 05:16, edited 1 time in total.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Spring.SetUnitWeaponState not changing range

Post by jK »

still it can have NULLWEAPONs etc.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Spring.SetUnitWeaponState not changing range

Post by CarRepairer »

CarRepairer wrote:single weapon
And I used 0 as you can see. And for sanity's sake I tried changing both 0's to 1's.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Spring.SetUnitWeaponState not changing range

Post by knorke »

had the same problem with weapon reload time.
http://springrts.com/wiki/The_Talking_Changelog wrote: StateTable is a table containing one or more of reloadstate, reloadtime (this time in seconds),
accuracy, sprayangle, range, projectilespeed.
but actually had to use reloadTime to get it working (captial T)
Range did not work though so yeah :roll:

0 seems to be correct for a unit with only one weapon.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Spring.SetUnitWeaponState not changing range

Post by CarRepairer »

I think this was fixed. It seems to work now. Maybe.
Post Reply

Return to “Lua Scripts”