How does a voodoo doll know which player to follow?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)

How does a voodoo doll know which player to follow?

Postby Matt » Fri May 13, 2022 8:54 pm

It clearly doesn't have a working player pointer and players[x].mo wouldn't point to it, so where would this info be stored?
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: How does a voodoo doll know which player to follow?

Postby 7Soul » Sat May 14, 2022 7:57 pm

Maybe this has the answer

7Soul
 
Joined: 13 Mar 2021

Re: How does a voodoo doll know which player to follow?

Postby Rachael » Sat May 14, 2022 9:18 pm

Matt wrote:It clearly doesn't have a working player pointer and players[x].mo wouldn't point to it, so where would this info be stored?

actor.player is the very essence of how voodoo doll logic works, even in GZDoom. Can you post an example of it not working?
User avatar
Rachael
^ walking stack of unfinished projects ^
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: How does a voodoo doll know which player to follow?

Postby Graf Zahl » Sun May 15, 2022 4:47 am

Matt wrote:It clearly doesn't have a working player pointer?


You are clearly wrong here. :P

It works as follows:

First player instance is spawned, linked to player x and player x linked to this instance.
Second instance is spawned, linked to player x and player x linked to this instance.

Now the first instance still points to the player, but the player points to something else. VoilĂ , you just got a voodoo doll.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: How does a voodoo doll know which player to follow?

Postby Matt » Mon May 16, 2022 6:13 pm

...welp, time to fix a bunch of code before trying to do whatever it was I was trying to do that led to this question!
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest