Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×

Retardinator

Member
  • Content Count

    7
  • Joined

  • Last visited

  • Medals

Community Reputation

1 Neutral

About Retardinator

  • Rank
    Rookie
  1. Retardinator

    CreateUnit on trigger position

    That's awesome. I'll try grouping markers during runtime, but if that doesn't work this'll definitely help. Thanks a lot. For some clarification - I'm trying to build a spawn system that checks if the player is within a certain range (distance) of a spawnpoint and if he is that spawn becomes 'viable' for spawning units and is added to an array. The script then uses some sort of algorithm (still working on it) to spawn units at random 'viable' spawns (but not in a completely random way, hence algorithm). If the player gets too far from the spawnpoint, it is removed from the array. This is so I can spawn lots of units that are relevant (close) to the player and both remove the units and disable the spawns when the player gets too far. This is so you don't have units spawning 2 islands away and wasting resources, while also giving the illusion of high population. Either way, this was very helpful.
  2. Retardinator

    CreateUnit on trigger position

    Technical question: Can you add or remove markers to/from the gamelogic's group via scripts (while the mission is already running, and I'm talking about pre-placed markers on the map, not newly created ones)?
  3. Retardinator

    CreateUnit on trigger position

    Pretty much. It's supposed to be a lot of triggers for random spawns and I've done something similar before by combining triggers and markers, so I'm trying to find a more "universal" way to do it with only one thing placed on the map. Since that doesn't seem to work I guess I'll have to do it the old fashioned way ;) It could also save me a lot of headaches later when saving just one entity into an array, instead of arrays of arrays of stuff so I can keep track of both markers and triggers.
  4. Retardinator

    CreateUnit on trigger position

    Doesn't seem to work. Either returns 'scalar bool array' thing when I just use thisTrigger, or 'array' for getPos/position thisTrigger when I try to output to a hint directly from the init line.
  5. So basically, I'm trying to spawn a unit on a trigger's exact location, and it seems to work when I use the trigger's name directly (getPos Trigger1, for example). However, I need to be able to spawn a unit at its location regardless of name and when i use anything other than the trigger's exact name I can't get the right position (the unit spawns about 200-300m away from it). This is the trigger's init line: Location is an empty array used for storing spawn triggers' positions. And this is the code used for spawning: Note that everything works when referencing the trigger by name, but breaks down when using anything else (getPos this and other variations). My guess is that the problem is in the trigger's init line, where "this" doesn't work as it's supposed to, and instead of returning the position of the trigger, returns something else entirely (although they are valid [x,y,z] coordinates, they're way off the original position). Any help with this is much appreciated.
  6. Retardinator

    eventHandler "killed" and other problems

    This seemed to mess up the code at parts where I had to assign an object to a variable. I guess I could've used an existing object (which didn't cross my mind at the time), but instead I used quotation marks and the game would refer to it as a string, obviously. The vehicles haven't been introduced at this point, since I'm trying to sort out problems with infantry only for the time being. As for the two players killing each other at the same time, I thought about it, and since it is a gamemode that's a bit slower in terms of killing, I thought that having the variables mess up every once in a while wasn't a bad tradeoff as opposed to allocating memory for every one of the four players and working from there. I did think about it, though. And the objects are units named in the editor (Player1-4). I am aware of the client/server side executing of scripts, which is mainly why I broadcast all the important variables to all the clients and start the scripts that should run everywhere with the sendmessage variable. From there it's just supposed to check whether a certain client (the player variable, which is local to each client) is the killer (which is broadcasted via killer_integer) and then give the cash. This might actually solve the whole thing, so I'll try with that first and, if it doesn't work, I'll try everything else that you mentioned. Either way, thanks a lot for the reply. I'll check out MW Crisis and see if I can dig up anything else to potentially help me if I hit another roadblock. I'll be giving this a go when I catch enough time to restructure the code. Edit: Also, I think if each client ran a variable-checking loop it might work just fine. Never thought to solve it that way.
  7. Hey guys. Since I've been struggling with a scripting problem for days, I decided to take it here and see if anyone can come up with a solution. Basically, I'm trying to make some scripts which will do a titleText on every client when somebody is killed and give some cash to the killer. All the variables that have something to do with the scripts I'm using: SendVariables.sqs, which is used to "convert" players into integers so publicVariable can broadcast them. This is used on a player unit's init line with addEventHandler ["killed", {[_this select 0, _this select 1] exec "SendVariables.sqs"}] ReceiveVariables.sqs, which is executed by a trigger placed in the editor with the sendmessage==1 condition. It's supposed to "convert" the integers back into player names, display the titleText, and, unless the player suicided, execute the GiveCash.sqs script with the name of the killer as the argument. And finally, here's the GiveCash script, which is supposed to give cash to the killer and add to his score. (I tried to do it in other ways, like with the local check, but it didn't work. I'm not sure if I did it right, though) Now, the problem isn't that some of this is chucking out an error or that perhaps i misspelled a variable name. It actually works, sort of. The titleText says exactly what it should say and the cash is added to a player. But the problem is that in about 60% cases the victim(the guy that was killed) receives the money. Also, titleText only shows up on the victim's PC. In about 30% of the cases the cash is given to the host/server, even though he had nothing to do with the kill. Not sure about whether titleText shows up on his PC. In just about 5-10% of the cases the killer receives the cash and the titleText, which is supposed to be shown across all clients. I also did a trigger which checks whether the player is dead and, if he is, it waits 21 seconds (respawn time is 20 secs) and re-attaches the eventHandler. Could anyone help me out on this? Note: If you're willing to try this out for yourself, don't forget to make a script that prints out the cash into a hint every x seconds. I might also point out that everything works fine in singleplayer, but gets messed up in multiplayer.
×