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
repeating+Adding on script looks impossible?!
Amnesiaplayer Offline
Senior Member

Posts: 539
Threads: 105
Joined: Jun 2014
Reputation: 0
#1
repeating+Adding on script looks impossible?!

I tried some things, with the "cannon" Entity. (custom)
I tried to make it shoot cannonballs, each 3 seconds.
with the script:

void BallShoot(string &in asTimer)
{
PlayGuiSound("break_wood_metal", 3);
CreateEntityAtArea("Ball_+i", "cannonball.ent", "Ball_Shoot", true);
AddPropForce("Ball_+i", 0, 0, -1000000, "world");
CreateParticleSystemAtEntity("", "ps_hit_rock.ps", "Ball_Shoot", true);
AddTimer("", 3,"BallShoot");
}

So, what I want, is it creates a Ball, and do some effects.
The problem is, It is called " Ball "
And you need a name for Addpropforce, so I use " Ball " Ofcourse, but the effect is repeating, everytime it creates a new cannonball, the cannonball will have another name, since it is not possible to have 2 entities with the same name.
No, the problem is, if I open the map, It shoots the cannonball (With propforce) and does all the other effects, but after 3 seoconds, it shoots the ball, everything happen EXCEPT addpropforce, meaning the ball just fall down.
How can I make the ball use the "addpropforce" for the whole time..

Quick Explain:
I want a cannon that shoots a cannonball. (repeats after every 3 sec)

I want those things to happen:

PlayGuiSound("break_wood_metal", 3);
CreateEntityAtArea("Ball_+i", "cannonball.ent", "Ball_Shoot", true);
AddPropForce("Ball_+i", 0, 0, -1000000, "world");
CreateParticleSystemAtEntity("", "ps_hit_rock.ps", "Ball_Shoot", true);

The problem:
Let's say the entity is called "Ball" instead of Ball_+i

CreateEntityAtArea("Ball", "cannonball.ent", "Ball_Shoot", true);
AddPropForce("Ball", 0, 0, -1000000, "world");

So, at the first shot of the cannon.
What happens? It creates an entity, called "Ball".
Then, Addpropforce, will Push the heck out of "Ball".
And this needs to repeat after 3 seconds.
BUT then, it creater a "Ball" again, but it is not possible to have 2 entities with the same name, so it creates *I think* "Ball_1" Or something like that, and THEN (this is where the problem comes)
The Addpropforce will add prop force to "Ball"...
So I need to make Addpropforce work with CreateEntityAtArea....
05-20-2015, 08:23 PM
Find


Messages In This Thread
repeating+Adding on script looks impossible?! - by Amnesiaplayer - 05-20-2015, 08:23 PM



Users browsing this thread: 1 Guest(s)