[SCRIPT] Spawn entities on moving location & Using items on enemies - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: [SCRIPT] Spawn entities on moving location & Using items on enemies (/thread-19030.html) |
Spawn entities on moving location & Using items on enemies - ZodiaC - 11-01-2012 So I'm creating a new custom model and I need some scipt help(will be used later with the model)... Well my first question is: Is it possible to spawn entities on a moving item(enemies too) & on players position?(the second is more important) And the second one: How to use items on enemies & how to use the "AddEntityCollideCallback" (You know when an entity enters an area) on enemies??? RE: Spawn entities on moving location & Using items on enemies - The chaser - 11-01-2012 Ok, here I go: You can attach entities to a moving entity (I don't know if you can with the player). In this case, you do this: AddAttachedPropToProp("name of the entity", "name of the entity that it's going to be attached", "name of the entity that it's going to be attached.ent", 0,0,0, 0,0,0); For the items on enemies, I did one thing in my story: Code: AddEntityCollideCallback("sledge_1", "Master", "Destroy", true, 1); RE: Spawn entities on moving location & Using items on enemies - ZodiaC - 11-02-2012 (11-01-2012, 10:29 PM)The chaser Wrote: Ok, here I go:For the first one: the attach command doesn't stuck two items together??? For he second: what exactly is the "func_on1();" ??? RE: Spawn entities on moving location & Using items on enemies - The chaser - 11-02-2012 When the sledge touched the Master (A brute) it called the function "Destroy". This function called the func_on1();, which would check if the monster had enough hits to die. The "Hits" timer allowed the player to strike the brute again. The AddLocalVarInt... well, I think you know Yes, attaching sticks an entity to another one. Sorry, but there isn't anything like: SpawnEntityAtPlayer("Thing", true); So attaching was the best solution I saw. If you are planning a combat, I think I have a method, much better Let's play with ragdolls... RE: Spawn entities on moving location & Using items on enemies - ZodiaC - 11-02-2012 (11-02-2012, 12:41 PM)The chaser Wrote: When the sledge touched the Master (A brute) it called the function "Destroy". This function called the func_on1();, which would check if the monster had enough hits to die. The "Hits" timer allowed the player to strike the brute again. The AddLocalVarInt... well, I think you knowSo you created the func_on1(); command from here?: And then used it in script right? For the attach-thing you attach an item to something else and make it invisible,and when you want to spawn it you make it visible and detach it? It seems that I have to spoil my create...Anyway i'm creating an energy drink(can) that will make the player run faster when he uses it and i just wanted to make him drop the can after drinking it.. I guess you have created many battles! RE: Spawn entities on moving location & Using items on enemies - The chaser - 11-02-2012 No, no, nothing of level editor. Just script. func_on1(); just checked if the monster was ready to die. You can attach the entity to the player and then detach it. You can do this: AddAttachedPropToProp("Player", "can_01", "can_01.ent", 0,0,0, 0,0,0); And then: RemoveAttachedPropFromProp(string& asPropName, string& asAttachName); Not really sure how it works, though. RE: Spawn entities on moving location & Using items on enemies - ZodiaC - 11-02-2012 (11-02-2012, 01:46 PM)The chaser Wrote: No, no, nothing of level editor. Just script. func_on1(); just checked if the monster was ready to die.So the func_on1(); is actually an independent command? Maybe I could make it like all the potions in the main game(without drop animation)..it seems really complicate RE: Spawn entities on moving location & Using items on enemies - The chaser - 11-02-2012 You can do func_on1(); whateva(); Anything. It's just a callback without any condition. It just calls. Try the attaching and detaching. I think it will be a cool effect! |