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 Why is this not functioning correctly?
Pshyched Offline
Member

Posts: 130
Threads: 21
Joined: Nov 2012
Reputation: 5
#1
Why is this not functioning correctly?

Okay, I am trying something new in the editor, and I am wonder why this is not working..

PHP Code: (Select All)
    void ReplaceOrb(string &in AsParentstring &in AsChildint &in AlState)
    {
        
AddTimer("Wait"0.5"ReplaceOrbTimer");
        
AddTimer("Replace"1.0"ReplaceOrbTimer");
    }
    
void ReplaceOrbTimer(string &in asTimer)
    {
        
string x asTimer;
        if (
== "Wait")
        {
            
SetEntityActive("RealmOrb"false);
            
SetMessage("Messages""DropOrb"0);
        }
        if (
== "Replace")
        {
            
CreateEntityAtArea("RealmOrb""orb_grab.ent""ScriptArea_1"true);
        }
    } 

Everything runs smoothly in game, but as it creates another entity under the name of "RealmOrb" i think its creating it as "RealmOrb_1" so the rest of the scripting remains useless. Is there a way to make it not change its name? As you can see, I made a wait timer so it would try not too, But ofcourse, It wont work because Im only making the Previous Entity Inactive. I don't think there is a RemoveEntity script function within the game. Unless I am mistaken?
06-30-2013, 09:38 AM
Find Reply
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Why is this not functioning correctly?

No you can't. Every thing ends with _1 and the number changes as you copy it.

"Veni, vidi, vici."
"I came, I saw, I conquered."
06-30-2013, 11:58 AM
Find Reply
Pshyched Offline
Member

Posts: 130
Threads: 21
Joined: Nov 2012
Reputation: 5
#3
RE: Why is this not functioning correctly?

Any idea on how I would get around this?
06-30-2013, 12:01 PM
Find Reply
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Why is this not functioning correctly?

I doubt the game is renaming the newly-created entity but that the game is searching for the entity in some kind of order-by-creation list, therefore the one in the map first is the one found first when calling SetEntityActive. Try using a local map variable of type int to keep track of the number of orbs created, so that you can increment the name of the orb.

Tutorials: From Noob to Pro
06-30-2013, 12:11 PM
Website Find Reply
Pshyched Offline
Member

Posts: 130
Threads: 21
Joined: Nov 2012
Reputation: 5
#5
RE: Why is this not functioning correctly?

Uhhh, How would I implement that?
06-30-2013, 01:27 PM
Find Reply
Wapez Offline
Senior Member

Posts: 360
Threads: 37
Joined: Mar 2012
Reputation: 19
#6
RE: Why is this not functioning correctly?

It seems as you already have a "RealmOrb" in the map, and therefore you set it unactive with the "wait" timer. Since you don't REMOVE the first orb, you just set it to UNACTIVE, it remains in the map. The next "RealmOrb" put in the map, will then be renamed to "RealmOrb_1", since an entity with the name "RealmOrb" is already existing.

Why not just name the new orb (That you CREATE with the "replace" timer) "RealmOrb_1", and coordinate your script after that?

Or just rename the first orb to something else. That way the orb you CREATE won't change names.

Founder & Legally Accountable Publisher of Red Line Games.
Environment & Gameplay Designer and Scripter.
http://moddb.com/mods/in-lucys-eyes
(This post was last modified: 06-30-2013, 04:32 PM by Wapez.)
06-30-2013, 04:26 PM
Find Reply
Pshyched Offline
Member

Posts: 130
Threads: 21
Joined: Nov 2012
Reputation: 5
#7
RE: Why is this not functioning correctly?

I need to have it so if the player drops the RealmOrb, it reverts back to its original script. But the RealmOrb is also used in other scripts too. Is there a way to set it as a Variable or something, so I can just set and update the variable to my scripts. That would make things 100x easier.
06-30-2013, 04:47 PM
Find Reply
Wapez Offline
Senior Member

Posts: 360
Threads: 37
Joined: Mar 2012
Reputation: 19
#8
RE: Why is this not functioning correctly?

Instead of creating a new orb, you can simply reset the original one using the function below, returning it to it's original position and state.

void ResetProp(string& asName);

Founder & Legally Accountable Publisher of Red Line Games.
Environment & Gameplay Designer and Scripter.
http://moddb.com/mods/in-lucys-eyes
06-30-2013, 06:26 PM
Find Reply




Users browsing this thread: 1 Guest(s)