Jump to content
Sign in to follow this  
kocrachon

Delete "type" of things that are "x" distance

Recommended Posts

Hello All,

I am trying to create either a trigger or script, that if a type of item is close enough, it will get deleted.

Specifically, I am trying to make it so if I drag "ACE_bodyBagObject" of which there are 5, to a vehicle named "RecoveryVeh", I want it to delete the body bag (to simulate it being put into the recovery truck). Anyone able to assist with this?

I tried if ((distance <= 7 and (typeOf ACE_bodyBagObject)) in a trigger, but I just get various errors, so I assume I am on a very bad path to start.

Edited by Kocrachon

Share this post


Link to post
Share on other sites

I think my biggest issue is syntax.

I use this in the "condition" field

(distance <= 7) and (typeOf ACE_bodyBagObject)

But it tells me and: Type String, expected Book,code

But that doesnt seem to make sense to me. I feel like I am using "and" in the appropriate way...

Share this post


Link to post
Share on other sites

If you'd read the actual script error (-showscripterrors or check your log), you'll see that your typeof condition is not a true test.

Look up what "typeof" returns, it's in the link KK gave you (look for the "return value"). It's not a boolean. A condition always must return a boolean. So either modify it so it can actually work (e.g. typeOf bodybag == "Whatever") or use something that actually fits your use case, such as

https://community.bistudio.com/wiki/isKindOf

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×