|
Post by newbie on Jun 21, 2018 11:18:42 GMT
is this Possible to drop item when the A.I is dead that can be loot by the player.
|
|
|
Post by newbie on Jun 21, 2018 11:22:18 GMT
P.S using Shooter Template
|
|
|
Post by Jader on Jun 21, 2018 11:36:23 GMT
There are many ways to do this, depending on what you need specifically.
This is an example of how I would:
using UnityEngine; using System.Collections;
public class DropExample : MonoBehaviour {
public GameObject CollectableItem;
public void Drop() {
if (CollectableItem != null) {
Instantiate(CollectableItem, transform.position, transform.rotation);
} } } You must call the Drop() function on the enemy "OnDead" Event.
|
|
|
Post by newbie on Jun 21, 2018 14:18:13 GMT
Just i thought thanks a lot it's work problem SOLVE
|
|
|
Post by Jader on Jun 21, 2018 16:12:24 GMT
It was nothing. Good to know that helped.
|
|
|
Post by mukul014 on Nov 5, 2018 17:05:26 GMT
do i have to set this script or it can drop just using drop event?
|
|
|
Post by Jader on Nov 6, 2018 10:55:08 GMT
Just attach script on enemy and assign the prefab to instantiate. On enemy's events, select the Drop() function in "OnDead" Event.
|
|
|
Post by mukul014 on Nov 6, 2018 16:15:17 GMT
Hi can you tell me how to use control freak 2 with invector? I've setup everything joystick etc but when I try to aim it's change control scheme to mobile then control and so on. Character don't move also I cannot aim. Control freeze. Do you have better way to implement new touch control ? Thank you.
|
|
|
Post by Jader on Nov 7, 2018 13:53:27 GMT
I'm not sure, but I think you should disable the component that makes the automatic change of the control scheme... But I don't remember now which it is.
|
|
|
Post by chairiko on Nov 8, 2018 3:05:26 GMT
Hello Jader, I am unable to get the drop script to work. I have added it to the event On Dead as well as assigning the game object to the script. Please help! Jader
|
|
|
Post by chairiko on Nov 8, 2018 3:06:15 GMT
I'm not sure, but I think you should disable the component that makes the automatic change of the control scheme... But I don't remember now which it is. Jader please assist! The script isn't dropping at all
|
|
|
Post by Jader on Nov 8, 2018 17:25:43 GMT
Where I marked in red, you should select the "Drop" function, of "DropExample" script.
|
|
|
Post by chairiko on Nov 8, 2018 22:35:20 GMT
Where I marked in red, you should select the "Drop" function, of "DropExample" script. I am unable to select the drop function as it only shows monoscript.name then it asks me to type something.
|
|
|
Post by Jader on Nov 9, 2018 11:26:55 GMT
I'm at work now, but I think you assigned the script where it should be the gameobject... Drag your enemy gameobject to red marked field and then, where says "No Function", select Drop(), inside DropExample submenu.
|
|
|
Post by sjl on Nov 11, 2018 2:49:41 GMT
Yes you should
apply the script to your enemy
Then in the collectable item field put your collectable there...
Then on the events tap of the AI shooter controller in the On Dead ( GameObject) Assign your enemyprefab and the function tab select Drop()
Hit play and it should work if you typed the script correctly...
Only problem I ran into is that at the moment it does not drop on stealth kill...
|
|