Game Development Community

casting magic with a weapon equipped

by mark romero · in Torque Game Engine · 10/05/2009 (1:50 pm) · 10 replies

hey everyone. as of now, i'm trying to shoot a fireball, no animation for it at the moment, that uses the rocket launcher projectile data with a tiny rocket and no smoke. the function should be cast when i press 1, thanks to this:
moveMap.bind( keyboard, 1, shootFire);
but i'm not sure what would go in the shootFire function itself. it needs to cast the fireball from the player as usual, but not change his weapon. any suggestions?

#1
10/05/2009 (2:42 pm)
hmm well i would suggest the skeleton pack... but what you could do, is create a weapon that simulates your spell function, then have a weapon swapping code. It can all be done in script too so its a good thing. simple have a weapon swap key, fire your spell, then swap back.

you could also create a spell casting button that temporily disables the weapon equiped and casts the spell, then reequips it.
#2
10/05/2009 (3:23 pm)
well, i wouldnt mind switching to hands or something, but the problem is i dont know how to switch weapons with a key
#3
10/05/2009 (3:57 pm)
Mark, you don't seem to own a license. How are you using TGE?
#4
10/07/2009 (1:03 pm)
well, i'm in a class at my college, we're using TGE to make a level.
#5
10/07/2009 (2:22 pm)
Can I ask you which college? Don't want to be a pita, just asking out of curiosity. Good luck with your project.
#6
10/07/2009 (2:53 pm)
northwest vista. i suppose my main question is, how can i reference the player specifically? like, %user.mountImage(), what would go in %user?
#7
10/07/2009 (3:05 pm)
%user would be the Player class object.
#8
10/07/2009 (3:15 pm)
I just realized you might be trying to do this on the client side. You will need to do the mounting on the server side, so it gets propagated to clients.
#9
10/12/2009 (1:47 pm)
ok, so, how would i do that? i'm not really good with torsion so if you could provide code that would be great
#10
10/12/2009 (5:54 pm)
Konrad - this is all script, so Mark might have been a demo user ;)

Mark - have a look in the demo folders for commandToServer. You'd need to write a server command that unmounts the current image, mounts the invisible image and fires it, plays an animation, and schedules for the invisible image to be unmounted and the old one remounted. If, of course, the character has enough mana or whatever other sanity checks you want to add in there.

[You can search in the forums for 'schedule', there's bound to be a ton of threads about it lying around.]