 |
 |
 |
|
 |
 |
 |
|
 |
 |
Geting npc visual and forcing npc into animation. |
|
1 2 | Next 10 events »| All Messages |
|
|
06:02:22 22 August 2013 |
|
Reisen
(Novice) On forum: 02/09/2012
Messages: 26
|
Geting npc visual and forcing npc into animation.
I am looking for a way to get npc's visual (outfit).
I read about function "get_visual_name()" but it was added only in CoP.
I read something about getting visual with net packets but cant understand how its done.
Another thing is, I need to force npc into animation.
The problem is that, npc wont go into animation probably because its being overridden by something with more priority.
Even if animation start playing npc instantly goes back to what it was doing.
Any way to force npc into animation without him leaving it no matter what? |
16:19:48 22 August 2013 |
|
Reisen
(Novice) On forum: 02/09/2012
 Message edited by: Reisen 08/22/2013 16:23:33
Messages: 26
|
Google returned only one page with 6 results on packet_utils21.script and Bing return only two results.
Searched this forum and the only links I found mediafire and sendspace were dead.
Can you reupload it?
Also, I am trying to get weapon of the npc that shoot someone, any idea whats wrong with this approach?
local shooter = obj:who_hit_name() --/Works fine
local weapon = shooter:active_item() --/adding this line causes ctd for asigning shooter a nil value.
I know active_item() works fine on npc because I used it to make npc drop weapon when shot in hand, why doesnt it work here? |
16:34:56 22 August 2013 |
|
Xetrill
(Senior) On forum: 07/08/2008
Messages: 129
|
---QUOTATION--- local shooter = obj:who_hit_name() --/Works fine
local weapon = shooter:active_item() --/adding this line causes ctd for asigning shooter a nil value.
---END QUOTATION---
That's your answer, shooter is nil. And most likely who_hit_name() doesn't work, it probably always returns nil.
It's never used in vanilla scripts, so there wasn't need to make it work.
"If debugging is the process of removing software bugs, then programming must be the process of putting them in." -- Edsger Dijkstra
Version Control: http://mercurial.selenic.com/ | http://tortoisehg.bitbucket.org/ | http://bit.ly/pvGbs5
Organization & Collaboration: https://trello.com/
My LuaJIT DLL for CS/CoP: http://bit.ly/1oNN4K6 (2014-02-18)
http://pastebin.com/u/Xetrill (in case of broken links, posted code might still be there)
|
16:50:37 22 August 2013 |
|
Reisen
(Novice) On forum: 02/09/2012
 Message edited by: Reisen 08/22/2013 16:52:01
Messages: 26
|
---QUOTATION---
That's your answer, shooter is nil. And most likely who_hit_name() doesn't work, it probably always returns nil. ---END QUOTATION---
Thats why I noted that it works fine.
When I test it via
say = shooter
news_manager.send_tip(db.actor, say, nil, nil, 2000)
It prints single_player if I shoot someone and if someone being shoot by someone else, it prints stuff like agr_bar_stalker_121249, sim_default_duty_121110 so it certainly knows who shot who.
Its when I add local weapon = shooter:active_item() I get ctd for assigning shooter a nil value. |
17:22:55 22 August 2013 |
|
Xetrill
(Senior) On forum: 07/08/2008
Messages: 129
|
Ah, sorry. Should have occurred to me, you get a string back not an userdata(/luabind) object (of type game_object). And strings don't have an active_item function, that's the reason for crashing.
As for what you're trying to accomplish, smog2 knows more than me. Though be advised callbacks for things like being 'hit' have a high chance of firing a lot.
LuaJIT is pretty fast, but still too slow to make that even seem reasonable.
"If debugging is the process of removing software bugs, then programming must be the process of putting them in." -- Edsger Dijkstra
Version Control: http://mercurial.selenic.com/ | http://tortoisehg.bitbucket.org/ | http://bit.ly/pvGbs5
Organization & Collaboration: https://trello.com/
My LuaJIT DLL for CS/CoP: http://bit.ly/1oNN4K6 (2014-02-18)
http://pastebin.com/u/Xetrill (in case of broken links, posted code might still be there)
|
18:16:49 22 August 2013 |
|
Reisen
(Novice) On forum: 02/09/2012
 Message edited by: Reisen 08/22/2013 18:19:21
