Jump to content

G.E.C.K code help needed.


PKPAIN

Recommended Posts

Hello.

As the title says i need a bit of help with a small (or i hope it's small) code in GECK.

What i want to do is have a switch that activates 3 objects one after the other.

For example if the player activates the switch for the first time object #1 is enabled,press it again and object #2 is enabled and object #1 is disabled and so on until the last object loops back to the first so basically every time i press the switch the next object appears and the last disappears.

My code so far looked something like:

 

Ref ObjectRef

 

Begin GameMode

set ObjectREF to GetLinkedRef

End

 

Begin OnActivate

ObjectREF.Enable

set ObjectREF to ObjectREF.GetLinkedRef

End

 

So it works for the first time it activates the first object but after that than nothing...

Also my first object is the linkedRef for the switch and my second objec is the linkedRef for the first object and so on

I have no idea what to do so help would be appreciated.

Thx

Link to comment
Share on other sites

It's best for performance to avoid using GameMode blocks unless you have something that absolutely needs to happen every frame. Try this:

SHORT CurrentObject

REF Obj1REF
REF Obj2REF
REF Obj3REF

BEGIN OnActivate

set Obj1REF to GetLinkedRef
set Obj2REF to Obj1REF.GetLinkedRef
set Obj3REF to Obj2REF.GetLinkedRef

if CurrentObject == 0
 Obj1REF.enable
 Obj3REF.disable
 set CurrentObject to 1
elseif CurrentObject == 1
 Obj2REF.enable
 Obj1REF.disable
 set CurrentObject to 2
else
 Obj3REF.enable
 Obj2REF.disable
 set CurrentObject to 0
endif

END
Link to comment
Share on other sites

  • 1 month later...

 

It's best for performance to avoid using GameMode blocks unless you have something that absolutely needs to happen every frame. Try this:

SHORT CurrentObject

REF Obj1REF
REF Obj2REF
REF Obj3REF

BEGIN OnActivate

set Obj1REF to GetLinkedRef
set Obj2REF to Obj1REF.GetLinkedRef
set Obj3REF to Obj2REF.GetLinkedRef

if CurrentObject == 0
 Obj1REF.enable
 Obj3REF.disable
 set CurrentObject to 1
elseif CurrentObject == 1
 Obj2REF.enable
 Obj1REF.disable
 set CurrentObject to 2
else
 Obj3REF.enable
 Obj2REF.disable
 set CurrentObject to 0
endif

END

Is this c++? And can I use Java coding if I bring my extension files and parameters into it?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...