wc3edit.net

United Warcraft 3 map hacking!
It is currently April 26th, 2024, 11:31 am

All times are UTC




Post new topic Reply to topic  [ 14 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: NEED RPG HELP
PostPosted: June 24th, 2007, 9:21 pm 
Offline
Honorary wc3edit.net Traitor
User avatar

Joined: February 1st, 2007, 4:11 pm
Posts: 2513
Location: NEVADA
Shafter wrote:
can u give me a set up trigger for that function? im not good with variables..

I'd probably stop working on an rpg then. just imo


Top
 Profile  
 
 Post subject: Re: NEED RPG HELP
PostPosted: June 25th, 2007, 4:27 pm 
Offline
Forum Staff
User avatar

Joined: January 28th, 2007, 8:10 pm
Posts: 830
Location: Canada
Title: JASS Programmer
There's a few ways to do this--all involving triggers.

Easiest way is to make all weapons Campaign type, shields Miscellaneous type (They can be whichever item types you want, but they all have to be the same)

For the trigger...

Create a new trigger called "OnlyOne" <-- Must be exactly as seen
Click the trigger, then go to the menus at top and hit "Edit" then "Convert to custom text"

Next, delete all the custom script in the trigger and put in

Code:
//CONFIGURATION
constant function ShieldType takes nothing returns itemtype
return ITEM_TYPE_CAMPAIGN  //Replace "CAMPAIGN" with your shield type ie: "ARTIFACT" for example
endfunction

constant function WeaponType takes nothing returns itemtype
return ITEM_TYPE_PERMANENT //Replace "MISCELLANEOUS" with your weapon type ie: "PERMANENT"
endfunction                //Try not to use "MISCELLANEOUS" --> Seems to cause errors

constant function WeaponErrorMessage takes nothing returns string
return "You're already wielding a weapon!" //Replace the message in "" with the desired message
endfunction

constant function ShieldErrorMessage takes nothing returns string
return "You're already wielding a shield!" //Replace the message in "" with the desired message
endfunction
//ENDCONFIGURATION

function SimulateError takes player p, string s returns nothing
local sound e=CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
if GetLocalPlayer()==p then
if (s!="") and (s!=null) then
call ClearTextMessages()
call DisplayTimedTextToPlayer(p,0.52,-1.00,2.00,"|cffffcc00"+s+"|r")
endif
call StartSound(e)
endif
call KillSoundWhenDone(e)
set e=null
endfunction

function CheckInventory takes nothing returns boolean
return GetItemType(GetManipulatedItem())==ShieldType() or GetItemType(GetManipulatedItem())==WeaponType()
endfunction

function DenyWeaponShield takes nothing returns nothing
local unit u=GetTriggerUnit()
local item i=GetManipulatedItem()
local itemtype it=GetItemType(i)
local integer l=0
local item q
loop
exitwhen l>5
set q=UnitItemInSlot(u,l)
if GetItemType(UnitItemInSlot(u,l))==it and i!=q then
call SetItemPosition(i,GetUnitX(u),GetUnitY(u))
if it==ShieldType() then
call SimulateError(GetOwningPlayer(u),ShieldErrorMessage())
else
call SimulateError(GetOwningPlayer(u),WeaponErrorMessage())
endif
endif
set l=l+1
endloop
set u=null
set i=null
set it=null
endfunction

function InitTrig_OnlyOne takes nothing returns nothing
set gg_trg_OnlyOne=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_OnlyOne,EVENT_PLAYER_UNIT_PICKUP_ITEM)
call TriggerAddCondition(gg_trg_OnlyOne,Condition(function CheckInventory))
call TriggerAddAction(gg_trg_OnlyOne,function DenyWeaponShield)
endfunction


Use the configuration settings at the top to set it up.
Enjoy


Top
 Profile  
 
 Post subject: Re: NEED RPG HELP
PostPosted: June 25th, 2007, 10:03 pm 
Offline
Honorary wc3edit.net Traitor
User avatar

Joined: February 1st, 2007, 4:11 pm
Posts: 2513
Location: NEVADA
Nice GUI Aero. :)


Top
 Profile  
 
 Post subject: Re: NEED RPG HELP
PostPosted: June 25th, 2007, 10:52 pm 
Offline
Forum Staff
User avatar

Joined: January 28th, 2007, 8:10 pm
Posts: 830
Location: Canada
Title: JASS Programmer
GUI is teh nooblar

I couldn't help it


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: Arnoldfek and 32 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)