Buffs, buffs, buffs!
Moderator: Moderators
- jangoisbaddest
- Lieutenant General

- Posts: 661
- Joined: Mon Feb 27, 2006 12:10 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: All Along The Watchtower
Buffs, buffs, buffs!
I was wondering if there were more parameters to play around with in the emitterordinance category; for example, energy bar regen, max speed, etc. I thought of using a null controllable, then use the LUA to activate the effect via OnCharacterDispenseControllable, but there isn't any way to control which targets would be affected (range, allies, etc) - then again, I don't know all of the LUA functions and Callbacks, either, just those in the document that came with the modtools. If anyone does know codes not used in the assets for emitterordinance, please post them here (if you would be so kind).
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
There might be way to distinguish and execute functions on individual players.
I wish I knew what it was.
But obviously Zerted's holocron SetProperties an individual spawned unit(but it might be the flag that identifies him), and that whole "hero spawn units" thing would obviously have to tell which unit to spawn units around. (It might be the only one of its class spawned though...)
I wish I knew what it was.
But obviously Zerted's holocron SetProperties an individual spawned unit(but it might be the flag that identifies him), and that whole "hero spawn units" thing would obviously have to tell which unit to spawn units around. (It might be the only one of its class spawned though...)
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
What are you trying to do? When someone 'fires' this controllable, you want them to increase speed (or some other stat change)?
All the callbacks are in the scripting system doc and almost all of the lua functions are in some documentation in psych0fred's site (you can also find them searching through all the script files). He also has an ODF parameter list. Some other web site (can never remember the address) also has the list, but his is easier to read.
The SetProperty functions are what you use to mess around with player stats.
All the callbacks are in the scripting system doc and almost all of the lua functions are in some documentation in psych0fred's site (you can also find them searching through all the script files). He also has an ODF parameter list. Some other web site (can never remember the address) also has the list, but his is easier to read.
The SetProperty functions are what you use to mess around with player stats.
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Sorry for thread-jacking(ish), but I want to know is how to use SetProperty on a unit. I've used it on ZE objects before.
SetProperty("WHOANDHOW, "Health", "500")
I suppose there are only certain cases, using events that return the right parameter, or certain get statements.
*EDIT*
Wait a minute. Man...that was the longest lapse in my logic sense ever. Of course you use events and Get statements to return a specific unit instance. Just like you can check if they're human controlled.
*Later EDIT JULY 31st*
No, actually, the players and killers in events just return a number that represents their player. (NOT THEIR UNIT)
SetProperty("WHOANDHOW, "Health", "500")
I suppose there are only certain cases, using events that return the right parameter, or certain get statements.
*EDIT*
Wait a minute. Man...that was the longest lapse in my logic sense ever. Of course you use events and Get statements to return a specific unit instance. Just like you can check if they're human controlled.
*Later EDIT JULY 31st*
No, actually, the players and killers in events just return a number that represents their player. (NOT THEIR UNIT)
Last edited by Ace_Azzameen_5 on Tue Jul 31, 2007 12:12 pm, edited 1 time in total.
- jangoisbaddest
- Lieutenant General

- Posts: 661
- Joined: Mon Feb 27, 2006 12:10 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: All Along The Watchtower
Or drop a powerup. The callback really doesn't matter; I just was curious if we could have more freedom in how a buff can affect units, and if it was possible to use the LUA to do so effectively.[RDH]Zerted wrote:What are you trying to do? When someone 'fires' this controllable, you want them to increase speed (or some other stat change)?
You're right, I should be studying them anyways. Thanks.[RDH]Zerted wrote:All the callbacks are in the scripting system doc and almost all of the lua functions are in some documentation in psych0fred's site (you can also find them searching through all the script files).
I did not know this. Thanks for the tip![RDH]Zerted wrote:He also has an ODF parameter list. Some other web site (can never remember the address) also has the list, but his is easier to read.
I know, I've actually used SetProperty on unit stats successfully. The problem is (in trying to duplicate the buff effect for a unit) that you don't have the kind of control of the effect than you do with using the emitterordinance paramiters (unless I am mistaken, and you would be the one able to tell me). What I mean is, whether or not it affects friends or enemies, the range of the buff, etc.[RDH]Zerted wrote:The SetProperty functions are what you use to mess around with player stats.
Edit: I couldn't find that ODF list on Psych0fred's site. I did find another list on the modding wikki, but I don't believe it's complete - it's missing several parameters that I know by heart.
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
I don't know if you can force powerup drop without the player dying. In order to get the powerup you want, you would need to clear all the other powerup values then set a single, new powerup value. The problem is that if the player doesn't die during the life of the buff, he will still only drop that one powerup. Another problem is that powerup settings are in unit classes, not objects. You would need to use SetClassProperty() which will change the powerups for every unit of that class. Class changes are not reset when a unit dies. If you want to return them to normal, it would need to be done manually.
Any ODF value you can change through SetClassProperty() and many others can be changed through SetProperty() (the scripting system doc has object property lists).
I just checked and the downloadable ODF Parameters file is still there. What modding wiki?
Any ODF value you can change through SetClassProperty() and many others can be changed through SetProperty() (the scripting system doc has object property lists).
I just checked and the downloadable ODF Parameters file is still there. What modding wiki?
- jangoisbaddest
- Lieutenant General

- Posts: 661
- Joined: Mon Feb 27, 2006 12:10 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: All Along The Watchtower
Oh, nono, I meant OnCharacterDispensePowerup. I thought that was pretaining to things like Dispense Health/Ammo weapons, etc. Like I said, the trigger doesn't matter.[RDH]Zerted wrote:I don't know if you can force powerup drop without the player dying. In order to get the powerup you want, you would need to clear all the other powerup values then set a single, new powerup value. The problem is that if the player doesn't die during the life of the buff, he will still only drop that one powerup.
Right, the buff wouldn't be for one specific class, it would target only those in range, and I'm not sure the LUA is able to do that easily (if at all).[RDH]Zerted wrote:Another problem is that powerup settings are in unit classes, not objects. You would need to use SetClassProperty() which will change the powerups for every unit of that class. Class changes are not reset when a unit dies. If you want to return them to normal, it would need to be done manually. Any ODF value you can change through SetClassProperty() and many others can be changed through SetProperty() (the scripting system doc has object property lists).
I dunno, I stumbled upon a modding wiki from a link on these forums; I guess it's obsolete.[RDH]Zerted wrote:I just checked and the downloadable ODF Parameters file is still there. What modding wiki?
-
Hebes24
- Sith Master

- Posts: 2594
- Joined: Sat Jun 03, 2006 5:15 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: In An Epic Space Battle!
- Contact:
- jangoisbaddest
- Lieutenant General

- Posts: 661
- Joined: Mon Feb 27, 2006 12:10 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: All Along The Watchtower
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
Yes, OnCharacterDispensePowerup() is for things like the engineer's health/ammo packs. I thought you meant the other powerups.
I didn't know any of the pages from the Modding Wiki still existed. What link did you use to get there?
There is GetObjectLastHitWeaponClass(), but it would only give you the last unit hit, not all of them.
Example retail usage:
I didn't know any of the pages from the Modding Wiki still existed. What link did you use to get there?
There is GetObjectLastHitWeaponClass(), but it would only give you the last unit hit, not all of them.
Example retail usage:
Code: Select all
elseif GetObjectLastHitWeaponClass(object) == "rep_weap_walk_atte_rear_gun" then- jangoisbaddest
- Lieutenant General

- Posts: 661
- Joined: Mon Feb 27, 2006 12:10 am
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: All Along The Watchtower
Well, if there is some way to get the unit that was hit out of this function, then it should work - all one needs to do is set a looping function up like so:
Perhaps that's not the best way to loop, and if so, I would like to know what is; but my point is, as long as you can "get" the unit that was hit, it should work (and if so, how is this accomplished?).
Code: Select all
energybufftime = CreateTimer("energybufftime")
SetTimerValue("energybufftime", .01)
StartTimer("energybufftime")
loopingBuffCheck = OnTimerElapse(
function(timer)
if GetObjectLastHitWeaponClass(object) == "rep_weap_walk_atte_rear_gun" then
local unit == (insert Get function here to get the unit that was hit - dunno what it would be)
SetProperty(unit, "EnergyBar", 150)
SetTimerValue("energybufftime", .01)
StartTimer("energybufftime")
end
end,
"energybyfftime"
)
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
You should never use a timer like that and I think the docs say not to too.
Anyway oops, I was thinking the GetObjectLast... function did something else.
I think this is what you want (when I say player, think Character):
Your unit fires a controllable. The controllable has an extremely short lifespan and explods when it dies. The damage from the explosion is very small and everyone in its radius can now be id. You need to locate these players. Do this by looping through each team, looping through the team's players. For each player, check to see if its unit is spawned. If the unit is not spawned, then the player is dead so continue on to the next player. If the player's unit does exist, check its last hit weapon class. If the class matches your controllable class, then you've found a unit hit by the controllable. Use SetProperty() on it. If the class does not match, move on to the next player. There is a small bug in this. If a player was outside the explosion's radius, but had not been hit since the last time it was in the explosion, he would get id as being hit this time too.
I do not know if EnergyBar is an object property or a class property. Lucky for you, changing endurance properties does not seem to cause a crash-to-desktop.
Anyway oops, I was thinking the GetObjectLast... function did something else.
I think this is what you want (when I say player, think Character):
Your unit fires a controllable. The controllable has an extremely short lifespan and explods when it dies. The damage from the explosion is very small and everyone in its radius can now be id. You need to locate these players. Do this by looping through each team, looping through the team's players. For each player, check to see if its unit is spawned. If the unit is not spawned, then the player is dead so continue on to the next player. If the player's unit does exist, check its last hit weapon class. If the class matches your controllable class, then you've found a unit hit by the controllable. Use SetProperty() on it. If the class does not match, move on to the next player. There is a small bug in this. If a player was outside the explosion's radius, but had not been hit since the last time it was in the explosion, he would get id as being hit this time too.
I do not know if EnergyBar is an object property or a class property. Lucky for you, changing endurance properties does not seem to cause a crash-to-desktop.
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Zerted, you still haven't said how you get a player's unit. I'd luck through your Holocron mode source myself but I can't find it anymore. And I have no idea what to search the shipped LUAs for.
*EDIT*
Found Objective Holo and looking through it. But I'm busy so Zerted might beat me to this.
Edit2. Found it.
GetCharacterUnit(int) seems to be it. (the int could be the 'player' that many Events return.
EDIT 3:
I tried using GetCharacterUnit, but
this code gave me this error
So, apparently GetCharacterUnit(killer) and GetCharacterUnit(player)
aren't returning anything. ?
*EDIT*
Found Objective Holo and looking through it. But I'm busy so Zerted might beat me to this.
Edit2. Found it.
GetCharacterUnit(int) seems to be it. (the int could be the 'player' that many Events return.
EDIT 3:
I tried using GetCharacterUnit, but
Code: Select all
PlayersUnit = GetCharacterUnit(player)
KillersUnit = GetCharacterUnit(killer)
KillerTeam = GetObjectTeam(KillersUnit)
if GetObjectTeam(PlayersUnit) == KillerTeam then
Code: Select all
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: bad argument #1 to `GetObjectTeam' (string expected, got nil)
stack traceback:
[C]: in function `GetObjectTeam'
(none): in function <(none):88>
aren't returning anything. ?
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
I am between moves and do not have access to my main modding resources at this time. However, I can point out a few things.Ace_Azzameen_5 wrote:this code gave me this errorCode: Select all
PlayersUnit = GetCharacterUnit(player) KillersUnit = GetCharacterUnit(killer) KillerTeam = GetObjectTeam(KillersUnit) if GetObjectTeam(PlayersUnit) == KillerTeam thenSo, apparently GetCharacterUnit(killer) and GetCharacterUnit(player)Code: Select all
Message Severity: 3 C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312) CallProc failed: bad argument #1 to `GetObjectTeam' (string expected, got nil) stack traceback: [C]: in function `GetObjectTeam' (none): in function <(none):88>
aren't returning anything. ?
If the character is dead, then it has no unit and GetCharacterUnit() will return nil. You must check for this.
When a player kills himself, the killer is the same as the player. I have never looked into what the killer is if the player is killed by a method like KillObject(). I assume it would be nil. You should add checks for this too.
When testing something you are not completely sure how it works, you should have print statements everywhere. print( "Player: " .. player ) will throw an error if player is nil. print( "Player:", player) will not throw the error.
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Thanks. The problem does seem to lie in player and killer's units not being returned. The player makes sense as the player's dead. I might just be mis-remembering the Killer error.
So, I'm tracking all player's units and those unit's teams at spawn, will let you know how it works out.
...This may be a stupid question, but do player indexes have allegiance? (GetPlayerTeam or something?)
P.S.
Sorry for thread jacking, I'd clean it up, but no perm's to do it.
So, I'm tracking all player's units and those unit's teams at spawn, will let you know how it works out.
...This may be a stupid question, but do player indexes have allegiance? (GetPlayerTeam or something?)
P.S.
Sorry for thread jacking, I'd clean it up, but no perm's to do it.
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
