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 08-29-2011, 06:20 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Button Gui For Weapons

basically i want to make a button that has player.weapon.name so whatever weapon you have selected if its on weapon fired activated it would be equipable to the button gui then then the button is pressed it finds the players current weapon and fires it.
lets take for example.
iv scripted an ak47 i could easily script the box to drop it into but how would i make the button actually do onweaponfired on the current weapon?
if anyone has any suggestions there much appriciated.
thanks.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #2  
Old 08-29-2011, 06:27 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
PS: Im not asking for scripts/Script begging.
id just like to know the basics of what id have to do to accomplish this.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #3  
Old 08-29-2011, 07:05 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You can trigger the player's currently selected weapon with:

player.weapon.trigger("WeaponFired", "");
__________________
Quote:
Reply With Quote
  #4  
Old 08-29-2011, 07:08 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
wow, that was incredibly easy. i feel so dumb.
is there any way to check if the weapon the player is trying to set as a button has onWeaponFired(){ in it to see if its allowed to be equiped or not? thanks.
now i just need to script dragging of weapons to slots
Quote:
You must spread some reputation around before giving it to fowlplay4 again
Also is it ok if i use your online npc maker?
iv tested around with it and its brilliant!

Edit: shouldnt it have to be player.weapon.name.trigger?
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #5  
Old 08-29-2011, 07:21 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Gunderak View Post
wow, that was incredibly easy. i feel so dumb.
is there any way to check if the weapon the player is trying to set as a button has onWeaponFired(){ in it to see if its allowed to be equiped or not? thanks.
now i just need to script dragging of weapons to slots
You should just set a flag in the weapon to check if it's a "weapon" on your server. I.e:

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.itemtype "weapon";

then you can use:

if (player.weapon.itemtype == "weapon") {

else where.

Quote:
Also is it ok if i use your online npc maker?
iv tested around with it and its brilliant!
It was made for others to use.

Quote:
Edit: shouldnt it have to be player.weapon.name.trigger?
No. player.weapon is the object currently selected weapon and player.weapon.name is just the weapon's name.

You can get weapon objects by using findweapon or referencing the object directly. I.e:

For -System

findweapon("-System") or (@"-System") both would refer to the -System weapon object. Direct referencing is more efficient but using findweapon is alright too.
__________________
Quote:
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 11:44 PM.


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