Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Quad, AndrewAMD), 1,007 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
pointer to caller/creator in particle functions #454869
09/26/15 15:31
09/26/15 15:31
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
H there,

I am trying to make a flexible particle function that reads the ID from the creator/caller (so e.g. if it is in a player function the player is the creator) and than gets all the necessary information out a struct. But my/you cannot be used it seems in the particle/effect function. So what would be the best alternative way to get the ID of the creator/caller?

I tried using just global vars that I would set right before the create effect, but that was inaccurate. (sometimes the global vars were different in the effect/particle function than I set before calling the function)

Re: pointer to caller/creator in particle functions [Re: Reconnoiter] #454872
09/26/15 17:10
09/26/15 17:10
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
You pass a vector pointer as parameter when you create them.
Instead of passing only a vector, you can pass your own struct.
Make sure your first 3 variables are "var x, y, z" so you dont fuck up the spawnposition wink

Re: pointer to caller/creator in particle functions [Re: Ch40zzC0d3r] #454875
09/26/15 18:18
09/26/15 18:18
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Good idea, tnx!

Re: pointer to caller/creator in particle functions [Re: Reconnoiter] #454881
09/27/15 00:23
09/27/15 00:23
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
Using a safer version of the above:
Misuse the velocity parameter. It's copied into each particles vel_x,vel_y,vel_z. You can store any kind of 32 bit value in each single variable.


Visit my site: www.masterq32.de
Re: pointer to caller/creator in particle functions [Re: MasterQ32] #454940
09/30/15 00:38
09/30/15 00:38

M
Malice
Unregistered
Malice
Unregistered
M



Quote:
But my/you cannot be used it seems in the particle/effect function.


Not true as noted in my particle tutorial ( and if I said it was so I was wrong) and my post to the Developer .

The effect command passes the you pointer as the creator into the particle function. Simply store it into a local ENTITY* function
Code:
p_fountain(PARTICLE* p)
{
///////ENTITY* owner = you; 
vec_set(p.x,you.x);
}



Manual
Quote:
If effect_local was called by an entity, the particle functions can access this entity through the you pointer. This way, the particle effect can use entity parameters.

In a single player system effect and effect_local are the same, on a multi system effect_local is the same as effect on a single player system. If I didn't post this as a "blame the manual" issue, I meant to do so...

So again you always have access to the creator's YOU pointer. In fact I am not even 100% sure you have to store it into a local ENTITY* You do not need to store it locally, why YOU always points to the creator and isn't roaming, I have no idea.

EDIT* If I recall you in the particle and p.event always point to the creator. If not you should be able to pass the point/handle from particle function to p.event using one of the p.skill_abc
After reviewing my own tutorial series I can see that I accessed the creator for vec instructions with just the you(r) pointer in both the particle function and the p.event. My Vid 9 shows use of the you-pointer .

Hopefully this helps and you did not mean multiplayer particles, in which case you'll have to use one of the hacks above.

EDIT2 Please read my strike-through comments, there is a high probability that the YOU pointer in my videos always points to the player because the player is the only entity in the example.
In this case both storing the YOU-pointer into a local ENTITY and passing it or it's handle to the p.event through p.skill_abc will be needed.

Last edited by Malice; 09/30/15 01:50.
Re: pointer to caller/creator in particle functions [Re: MasterQ32] #454953
09/30/15 10:46
09/30/15 10:46
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Originally Posted By: MasterQ32
Using a safer version of the above:
Misuse the velocity parameter. It's copied into each particles vel_x,vel_y,vel_z. You can store any kind of 32 bit value in each single variable.
, I actually used/use this and it works very well (a whole struct is not yet needed since I only need to pass along the ID and owner/controller).

@Malice, I dont for sure if you/my works, I find it a bit tricky in this case (better to be safe, I hate memory errors wink ). And I do take multiplayer into account (just incase lateron I really want to add multiplayer)

Last edited by Reconnoiter; 09/30/15 10:48.
Re: pointer to caller/creator in particle functions [Re: Reconnoiter] #454965
09/30/15 19:36
09/30/15 19:36

M
Malice
Unregistered
Malice
Unregistered
M



Quote:
(just incase lateron I really want to add multiplayer)

laugh
Thank you!!

Re: pointer to caller/creator in particle functions [Re: ] #454992
10/01/15 11:31
10/01/15 11:31
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Originally Posted By: Malice
Quote:
(just incase lateron I really want to add multiplayer)

laugh
Thank you!!
, I should thank you, you not me silly wink


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