Nexus Skirmisher
Nexus Modding => Scripting => Topic started by: Arparso on August 15, 2009, 14:27:57
-
Anyone found a clever way to store values in array-like structures?
Basically I've got at least three MACHINEs. One of them calls an event, that the other two implemented. I'm also delivering a certain playerID event variable with that event call. Based on that playerID variable only one of the other two MACHINEs is supposed to respond. That means both MACHINEs need to know the playerID they're supposed to respond to. However, they should be able to respond to more than one playerID. In a real programming language I'd simply store the playerIDs in an array and check, if the supplied playerID is in that array, but Nexus scripting doesn't know arrays. I've tried it with selections and AddItem(), but they expect objects, not values - especially not numbers.
Any idea for an elegant solution?
-
How viable would it be to have a rule that'd create a navpoint and assign it a player id? As far as I'm aware, there's no limit on the number of NP's that you can have and they only show up in the game if requested.
Might not be elegant, but it would give you an object to go with the name.
-
Hmm... nice idea, but how would I create a navpoint during the mission? I can only create objects using CreateShip() and that expects a shiptype and not a shipclass and I don't want to touch the tacticstypes.ini :(
-
create navig points? that's the easiest! just use the AddNavigPoint( command :)
for example:
Nav1:= AddNavigPoint("waipoint 1", -16824, 16045, 30126, 1,1,1, #race_player);
as far as I'm concerned they can be created in-mission.
-
I long this is long overdue, but even though there aren't any arrays in nexus, you can use lists instead:
Dim(list number);
Empty(list);
ClearSelect(list); //they "free", delete, the given list
setN(list, place, element); //it adds an element on that place (I think it only handles numbers... but I never gave it a thorough test)
getN(list, place);
pickN(list,place); //they returns the element located on "place"
and many more ADT functions. Although not arrays, they're close enough.