Messages: 26
|
---QUOTATION--- If you want to get the NPC who shot and hit another NPC, it is best to use this method:
---END QUOTATION---
I am trying to process this so I get back to you later, I hope I manage it.
---QUOTATION--- Search for a function called hit_callback in sim_combat.script. ---END QUOTATION---
By the way, I am adding all my scripts in function motivator_binder:hit_callback...
in xr_motivator.script, do you think it can create difficulties in the future?
---QUOTATION--- Ah, sorry. Should have occurred to me, you get a string back not an userdata... ---END QUOTATION---
So thats the reason... Thanks for explaining.
---QUOTATION---
As for what you're trying to accomplish, smog2 knows more than me...
LuaJIT is pretty fast, but still too slow to make that even seem reasonable. ---END QUOTATION---
Actually its not that bad, I am running scripts called on hit, detecting where bullet hit and depending on it causing additional damage, randomly ricocheting or causing npc to drop weapon, even if its slow as you say its fast enough to manage it.
Now I am trying to add physical damage from bullet which didnt pierce the bulletproof vest but still caused damage by impact (damage will wary depending on armor) so I need to get the victim armor, attacker ID and weapon used in one hit callback. |
19:46:05 22 August 2013 |
|
Xetrill
(Senior) On forum: 07/08/2008
 Message edited by: Xetrill 08/22/2013 20:11:51
Messages: 129
|
---QUOTATION--- Actually its not that bad, I am running scripts called on hit, detecting where bullet hit and depending on it causing additional damage, randomly ricocheting or causing npc to drop weapon, even if its slow as you say its fast enough to manage it. ---END QUOTATION---
I don't doubt that, and I don't mean to discourage you, not at all. Though, the thing is - generally speaking - Lua isn't the tool you'd use for that. If possible, you'd use C++ for anything that has the potential to causing hundreds on checks per second.
Because you'd have to make sure you can render a frame in 16.67ms (=60fps), and of course
things add up. But well, nothing we could do about that. Unless, GSC/Vostok Games release the source code...
---QUOTATION--- ... so I need to get the victim armor, attacker ID and weapon used in one hit callback. ---END QUOTATION---
And ammo type used (k_impulse & k_ap), and you'll probably want to use each weapons hit_impulse value as a baseline, I guess.
Edit: I can offer you too look over your code and maybe we can squeeze out bit more throughput. Now though, it's time to lift some weights .
"If debugging is the process of removing software bugs, then programming must be the process of putting them in." -- Edsger Dijkstra
Version Control: http://mercurial.selenic.com/ | http://tortoisehg.bitbucket.org/ | http://bit.ly/pvGbs5
Organization & Collaboration: https://trello.com/
My LuaJIT DLL for CS/CoP: http://bit.ly/1oNN4K6 (2014-02-18)
http://pastebin.com/u/Xetrill (in case of broken links, posted code might still be there)
|
21:18:21 22 August 2013 |
|
Reisen
(Novice) On forum: 02/09/2012
 Message edited by: Reisen 08/22/2013 21:28:29
Messages: 26
|
---QUOTATION---
And ammo type used and you'll probably want to use each weapons hit_impulse value as a baseline, I guess. ---END QUOTATION---
Actually I just want to divide weapons in 3-4 general groups, 1 - handguns, 2 - machine pistols, 3 - assault riffles, 4 - sniper riffles (or just heavy stuff).
Now, if npc wears bullet proof vest of second class and gets shot with pm (first group), while vest wont get pierced, npc will still fall on the ground after approximately 5 shots (as kevlar wont protect from impact). Until armor is pierced by bullet he wont die (not fast at least) but will be injured.
Now npc who wears vest of fifth defence class wont go down from blunt trauma caused by pm, because its protected from it.
To inflict blunt trauma on person wearing this kind of vest, you will need something heavier, like ak47 (third group), while it might not penetrate the vest it will still inflict blunt trauma.
Its just approximation of what I am aiming for, question of balance left for later.
So it just checks, defence class of a vest (by visual), to which group weapon you used belong and decides what kind of blunt trauma it will cause. Weapons of low class wont cause much of blunt trauma on peoples wearing vest with high defence class.
Ammo piercing capabilities, vest defence and damage dealt by gun is already dealt with, this mod its just port of (very good) weapon system from "Difficult Zone Mod" to OGSM while trying to develop few ideas of my own like npc reaction to being shot in hands, legs, head and taking blunt trauma into consideration.
---QUOTATION--- I can offer you too look over your code and maybe we can squeeze out bit more throughput. ---END QUOTATION---
I would gladly accept help of someone who can help me with it, as for I am still trying to implement smoq2 script.
While I am dealing with it, here http://pastebin.com/MZZLdaSJ (ctrl+F Weapon Drop and Head Shot) you can see how I did with weapon drop script and script that calculates npc's odds of survival after shot in the head if bullet havent penetrated the helmet (though obviously it still should have made heavy damage due to blunt trauma).
As you can see there are left overs of my attempts to put npc into different states according to injury, those are not working. |
|
1 2 | Next 10 events »| All Messages |
|
|
|
» » |
|
All short dates are in Month-Day-Year format. |
 |
|
 |
|
|
|
 |
 |
 |