|
1 registered members (TipmyPip),
7,787
guests, and 5
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Load an entity with action
[Re: BES]
#230151
10/03/08 09:27
10/03/08 09:27
|
Joined: Oct 2007
Posts: 5,211 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
|
in fact you cant "define" any actions on a wed project, you define them in your project, and let the wed know you defined some actions by attaching your script to your map.(we re doing this because we want see our actions in behaviour list  ) when you press run from wed it runs the script not the level.(try adding a short script that doenst even loads your level or that loads another level)
Last edited by Quadraxas; 10/03/08 09:28.
3333333333
|
|
|
Re: Load an entity with action
[Re: Quad]
#230384
10/05/08 07:19
10/05/08 07:19
|
Joined: Apr 2004
Posts: 516 USA
Trooper119
User
|
User
Joined: Apr 2004
Posts: 516
USA
|
While he's technically correct, this can be surpassed, what I do is create a function that has all of the actions I want predefined as integer values, and pass those values to the function, the function from there simply translates what I'm sending to it and creates actions from it. For an example (I know I murdered the explanation)
#define action1 1
#define action2 2
#define action3 3
main()
{
ENTITY* aPointer;
//specifying a pointer allows you to send it/manipulate it later in this or other functions
aPointer = spawnFunction(action1);
}
//Usually I'd specify 2 or 3 variables for the vector in
//order to place it where you want but it's really up to you.
ENTITY* spawnFunction(int action)
{
if(action == action1)
{
ent_create("default.mdl", vector(0, 50, 100), yourAction1);
}
else if (action == action2)
{
ent_create("raptor.mdl", vector(0, 50, 100), yourAction2);
}
else if (action == action3)
{
ent_create("tower.mdl", vector(0, 50, 100), yourAction3);
}
else
{
//you could write an error, or whatever here, it's good practice to use error checking
}
return my;
}
//Usually defined somewhere else, like another file
action yourAction1()
{
...
}
action yourAction2()
{
...
}
action yourAction3()
{
...
}
Last edited by Trooper119; 10/05/08 07:19.
A clever person solves a problem. A wise person avoids it. --Einstein
Currently Codeing: Free Lite-C
|
|
|
|