08-07-2016, 09:00 PM
I have a script that's supposed to switch a certain entity's physics to static. However, since there are 4 different versions of the aforementioned entity on the map I only want the one that player grabs and places in a certain spot to become static. I used for ints.
Here's the code:
So as you can see since I have 4 entities named rock_1, rock_2, etc, it would be pretty stupid to make the static function for each one. I thus instead tried to avoid doing it like because that would pretty much eat too much time, and would set all those various entities around the map static. I tried using asParent name instead, but it doesn't help.
Any ideas on how I can fix this up?
Here's the code:
PHP Code:
for(int i=1;i<=4;i++) AddEntityCollideCallback("rock_"+i, "Puzzle_UseSoil", "UseRockOnPedestal", true, 1);
void UseRockOnPedestal(string &in asParent, string &in asChild, int alState)
{
AddGlobalVarInt("ElementsPuzzle", 1);
PuzzleCheck();
for(int i=0;i<4;i++) SetPropStaticPhysics(asParent+i, true);
PlaySoundAtEntity("", "impact_rock_high.snt", "Player", 0, false);
GiveSanityBoost();
}
So as you can see since I have 4 entities named rock_1, rock_2, etc, it would be pretty stupid to make the static function for each one. I thus instead tried to avoid doing it like
PHP Code:
SetPropStaticPhysics("Rock_", true);
Any ideas on how I can fix this up?