Pottyscotty Posted June 25, 2015 Report Share Posted June 25, 2015 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. Lines 227 to 237 is the new code. http://pastebin.com/wuGuhBRh Quote Link to comment Share on other sites More sharing options...
itchboy Posted June 25, 2015 Report Share Posted June 25, 2015 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. Quote Link to comment Share on other sites More sharing options...
Handsup! Posted June 25, 2015 Report Share Posted June 25, 2015 Rookie mistake, always close your parenthesis Quote Link to comment Share on other sites More sharing options...
itchboy Posted June 25, 2015 Report Share Posted June 25, 2015 Rookie mistake, always close your parenthesis 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; }} Quote Link to comment Share on other sites More sharing options...
Pottyscotty Posted June 25, 2015 Author Report Share Posted June 25, 2015 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 I'll definitely remember now Quote Link to comment Share on other sites More sharing options...
Ace612 Posted June 25, 2015 Report Share Posted June 25, 2015 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? Quote Link to comment Share on other sites More sharing options...
Handsup! Posted June 25, 2015 Report Share Posted June 25, 2015 Of course, I wouldn't even know how to do a siren script. I mainly stick with basic C languages Quote Link to comment Share on other sites More sharing options...
itchboy Posted June 25, 2015 Report Share Posted June 25, 2015 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. Quote Link to comment Share on other sites More sharing options...
Ace612 Posted June 26, 2015 Report Share Posted June 26, 2015 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 .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. Quote Link to comment Share on other sites More sharing options...