EPDGaffney Posted December 21, 2017 Share Posted December 21, 2017 I want my NPC to change combat tactics according to some conditions and it's not working. At one point I had him equipping the weapon at the right time but then holstering it in favour of his other weapon. Now I have him completely ignoring my conditions. So, he has a high melee skill and he's switching between a knife and a throwing knife. When I want him to use throwing knives, he doesn't. These are custom weapons and the throwing knives have higher damage, so I'm not sure what's causing this. Actually, I think I do. Just had a look and the DPS is much lower on the throwing knife, so that's the problem. However, I'm still curious about this. I've tried the UseWeapon function as well and he doesn't do it. I'd love for him to throw five knives and then resume using his close-range knife. Do we not have a scripting function available to force this? Google doesn't seem to think so. Another thing I've tried is using a timer and removing his close-range knife after some time, then adding it back. It never happens however. I'm using OnHit. Does GetSecondsPassed not work with that? It's compiling fine, so I thought it would work. Link to comment Share on other sites More sharing options...
hexef Posted December 21, 2017 Share Posted December 21, 2017 Another thing I've tried is using a timer and removing his close-range knife after some time, then adding it back. It never happens however. I'm using OnHit. Does GetSecondsPassed not work with that? It's compiling fine, so I thought it would work. GetSecondsPassed will only work in Quest scripts and inside the GameMode and MenuMode blocks of an Object/Effect script. They always return 0 inside UDFs. My suggestion is to use either a token or JIP's Auxvars on the NPC to store both the baseform of the removed weapon and the timer. Link to comment Share on other sites More sharing options...
EPDGaffney Posted December 21, 2017 Author Share Posted December 21, 2017 (edited) Thanks, at least that explains why he never lost his close-range knife. I don't completely understand tokens and Auxvars, but I may look into them some more. However, my new idea would involve counting how many times he's used his throwing knives. I see a Begin blocktype called OnFire, but don't see any information about it. Is it usable? Is it just something like: Begin OnFire GSBViperThrowingKnife GSBViperOverlord Let FireCount += 1 EndThanks. Edit: Still curious about your answer on that blocktype, but I've sorted this out. Knowing that I can't use a timer with OnHit, and remembering that it's DPS, not Damage, that determines which weapon an NPC equips, I've simply used a variable called Stage and determined his stage by how many times he'd been hit and what his health was, then added different amounts of throwing knives depending on his stage. The result is absolutely bloody splendid. He is a force to be reckoned with and he isn't a complete dolt, nor he is impossible to take down. Edited December 21, 2017 by EPDGaffney Link to comment Share on other sites More sharing options...
Recommended Posts