timmiej93 Posted July 27, 2014 Report Share Posted July 27, 2014 As the title states, I'm wondering how the childID's work, specifically in the ToPoliceStation script. I've got a general idea, but I don't know how they work. Tim Quote Link to comment Share on other sites More sharing options...
itchboy Posted July 27, 2014 Report Share Posted July 27, 2014 ChildID's are essentially divisions of the main script. Each ChildID is a predefined set of conditions for the script to execute. It is used in conjunction with thev.PushActionExecuteCommand() function. Note the number that is before false or true.Example:v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false);This means that the script will execute that command in its first child.Its logic is like this:if (ChildID == 1){ Do some stuff}else if (ChildID == 2){ Do other stuff different from the first}You can use the PushActionExecuteCommand to execute a specific child in the script, or in other scripts. The important thing is that number. Quote Link to comment Share on other sites More sharing options...
timmiej93 Posted July 27, 2014 Author Report Share Posted July 27, 2014 Aaah, now it's kinda clear to me, thanks. I'll go messing around with them, see if I can get them to werk and if I really understand them. Tim Quote Link to comment Share on other sites More sharing options...
timmiej93 Posted July 27, 2014 Author Report Share Posted July 27, 2014 One little question I'm finding right now: In a script, say it looks like this if(StrCompare(v.GetPrototypeFileName(), OBJ_VAN) == 0) { PersonList transports = v.GetTransports(); if (transports.GetNumPersons() > 0) v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false); elseDoes the script "jump" to the ChildID=1 section straight after the line "v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false);", or does it finish something first? Tim Quote Link to comment Share on other sites More sharing options...
Chris07 Posted July 27, 2014 Report Share Posted July 27, 2014 Assuming that we're in CMD_TOPOLICESTATION right now... Well since you are using a PushAction, it will execute CMD_TOPOLICESTATION, but it will not pause the execution of the rest of the script in which it is called, unless you add another action to the PushAction queue, in which case that action will execute after CMD_TOPOLICESTATION has been executed. PushAction is a Queue which is processed separate of the rest of the script. It is relatively instant unless your caught behind a PushActionWait in which case you should probably start an ACTION_NEWLIST if you don't want to wait. Quote Link to comment Share on other sites More sharing options...
timmiej93 Posted July 27, 2014 Author Report Share Posted July 27, 2014 This is indeed the CMD_TOPOLICESTATION command So if I understand correctly, below script should tell the Van to do whatever is stated under ChildID=1 whenever it has transports in it, and when it doesn't, it parks at Donut, right?if(StrCompare(v.GetPrototypeFileName(), OBJ_VAN) == 0){ PersonList transports = v.GetTransports(); if (transports.GetNumPersons() > 0) v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false); else { Park at Donut; }} Quote Link to comment Share on other sites More sharing options...
Chris07 Posted July 27, 2014 Report Share Posted July 27, 2014 It should. Looks good to me, However, I often find out the hard way I'm wrong!I would probably use ACTION_NEWLIST instead of ACTION_APPEND so that it is in its own queue and won't get stuck behind another command. Quote Link to comment Share on other sites More sharing options...
timmiej93 Posted July 27, 2014 Author Report Share Posted July 27, 2014 Thank you sir, you've clarified a lot.I've got many more questions about the script I'm working on, but they don't fit this topic unfortunately. Too bad, because you seem to know a lot about it. Hopefully you'll find my other topics too! Tim Quote Link to comment Share on other sites More sharing options...
timmiej93 Posted July 31, 2014 Author Report Share Posted July 31, 2014 Hello Chris,Sorry to bother you again, but I'm running into trouble. I've got a script set up like seen below, but for some reason the game just ignores me when I call the command from the VAN, and it just goes to ChildID 1, straight below this piece of code, instead of ChildID2. Any idea how this can be?Or is it just my misunderstanding?if (StrCompare(v.GetPrototypeFileName(), OBJ_VAN) == 0 || StrCompare(v.GetPrototypeFileName(), OBJ_SUV == 0) || StrCompare(v.GetPrototypeFileName(), OBJ_CRUISER04) == 0 || StrCompare(v.GetPrototypeFileName(), OBJ_CRUISER01) == 0){ v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 2, false); Mission::PlayHint("1"); return;}else if (v.GetVehicleType() == VT_POLICE_PHC){ v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 3, false); return;}else{ v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false);}I'm assuming that after a PushAction to ChildID2, the script continues from there right?So below script (simplified ofcourse) should give everybody treats and just skip blowing up the vehicle right?v.PushActionExecuteCommand(ACTION_APPEND, CMD_TOPOLICESTATION, Caller, 1, false);if(ChildID==0);{ Blow up vehicle}if(ChildID==1);{ Give everybody treats}; Quote Link to comment Share on other sites More sharing options...