Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
3 registered members (TedMar, AndrewAMD, fairtrader), 578 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Attaching entities #199664
03/31/08 20:45
03/31/08 20:45
Joined: Oct 2007
Posts: 116
S
sydan Offline OP
Member
sydan  Offline OP
Member
S

Joined: Oct 2007
Posts: 116
If you have more than one of the same model (say an opponent) and each holds a gun, how do you get the guns to stick to a different person rather tah nall the same? How can you specify which person they have to attach to with out making loads of different models with different actions.

Re: Attaching entities [Re: sydan] #200113
04/02/08 16:35
04/02/08 16:35
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
I use entity lists and entity arrays ( a plug in made with SDk).
Others that still use C-Script might use var arrays and functions handle & ptr_for_handle (sp) to store handles to entity pointers in var arrays.

Re: Attaching entities [Re: testDummy] #200136
04/02/08 18:26
04/02/08 18:26
Joined: Oct 2007
Posts: 116
S
sydan Offline OP
Member
sydan  Offline OP
Member
S

Joined: Oct 2007
Posts: 116
Thanks for the reply! That will be much easier on coding than my current idea, which is to use a c_trace that constantly attempts to find the nearest entity and stick to it. I just need to learn to use handles, pointers and arrays fully. Do you have any tips? Also what is SDk?

Thanks
Sydan


For some reason, my ambition always seems to beat my ability.
Re: Attaching entities [Re: sydan] #200140
04/02/08 19:15
04/02/08 19:15
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Arrays, handles and pointers are not that complicated.
What you need in this case are just handles, which are safer than just pointers as they are still valid after a game_load.
In your case you could let each actor perform a gun creation "routine".
Just let each actor create a weapon at the beginning of his action and save a handle to that weapon in any skill of the entity.
Later on when the actor moved or needs to perform something with his gun-entity you can just receive a pointer to it from the handle and influence it.
A code example, which uses C-Script and represents an actor who creates another entity and updates the position of it in each frame:
 Code:
define gun_handle, skill22;

string gun_file = <gun_model.mdl>;

action actor_act()
{
  you = ent_create(gun_file,my.x,null); // create the entity
  you.passable = on; // make the gun passable
  my.gun_handle = handle(you); // store a handle to it

  while(me)
  {
    you = ptr_for_handle(my.gun_handle);
    vec_set(you.x,my.x);
    
    wait(1);
  }
}


Re: Attaching entities [Re: Xarthor] #200148
04/02/08 19:49
04/02/08 19:49
Joined: Oct 2007
Posts: 116
S
sydan Offline OP
Member
sydan  Offline OP
Member
S

Joined: Oct 2007
Posts: 116
Thanks alot! Thats something I have been trying to do for awhile, now my game productions should be alot quicker!

Sydan


For some reason, my ambition always seems to beat my ability.
Re: Attaching entities [Re: Xarthor] #200152
04/02/08 20:01
04/02/08 20:01
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655

Software Development (mini)kit SDk
-as opposed to-
Software Development Kit SDK
(roughly) interface C++ / Delphi & 3DGS (plugin .dll)

OK, it's a type-o.

 Quote:
which are safer than just pointers as they are still valid after a game_load.

It seems, for what was mentioned previously, the pointers were made 'valid', or persistent, but that's not really relevant.

I mentioned arrays and lists erroneously.

Xarthor has the 'more correct' answer.

Re: Attaching entities [Re: testDummy] #200156
04/02/08 20:07
04/02/08 20:07
Joined: Oct 2007
Posts: 116
S
sydan Offline OP
Member
sydan  Offline OP
Member
S

Joined: Oct 2007
Posts: 116
OKay thanks anyway.

Sydan


For some reason, my ambition always seems to beat my ability.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1