The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Entity's physics not setting to static
Slanderous Offline
Posting Freak

Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation: 63
#1
Entity's physics not setting to static

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:

PHP Code: (Select All)
for(int i=1;i<=4;i++) AddEntityCollideCallback("rock_"+i"Puzzle_UseSoil""UseRockOnPedestal"true1); 

void UseRockOnPedestal(string &in asParentstring &in asChildint alState)
{
    
AddGlobalVarInt("ElementsPuzzle"1);
    
PuzzleCheck();
    for(
int i=0;i<4;i++) SetPropStaticPhysics(asParent+itrue);
    
PlaySoundAtEntity("""impact_rock_high.snt""Player"0false);
    
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: (Select All)
SetPropStaticPhysics("Rock_"true); 
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?
08-07-2016, 09:00 PM
Find


Messages In This Thread
Entity's physics not setting to static - by Slanderous - 08-07-2016, 09:00 PM



Users browsing this thread: 2 Guest(s)