Automatically repair Glass Objects...
#1

Hi all,
I have designed a race course where users have to go by breaking a wall made of glass object (ID:3851)..
The problem is the objects, once braked, do not repair... I want them to repair after specific time period...
Any help will be appreciated...
Reply
#2

If you can figure out the object ID of the glass objects, you can destroy them and create them on a timer.
Reply
#3

The glass is created at streaming in, you could use it to your advantage to repair the glass. You could also do what RealCop said.
Reply
#4

Ya, that's a good Idea RealCop228!... Thank you
@TheDeadlyDutchi, I do not understand what you mean by (created at streaming in)... Can you elaborate?
Reply
#5

Quote:
Originally Posted by jawadhyder15
Посмотреть сообщение
Ya, that's a good Idea RealCop228!... Thank you
@TheDeadlyDutchi, I do not understand what you mean by (created at streaming in)... Can you elaborate?
He meant that, example there is a glass in front of you. You go break it, and then go really way back. But then, when you come back to the same place, the mirror will be still there. I think this is what he meant
Reply
#6

Anyway, the problem is solved...
I came up with this code:
PHP код:
new GlassObjsIds[20]; // I have 18 glass objects
// Objects are created like this
GlassObjsIds[0] = CreateObject(3851, -3023.3110351747.70666518.0135300.0000000.000000, -7.599997300);
GlassObjsIds[1] = .....
GlassObjsIds[2] = .....
.......
......
...... 
Then on OnFilterScriptInit, I've created a timer that runs RepairGlassObjs after every 10 seconds
PHP код:
SetTimer("RepairGlassObjs",10000,true); 
And the RepairGlassObjs function is this,

PHP код:
public RepairGlassObjs(){
    new 
Float:X,Float:Y,Float:Z,Float:RX,Float:RY,Float:RZ;
    for (new 
i=0sizeof(GlassObjsIds); i++){
        
GetObjectPos(GlassObjsIds[i],X,Y,Z);
        
GetObjectRot(GlassObjsIds[i],RX,RY,RZ);
        
DestroyObject(GlassObjsIds[i]);
        
GlassObjsIds[i] = CreateObject(3851XYZRXRYRZ300);
    }

If anyone have the same problem, he can use this code...
Reply
#7

You would be better off using foreach for that, but either way, good that you fixed it!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)