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
Weird error
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#1
Weird error

I'm trying to get a door open itself when a player walks trough an area:

Script:
void OnStart()
{
    AddEntityCollideCallback("Player", "Scriptarea_1", "dooropen", true, 0);
}

void dooropen(string &in asParent, string &in asChild, int alState)
{
    SetSwingDoorDisableAutoClose("mansion_1", true);
    SetSwingDoorClosed("mansion_1", false, false);
    
    for (int i = 0; i = 10; i++)
    {
    AddPropForce("mansion_1", 800, 0, 0, "world");
    }

}

I copied everything from here, so that shouldn't be the problem.
But everytime I try to reload or enter the map, this happens:

main (6, 1) : INFO : Compiling void dooropen(string&in, string&in, int)
main (11, 18) : ERR : Expression must be of boolean type

I've tried everything but I just can't see the error... I used these commands on other maps and they always worked. Could someone help me out?
02-21-2013, 03:38 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Weird error

I'm not sure but i think the for-script should be like this:



for (int i = 0; i = 10; i++) AddPropForce("mansion_1", 800, 0, 0, "world");

And then you need +i somewhere inside AddPropForce

Trying is the first step to success.
(This post was last modified: 02-21-2013, 03:53 PM by FlawlessHappiness.)
02-21-2013, 03:52 PM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#3
RE: Weird error

(02-21-2013, 03:52 PM)BeeKayK Wrote: I'm not sure but i think the for-script should be like this:



for (int i = 0; i = 10; i++) AddPropForce("mansion_1", 800, 0, 0, "world");

And then you need +i somewhere inside AddPropForce

That isn't the problem.. I used it this way before and it worked.. It has to be something else or a bug..
02-21-2013, 04:39 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Weird error

Well it is the for script it is referring to...

Trying is the first step to success.
02-21-2013, 06:50 PM
Find
tonitoni1998 Offline
Member

Posts: 163
Threads: 54
Joined: Oct 2012
Reputation: 1
#5
RE: Weird error

im sorry, but im curious what you need a loop for. why dont you just let it open when he walks into the area. is there any reason? im just learning right now and maybe this is a special way to do someting and it might get useful for me Smile

When you are looking for someone, to do the scripting for your Custom Story, ask me!
02-21-2013, 07:03 PM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#6
RE: Weird error

(02-21-2013, 07:03 PM)tonitoni1998 Wrote: im sorry, but im curious what you need a loop for. why dont you just let it open when he walks into the area. is there any reason? im just learning right now and maybe this is a special way to do someting and it might get useful for me Smile

It's just a bit more smooth.. AddPropForce just gives it 1 blast.

(02-21-2013, 06:50 PM)BeeKayK Wrote: Well it is the for script it is referring to...

I noticed that, but I got it from this tutorial, and it worked before. I changed nothing. But where do I have to put the i+ then?
(This post was last modified: 02-21-2013, 09:14 PM by OriginalUsername.)
02-21-2013, 09:12 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#7
RE: Weird error

The issue is that your for loop has a variable assignment for the second expression where it requires a boolean operator or something that returns true or false.

In other words, for (int i = 0; i = 10; ++i), the bold part is the problem. The assignment operator is not a boolean operator, so it doesn't return true or false. If you had < or <= instead of =, then it would work.

Tutorials: From Noob to Pro
(This post was last modified: 02-21-2013, 09:44 PM by Your Computer.)
02-21-2013, 09:43 PM
Website Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#8
RE: Weird error

(02-21-2013, 09:43 PM)Your Computer Wrote: The issue is that your for loop has a variable assignment for the second expression where it requires a boolean operator or something that returns true or false.

In other words, for (int i = 0; i = 10; ++i), the bold part is the problem. The assignment operator is not a boolean operator, so it doesn't return true or false. If you had < or <= instead of =, then it would work.

Thank you! It worked right away
02-22-2013, 12:34 AM
Find




Users browsing this thread: 1 Guest(s)