Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-12-2006, 04:16 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Mouse Control

I'm working on an NPC that will allow the player to use the mouse to move. The movement works, but I was thinking of adding more. First off, I need it to be able to fire the selected weapon when the mouse wheel is moved, then I need it to make the player pick up pbjects when the mouse wheel (or third button) is pressed. I thought it was just mousewheel and centermousebutton, but they didn't work, and I'm not sure how to work callweapon or get the player to lift objects with script. (Like pressing A)
Reply With Quote
  #2  
Old 04-12-2006, 09:47 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Current Problems: (sorry for double post, but I'm stumped and the thread is getting little attention )
-Sword needs to cut bushes
-Need an 'action' button (lifting pulling)
-needs to check if player is paused/dead
-weaponfired
-swiching weapons (like S+D)
Reply With Quote
  #3  
Old 04-13-2006, 07:52 AM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
Quote:
Originally Posted by excaliber7388
Current Problems: (sorry for double post, but I'm stumped and the thread is getting little attention )
-Sword needs to cut bushes
-Need an 'action' button (lifting pulling)
-needs to check if player is paused/dead
-weaponfired
-swiching weapons (like S+D)
For sword needing to cut bushes i could have swore all you need to do is setgani to sword, and the game takes care of the rest. Ex, setting to sword gani will damage another player.

Your origional "centermousebutton" problem is solved really easily, Left, Right....Middle
NPC Code:

If (middlemousebutton) {



you can check if the mousewheel is being scrolled by using mousewheeldelta < .5 or > .5 for up and down.

For paused/dead have fun with that one, I would sugest you take a look at Massokres threads of him having trouble with it as well, probably not to hard to make something to emulate paused at the least since you have redone the entire system. Dead either as far as thats concerned.

Callweapon to call weaponfired on another button press or whatever (pretty sure this should work) just make sure the index is the currently selected weapon.

Same for S+D Weapon switching you could do like currentweapon+1 and set selectedweapon to that, and when it reaches the max (weaponscount) just set it back to the first weapon.

I should really be in bed already i hope some of this helps you out.
Reply With Quote
  #4  
Old 04-13-2006, 04:46 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Yeah, most of that helps, I have the sword gani, but this doesn't cut bushes, and I still have no idea of how I would make the player do the lifting/pulling action (A) button. And neither mousewheel or mousewheeldelta are working
And how would I make it detect a warp? And how do you se the players weapon to a certain weapon???

Last edited by excaliber7388; 04-13-2006 at 06:15 PM..
Reply With Quote
  #5  
Old 04-13-2006, 08:39 PM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
Quote:
Originally Posted by excaliber7388
Yeah, most of that helps, I have the sword gani, but this doesn't cut bushes, and I still have no idea of how I would make the player do the lifting/pulling action (A) button. And neither mousewheel or mousewheeldelta are working
And how would I make it detect a warp? And how do you se the players weapon to a certain weapon???
NPC Code:

if (timeout) {
if (mousewheeldelta > 0) {
setplayerprop #c,I moved the mousewheel down;
}
if (mousewheeldelta < 0) {
setplayerprop #c,I moved the mousewheel up;
}
timeout = .05;
}



Mousewheel.

For the bush cutting I will try to help you later, I am getting ready to leave class and I wont have access to a PC Again till I get home
Reply With Quote
  #6  
Old 04-13-2006, 09:06 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
oh within a timeout? didn't think of that XD
Yeah the bush cutting/lifting is the bigest problem now, as well as the weapon switching, I don't know how to set a player's weapon
Reply With Quote
  #7  
Old 04-13-2006, 09:28 PM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
Quote:
Originally Posted by excaliber7388
as well as the weapon switching, I don't know how to set a player's weapon
Hello again ive combined a few things for you to look at

NPC Code:

if (keypressed) {
if (keydown2(keycode(r),true)) {
for (i=0;i<weaponscount;i++) {
if (strequals(#w(i),Bomb)) {
selectedweapon = i;
}
}
}
}



Basically its just going through Indexes of the weapons until it finds bomb, then setting "Selectedweapon" to Bomb.

You could use it probably for a whole inventory system by just setting a string like "Equipped Weapon" and replacing bomb with your string to always set it.

Good Luck.
Reply With Quote
  #8  
Old 04-14-2006, 12:42 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
For calling a weapon, as in weaponfired, you'll want to use findweapon(weaponname).trigger("WeaponFired",NULL) ;
If you're GS1, callweapon weaponindex,weaponfired;
Reply With Quote
  #9  
Old 04-14-2006, 01:09 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
callweapon selectedweapon,weaponfired; would be more appropriate in this case, I believe.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #10  
Old 04-17-2006, 08:55 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
I still can't get mousewheeldelta to work, and I don't know how to do the action, bush slashing, but everything else on my list has been fixed
Reply With Quote
  #11  
Old 04-17-2006, 10:31 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by excaliber7388
I still can't get mousewheeldelta to work, and I don't know how to do the action, bush slashing, but everything else on my list has been fixed
What exactly is not working with your mousewheeldelta?
__________________
Skyld
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.