NikMik Posted June 5, 2014 Share Posted June 5, 2014 So, I want my character to do something different when they're examining a hostile creature. data.target looks like it only works for combat targets, so what would I specify in the character's prefab/stategraph to ask "if target has monster tag"? thanks for reading. Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/ Share on other sites More sharing options...
orian34 Posted June 6, 2014 Share Posted June 6, 2014 ? Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/#findComment-494872 Share on other sites More sharing options...
NikMik Posted June 6, 2014 Author Share Posted June 6, 2014 ?That's not very helpful. Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/#findComment-494875 Share on other sites More sharing options...
chromiumboy Posted June 6, 2014 Share Posted June 6, 2014 It should be possible. Check the compass prefab. The examination quote changes depending on the direction your facing, you could replace that with a check to see whether the mob has a target. If you want to apply this to an base mob and not a new one, it might be easier to alter the examination action itself to include the target check. Eg. If the mob has a target, search for the string with the mob name with '_attacking' appended to it. Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/#findComment-494962 Share on other sites More sharing options...
NikMik Posted June 6, 2014 Author Share Posted June 6, 2014 It should be possible. Check the compass prefab. The examination quote changes depending on the direction your facing, you could replace that with a check to see whether the mob has a target. If you want to apply this to an base mob and not a new one, it might be easier to alter the examination action itself to include the target check. Eg. If the mob has a target, search for the string with the mob name with '_attacking' appended to it.That doesn't help. What I'm looking for is how to actually say "Examined target" in the code.Like this: if what I'm looking for:HasTag("monster") thenI can think of one way, but that would be very inefficient and could make problems. Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/#findComment-494963 Share on other sites More sharing options...
chromiumboy Posted June 6, 2014 Share Posted June 6, 2014 (edited) The target of the inspection isnt held onto as far as im aware. When the inspect action is triggered, you'll have to pass the target to the player prefab (should be in the inspectable component). This is from memory though, I'm not at home atm. If that's still not what your after you'll need to give me some more detail, I'm still not sure what you really want to achieve. Edited June 6, 2014 by chromiumboy Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/#findComment-494980 Share on other sites More sharing options...
NikMik Posted June 6, 2014 Author Share Posted June 6, 2014 (edited) The target of the inspection isnt held onto as far as im aware. When the inspect action is triggered, you'll have to pass the target to the player prefab (should be in the inspectable component). This is from memory though, I'm not at home atm. If that's still not what your after you'll need to give me some more detail, I'm still not sure what you really want to achieve.I want a way to make it so when my character examines a nice creature, they wave to the camera and a heart appears over their head. When examining a monster, they cower and a broken heart appears. If they're examining something that is neither a nice creature or monster, they just wave their arms around a bit with "..." over their head. I have it all, just need to make them actually use the different states depending on what they're examiningLike this: Nice animals, Monsters, Other Edited June 6, 2014 by Mr. Tiddles Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/#findComment-494988 Share on other sites More sharing options...
chromiumboy Posted June 6, 2014 Share Posted June 6, 2014 What I suggested should work for that. Replace the ACTIONS.LOOKAT.fn in actions.lua with a new function which has an 'if else' tree set up to play the appropriate player animation depending on the target. You can put the replacement function in modmain.lua and load it with a post init which includes a check to see if the player prefab is Warfarin. Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/#findComment-495002 Share on other sites More sharing options...
NikMik Posted June 6, 2014 Author Share Posted June 6, 2014 What I suggested should work for that. Replace the ACTIONS.LOOKAT.fn in actions.lua with a new function which has an 'if else' tree set up to play the appropriate player animation depending on the target. You can put the replacement function in modmain.lua and load it with a post init which includes a check to see if the player prefab is Warfarin. I'm kind of unfamiliar with postinitseseseses. Is there a place I could find an example of a postinit for an action? Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/#findComment-495003 Share on other sites More sharing options...
chromiumboy Posted June 6, 2014 Share Posted June 6, 2014 (edited) Try this: local function fn(inst) local player = GLOBAL.GetPlayer() if player and player.prefab == "warfarin" then GLOBAL.ACTIONS.LOOKAT.fn = function(act)-- Your code in here. act.target is the target, act.invobject is an examined inventory item, act.doer is the playerend end AddGamePostInit(fn) Edited June 6, 2014 by chromiumboy Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/#findComment-495006 Share on other sites More sharing options...
NikMik Posted June 6, 2014 Author Share Posted June 6, 2014 (edited) Try this: local function fn(inst) local player = GLOBAL.GetPlayer() if player and player.prefab == "warfarin" then GLOBAL.ACTIONS.LOOKAT.fn = function(act)-- Your code in here. act.target is the target, act.invobject is an examined inventory item, act.doer is the playerend end AddGamePostInit(fn)I'll give that a try. Thank you very much! EDIT: It worked! Huzzah! Edited June 6, 2014 by Mr. Tiddles Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/#findComment-495014 Share on other sites More sharing options...
chromiumboy Posted June 6, 2014 Share Posted June 6, 2014 I'll give that a try. Thank you very much! EDIT: It worked! Huzzah! No worries Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/#findComment-495036 Share on other sites More sharing options...
F3RR1S Posted June 6, 2014 Share Posted June 6, 2014 Nice animals, Monsters, Othertalk.pngHmm, i feel a line should be put through the broken heart, because it's hard to tell that it is broken. Well, for me, at least. Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/#findComment-495043 Share on other sites More sharing options...
NikMik Posted June 6, 2014 Author Share Posted June 6, 2014 Hmm, i feel a line should be put through the broken heart, because it's hard to tell that it is broken. Well, for me, at least.I did just then, actually. Link to comment https://forums.kleientertainment.com/forums/topic/37177-specifying-examination-target/#findComment-495045 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now