Jump to content

Recommended Posts

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.

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") then

I can think of one way, but that would be very inefficient and could make problems.

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 by chromiumboy

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 examining

Like this:

 

Nice animals,                                           Monsters,                                              Other

post-286034-0-14341100-1402036503_thumb.

Edited by Mr. Tiddles

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. 

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?

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 player
end
 
end
 

AddGamePostInit(fn)

Edited by chromiumboy

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 player
end
 
end
 

AddGamePostInit(fn)

I'll give that a try. Thank you very much!

 

EDIT: It worked! Huzzah!

Edited by Mr. Tiddles

Nice animals,                                           Monsters,                                              Other

attachicon.giftalk.png

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...