|
Post by Quintaxel on Sept 2, 2018 19:53:49 GMT 1
Does anyone know how to assign a ScriptID to paratrooper once they are on the map ? I need to control paratroopers through script but therefore these paratroopers need to have a ScriptID.
|
|
|
Post by keepitsimple on Sept 2, 2018 21:03:41 GMT 1
The command:
SetIGlobalVar("ParadropSquad.ScriptID", 999);
|
|
|
Post by Quintaxel on Sept 2, 2018 21:37:14 GMT 1
Thx keepitsimple, but what if I need to assign a ScriptID to paratroopers belonging to iParty0 and iParty1. So the script drops a squad of paratroopers belonging to the AI side and the player drops a squad of paratroopers belonging to the iPlayer side. Once on the ground both squads should have a different ScriptID. Would this be possible ? If I declare the Global variable - SetIGlobalVar("ParadropSquad.ScriptID", 999); - then I guess that every squad dropped from an airplane will have the ScriptID 999, right ? As far as I know there's no BK function to change the ScriptID of a units. If there were then I could check the status of the units with ScriptID 999 and change their ScriptID once they have landed on the ground. The variable ParadropSquad.ScriptID is one of the BK global variables. Do you know of any others. Is there a list of global variables used in BK ?
|
|
|
Post by Kevin on Sept 2, 2018 22:02:57 GMT 1
This is what Calvin's guide says:
|
|
|
Post by Quintaxel on Sept 2, 2018 22:27:45 GMT 1
Thanks Kevin I read this. No problem for a single squad of paratroopers. But this also means, as I understand it, that only 1 ScriptID can be assigned to Paratroopers. I even doubt (I have not yet tested it) that the ScripID 999 will only assigned to the paratroopers for the time they are airborne (Unit state 27).
|
|
|
Post by Kevin on Sept 2, 2018 22:43:21 GMT 1
I think the 999 ScriptID is just an example but, to be honest, it's being a long time since the last time I scripted anything (Blitzkrieg related).
|
|
|
Post by Quintaxel on Sept 3, 2018 6:28:48 GMT 1
Yes, I think the ScriptID could be any number. I have do some tests a soon as I find the time.
|
|
|
Post by Quintaxel on Sept 3, 2018 21:37:21 GMT 1
Did some tests. According to Calvin's guide the ScriptID for paratroopers should declared in the function Init ()
function Init () SetIGlobalVar("ParadropSquad.ScriptID", 999);
end;
This will indeed assign a ScriptID (999 in this case) to the paratroopers. The ScriptID can be any number, so 999 is just an example.
Problem is that each squad of paratroopers will get the same ScriptID 999. So if you want to assign a different ScriptID each squad of paratroopers then you should assign the global variable ParadropSquad.ScriptID just before you send out the transport plane with paratroopers.
Something like this;
function EnableAvia ()
EnableAviation(0, 2);
RunScript ("ParaDrop", 5000);
Suicide ();
end;
function ParaDrop ()
SetIGlobalVar("ParadropSquad.ScriptID", 200); Cmd(22, 800, 0, 1000, 1000);
Suicide ();
end;
function Init() RunScript ("EnableAvia", 5000); end;
The ScriptID of the paratroopers will be set to 200.
So far this seems to work fine in a script. When I find time then I will script a small demo.
|
|
Grot
General
Posts: 4,055
|
Post by Grot on Sept 3, 2018 21:41:05 GMT 1
|
|
|
Post by keepitsimple on Sept 3, 2018 23:40:41 GMT 1
Hi Quintaxel , You have found the solution: This should work . function Init () RunScript ("ParaDrop", 5000); RunScript ("ParaDrop2", 5000); end; -- drop para with scriptID 200 for the player at point 1000, 1000 function ParaDrop () SetIGlobalVar("ParadropSquad.ScriptID", 200); Cmd(22, 800, 0, 1000, 1000); Suicide (); end; -- and at same time drop para with scriptID 201 for the AI at point 2000, 2000 function ParaDrop () SetIGlobalVar("ParadropSquad.ScriptID", 201); Cmd(22, 800, 1, 2000, 2000); Suicide (); end;
|
|
|
Post by Quintaxel on Sept 4, 2018 6:42:44 GMT 1
Hi keepitsimple , I just wonder if assigning a global variable twice at the moment will not cause trouble. I will try it to see what happens.
|
|
|
Post by Kevin on Sept 4, 2018 22:03:38 GMT 1
No way When it comes to scripting, definitely that guide should be created by Quin, keepitsimple and/or Kaoz.
|
|
|
Post by Quintaxel on Sept 4, 2018 22:16:01 GMT 1
But we could all learn a lot when it comes to creating models, at least I could.
|
|
|
Post by Kevin on Sept 4, 2018 22:19:40 GMT 1
But we could all learn a lot when it comes to creating models, at least I could. Those videos I recently uploaded are intended to be get you into that. But maybe I should start from the very beginning.
|
|
|
Post by Quintaxel on Sept 4, 2018 22:36:58 GMT 1
I liked the video you posted but I'll stick to tinkering with scripting.
|
|