Jump to content
Pottyscotty

Siren Script Crash

Recommended Posts

Hi all,

 

I added a new siren to my LASiren script but it creates an error when I try to load my mod. I can't find out what is wrong considering I copied it from one of the other "else if" functions.

 

M3V6vJ.png

 

Lines 227 to 237 is the new code.

 

http://pastebin.com/wuGuhBRh

Link to comment
Share on other sites

There's a pretty glaring error in your code.

 

This is how it looks like:

else if (StrCompare(v.GetPrototypeFileName(), PROTO_MAN_IRU) == 0 ||

 

This is how it should be:

else if (StrCompare(v.GetPrototypeFileName(), PROTO_MAN_IRU) == 0)

 

The first statement is registered as an OR then it has no terminating close parenthesis, so the game crashes

 

Below, the correct code shows that there is no need for an OR because there is only a single prototype comparison. It has the proper close parenthesis appended next to the zero.

 

Your mistake is there.

Link to comment
Share on other sites

Rookie mistake, always close your parenthesis :P

Its forgivable. Siren scripts are the places where most beginners start off. So its common to make mistakes there because most are starting out.

 

Now things like enums, funcions and structures, those are places that you can get to once you start understanding Em4 scripting. This is an excerpt from something secret I've been working on.

enum CALLOUT_TYPE{	CALLOUT_FIRE,	CALLOUT_MEDICAL,	CALLOUT_POLICE,	CALLOUT_NONE,};enum CALLOUT_STATE{	CALLOUT_PASSED,	CALLOUT_FAILED,	CALLOUT_RUNNING,	CALLOUT_IDLE,};struct CalloutData{	int calloutID;	int subEventID;	int calloutState;};void RandomGangsterAnimation(Person p){	int randAnim = rand()%6; //random anims for each dealer	switch(randAnim) 	{		case 0:		case 1:		case 2:			p.PushActionSwitchAnim(ACTION_APPEND, "dealerwaiting2");		break;		case 3:		case 4:			p.PushActionSwitchAnim(ACTION_APPEND, "observe");			break;		case 5:			p.PushActionSwitchAnim(ACTION_APPEND, "talkto");			break;	}}
Link to comment
Share on other sites

There's a pretty glaring error in your code.

 

This is how it should be:

else if (StrCompare(v.GetPrototypeFileName(), PROTO_MAN_IRU) == 0)

I actually can't believed I missed that, with the other ones I was always careful to make sure they were closed properly, thanks!

 

Rookie mistake, always close your parenthesis :P

I'll definitely remember now :P

Link to comment
Share on other sites

 

Its forgivable. Siren scripts are the places where most beginners start off. So its common to make mistakes there because most are starting out.

 

Now things like enums, funcions and structures, those are places that you can get to once you start understanding Em4 scripting. This is an excerpt from something secret I've been working on.

enum CALLOUT_TYPE{	CALLOUT_FIRE,	CALLOUT_MEDICAL,	CALLOUT_POLICE,	CALLOUT_NONE,};enum CALLOUT_STATE{	CALLOUT_PASSED,	CALLOUT_FAILED,	CALLOUT_RUNNING,	CALLOUT_IDLE,};struct CalloutData{	int calloutID;	int subEventID;	int calloutState;};void RandomGangsterAnimation(Person p){	int randAnim = rand()%6; //random anims for each dealer	switch(randAnim) 	{		case 0:		case 1:		case 2:			p.PushActionSwitchAnim(ACTION_APPEND, "dealerwaiting2");		break;		case 3:		case 4:			p.PushActionSwitchAnim(ACTION_APPEND, "observe");			break;		case 5:			p.PushActionSwitchAnim(ACTION_APPEND, "talkto");			break;	}}

Is that secret some kind of a drug deal bust event?

So why the empty cases? To have a chance of animation not changing, or are they supposed to be filled later?

Link to comment
Share on other sites

Is that secret some kind of a drug deal bust event?

So why the empty cases? To have a chance of animation not changing, or are they supposed to be filled later?

The blank cases mean that those 3 cases will have the same outcome.

 

So 0, 1 and 2  will have "dealerwaiting" animation, and 3 and 4 will have the "observe" one.

 

I'm making some kind of special thing that won't be released due to the current situation.

Link to comment
Share on other sites

The blank cases mean that those 3 cases will have the same outcome.

So 0, 1 and 2 will have "dealerwaiting" animation, and 3 and 4 will have the "observe" one.

I'm making some kind of special thing that won't be released due to the current situation.

Oh, that's handy. Never used cases, though. A bunch of "else if"s is how I roll :D.

It's a shame, what happened to community. And all because someone didn't take five minutes out of their time to write proper credits. Well, and thought it's right that way.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...