- Joined
- Mar 20, 2013
- Messages
- 5
Hey guys! Some months ago me and a friend started on a new map with me mainly as the terrainer and him as the coder - sadly we had to stop the development due to not having enough time and even lost contact shortly afterwards which resulted in the map just wasting space on my harddrive.
Some weeks ago I started to continue working on the map again but I need help with one of his JASS triggers since I mainly work with GUI (Already started to learn JASS though), thanks in advance if anyone can help me
The map is a survival game based on the game Metro: Last Light where players have to utilize 4 custom ressources: Bullets, Metal, Oil and Stone. Im having problems with a trigger which adds ressources to the amount the player already has. Other triggers regarding the CRS are already fully functional, e.g. ressource deductions, refunds, multiboard showing the ressources you have, costs of the structures, etc. but this one is missing and Im not able to create such a trigger myself in JASS yet. Here are the Main Initiation trigger & the main library functions:
My JASS skills are pretty horrible so I wasnt able to come up with a working trigger yet so you guys are pretty much my last hope since I'd like to not waste the time my friend put into these JASS triggers and rewriting them in GUI would be too time consuming
What the 2 triggers I need should do:
- Increase the amount of the integer Resouce_Bullets by 1 for every kill a player does [Every player has ofc his own amount of ressources]
- Increase the amount of the interger(s) Resource_Metal / Oil / Stone by 1 after a special building is constructed every X seconds of game time. [1 specific building type for every custom ressource]
Feel free to let me know if you need more infos / code of the other triggers regarding the CRS and I will provide additional ressources.
- Zer0o
Some weeks ago I started to continue working on the map again but I need help with one of his JASS triggers since I mainly work with GUI (Already started to learn JASS though), thanks in advance if anyone can help me
The map is a survival game based on the game Metro: Last Light where players have to utilize 4 custom ressources: Bullets, Metal, Oil and Stone. Im having problems with a trigger which adds ressources to the amount the player already has. Other triggers regarding the CRS are already fully functional, e.g. ressource deductions, refunds, multiboard showing the ressources you have, costs of the structures, etc. but this one is missing and Im not able to create such a trigger myself in JASS yet. Here are the Main Initiation trigger & the main library functions:
JASS:
scope Initiation initializer MainInit
globals
integer array Resource_Bullets
integer array Resource_Metal
integer array Resource_Oil
integer array Resource_Stone
integer array Costs_Bullets
integer array Costs_Metal
integer array Costs_Oil
integer array Costs_Stone
endglobals
private function Setup takes nothing returns nothing
/**************** CONFIGURABLES ******************/
/**************************************************
***** Grant 8 Starting Resources Of Each Type *****
*********/ local integer StartAmount = 8 /*********
**************************************************/
/*************************************************/
set CC_i = 1
loop
exitwhen CC_i > 12
set Resource_Bullets[CC_i] = StartAmount
set Resource_Metal[CC_i] = StartAmount
set Resource_Oil[CC_i] = StartAmount
set Resource_Stone[CC_i] = StartAmount
set CC_i = CC_i + 1
endloop
/*************************************************/
endfunction
private function MainInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerAddAction(t, function Setup)
call TriggerRegisterTimerEvent(t, 0, false)
set t = null
endfunction
endscope
JASS:
library CRS
/*
Functions to Set, Deduct, and Refund custom resources
*/
// Use this function to set the costs of structures
function SetCost takes integer i, integer x1, integer x2, integer x3, integer x4 returns nothing
set Costs_Bullets[i] = x1
set Costs_Metal[i] = x2
set Costs_Oil[i] = x3
set Costs_Stone[i] = x4
endfunction
// Use this function to deduct from your resources
function DeductCosts takes integer p, integer i returns nothing
set Resource_Bullets = Resource_Bullets - Costs_Bullets[i]
set Resource_Metal = Resource_Metal - Costs_Metal[i]
set Resource_Oil = Resource_Oil - Costs_Oil[i]
set Resource_Stone = Resource_Stone - Costs_Stone[i]
endfunction
// Use this function to refund your resources
function RefundCosts takes integer p, integer i returns nothing
set Resource_Bullets = Resource_Bullets + Costs_Bullets[i]
set Resource_Metal = Resource_Metal + Costs_Metal[i]
set Resource_Oil = Resource_Oil + Costs_Oil[i]
set Resource_Stone = Resource_Stone + Costs_Stone[i]
endfunction
endlibrary
My JASS skills are pretty horrible so I wasnt able to come up with a working trigger yet so you guys are pretty much my last hope since I'd like to not waste the time my friend put into these JASS triggers and rewriting them in GUI would be too time consuming
What the 2 triggers I need should do:
- Increase the amount of the integer Resouce_Bullets by 1 for every kill a player does [Every player has ofc his own amount of ressources]
- Increase the amount of the interger(s) Resource_Metal / Oil / Stone by 1 after a special building is constructed every X seconds of game time. [1 specific building type for every custom ressource]
Feel free to let me know if you need more infos / code of the other triggers regarding the CRS and I will provide additional ressources.
- Zer0o
Last edited: