ZodiaC
Member
Posts: 120
Threads: 8
Joined: Oct 2012
Reputation:
2
|
Spawn entities on moving location & Using items on enemies
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???
(This post was last modified: 11-01-2012, 10:40 PM by ZodiaC.)
|
|
11-01-2012, 08:36 PM |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
RE: Spawn entities on moving location & Using items on enemies
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:
AddEntityCollideCallback("sledge_1", "Master", "Destroy", true, 1);
void Destroy (string &in asParent, string &in asChild, int alState)
{
AddTimer("", 1.0f, "Hits");
func_on1();
AddLocalVarInt("Kill", 1);
}
void Hits (string &in asTimer)
{
AddEntityCollideCallback("sledge_1", "Master", "Destroy", true, 1);
}
void func_on1()
{
if (GetLocalVarInt("Kill") == 3)
{
FadeEnemyToSmoke("Master", true);
AddTimer("", 6, "Credits");
SetMessage("Messages", "WalkQuest_final", 5);
}
}
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
11-01-2012, 10:29 PM |
|
ZodiaC
Member
Posts: 120
Threads: 8
Joined: Oct 2012
Reputation:
2
|
RE: Spawn entities on moving location & Using items on enemies
(11-01-2012, 10:29 PM)The chaser Wrote: 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:
AddEntityCollideCallback("sledge_1", "Master", "Destroy", true, 1);
void Destroy (string &in asParent, string &in asChild, int alState)
{
AddTimer("", 1.0f, "Hits");
func_on1();
AddLocalVarInt("Kill", 1);
}
void Hits (string &in asTimer)
{
AddEntityCollideCallback("sledge_1", "Master", "Destroy", true, 1);
}
void func_on1()
{
if (GetLocalVarInt("Kill") == 3)
{
FadeEnemyToSmoke("Master", true);
AddTimer("", 6, "Credits");
SetMessage("Messages", "WalkQuest_final", 5);
}
}
For the first one: the attach command doesn't stuck two items together???
For he second: what exactly is the "func_on1();" ???
|
|
11-02-2012, 12:34 PM |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
RE: Spawn entities on moving location & Using items on enemies
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...
THE OTHERWORLD (WIP)
Aculy iz dolan.
(This post was last modified: 11-02-2012, 12:42 PM by The chaser.)
|
|
11-02-2012, 12:41 PM |
|
ZodiaC
Member
Posts: 120
Threads: 8
Joined: Oct 2012
Reputation:
2
|
RE: Spawn entities on moving location & Using items on enemies
(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 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... So 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!
|
|
11-02-2012, 01:26 PM |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
RE: Spawn entities on moving location & Using items on enemies
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.
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
11-02-2012, 01:46 PM |
|
ZodiaC
Member
Posts: 120
Threads: 8
Joined: Oct 2012
Reputation:
2
|
RE: Spawn entities on moving location & Using items on enemies
(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.
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. 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
|
|
11-02-2012, 01:52 PM |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
RE: Spawn entities on moving location & Using items on enemies
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!
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
11-02-2012, 02:24 PM |
|
|