• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Need help with a shooting system!

Status
Not open for further replies.
Level 4
Joined
Apr 11, 2007
Messages
97
Hi there!

I'm looking for a system were you can fire with the keyboard,
For instance with space or Z.

I need it for a "platform" arrow-key steered game.

Since I use the arrow-keys I can't use them for the shooting trigger so if anyone know how to do it I would appreciate the help! (and give +rep ofc).

Thank you in advance,
Simon559.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
You don't need JASS :/
You just need to make a spell with Z as hotkey.

Space is impossible.
(Not impossible actually, but just not doable for your game).

If you really want to detect keys, you'll have to add more natives to the common.j-file, import it and then you can use them in JNGP, if you know JASS of course.
I still don't think that includes spacebar, but I am not 100% sure.
 
Level 4
Joined
Apr 11, 2007
Messages
97
Well the thing is that the game is based that you dont have the unit targeted since it was possible to move with the mouse then >.< which ruined it :p But if anyone can help me solve that it would be no problems I think :)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
You don't have to select your ship though...
You can select a dummy (with triggers) which has those spells (shoot and everything else you need).
This dummy will be somewhere in the corner of the map and doesn't necessarily need a model.

So:
  • Selection - Select Peasant 0000 <gen>
To avoid players clicking on other units, you can add "Locust" to the unit you're playing with.
This is so you always have that dummy selected.
 
Level 4
Joined
Apr 11, 2007
Messages
97
Oh ty didn't think of that!

But I don't get the thing with locust? (sorry for being slow)
Is there anyway to describe it more :p?
 
Level 4
Joined
Apr 11, 2007
Messages
97
I see I will give it a try :)

If it doesn't work I could post the map to a post here and if you'd like/want you could add it? (if I'm not able)
 
Level 4
Joined
Apr 11, 2007
Messages
97
Well I managed to make them none-target able with clicking. But you can target them through "drawing a window". And I dunno how to make the unit I'm moving around to attack when I use an ability on the dummy unit.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Like in the attached map, probably ^^
Sorry for the custom scripts, I'm used to working with JASS now and the GUI-forms would've been less efficient and drained too much time (laziness :/).

This is actually what I thought you wanted (you know, when you press T a missile will fire).
If you now make that knight in my map the dummy in the corner of your map and change the special effects etc, it might work, or not? :p

Update:
  • Added AoE-variable.
  • Added max. number of targets.
 

Attachments

  • MissileDemo.w3x
    17.3 KB · Views: 73
Last edited:
Level 4
Joined
Apr 11, 2007
Messages
97
Exactly what I wanted! :) Thank you very much :) (thank you for your time and for the trigger :)) I will ofc give credits in map and give you a +rep :)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Yes, yes there is... I guess I forgot to make a variable for that, didn't I? :D

It's in the trigger "Loop".
You should see this line somewhere (the 5th action in the group):
  • Set TempGroup = (Units within 100.00 of TempLoc2 matching (((Matching unit) belongs to an enemy of (Load 4 of HandleID in SpearTable)) Equal to True))
Set the "100.00" to the area you want :D
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Okay, it's done... I think.
Well, after initial testing I didn't notice anything out of the ordinary.

Fact is that the system is a lot heavier now (because I had to store the units it already hit, otherwise every unit could get hit multiple times by the same missile O_O).
The maximum number of targets is 100, I hope that's enough :D (I added this limit because otherwise it could get too heavy, I really hope it doesn't get over 20 though).
I tried to use as much JASS as possible, because pure-GUI this would've been a nightmare for warcraft.

Edit: oh yeah, you can download the updated system in one of my previous posts (the one with the attachment).
 
Level 4
Joined
Apr 11, 2007
Messages
97
Hmm the new "loop" trigger doesn't work. I get an error while I tried to save.
Here it is: set udg_TempUnit2 = LoadUnitHandle(udg_SpearTable, udg_HandleID, 8+udg_TempInt)

Solved it
 
Status
Not open for further replies.
Top