• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Inventory & Equipment -By TriggerHappy. I need a little/a lot of help with Implementing

Status
Not open for further replies.
Level 2
Joined
May 1, 2016
Messages
7
Lets start off by saying i don't have anything other then JassHelper to help read this type of coding.
so it's still lines of text. nothing that really color coded or anything like that, so its just lines. And I'm still able to slowly piece everything together as I take it apart. So it takes a bit longer then it use to. I'll Digress to my main point.

StartGame - Trigger named In vJass
I don't want to spawn in a unit, nor do i want the camera functionality
I Already Have a unit (set udg_P1RedHero = gg_unit_H000_0001)
and a camera system already in place

how do i change this up for only 1 player game only with a character already set up in game?

scope StartGame initializer Init

globals
Camera array PlayerCamera
unit array PlayerHero
endglobals

private function StartGame takes nothing returns nothing
local trigger trig
local integer i = 0
local User user
local Equipment equipment
local Inventory inv
local integer array urace

set urace[1] = 'H000'//Want to remove
set urace[2] = 'Obla'//Want to remove
set urace[3] = 'Ulic'//Want to remove
set urace[4] = 'Edem'//Want to remove

loop
exitwhen i == User.AmountPlaying

set user = User.fromPlaying(i)
set PlayerCamera[user.id] = Camera.create()//Want to remove

// create hero - i would like to (set udg_P1RedHero = gg_unit_H000_0001) used instead
set equipment = equipment.create(CreateUnitAtLoc(user.handle, urace[GetHandleId(GetPlayerRace(user.handle))], GetStartLocationLoc(GetPlayerStartLocation(user.handle)), 180))

call UnitAddAbility(equipment.unit, 'A00O')
call UnitAddAbility(equipment.unit, 'A00P')

if (User.Local == user.handle) then
call SelectUnit(equipment.unit, true)
endif

set inv = Inventory.create(equipment.unit)

set PlayerHero[user.id] = equipment.unit

call SetPlayerAllianceStateBJ(Player(bj_PLAYER_NEUTRAL_EXTRA), user.handle, bj_ALLIANCE_ALLIED_VISION)
call SetPlayerAllianceStateBJ(user.handle, Player(bj_PLAYER_NEUTRAL_EXTRA), bj_ALLIANCE_ALLIED_VISION)

set i = i + 1
endloop
endfunction

private function Init takes nothing returns nothing
call StartGame()
endfunction

endscope



Hopefully someone can help me with this...
 
Before anything else, you can enclose the snippet within [code=jass][/code] tags.

JASS:
scope StartGame initializer Init

globals
Camera array PlayerCamera
unit array PlayerHero
endglobals

private function StartGame takes nothing returns nothing
local trigger trig
local integer i = 0
local User user
local Equipment equipment
local Inventory inv
local integer array urace

set urace[1] = 'H000'//Want to remove
set urace[2] = 'Obla'//Want to remove
set urace[3] = 'Ulic'//Want to remove
set urace[4] = 'Edem'//Want to remove

loop
exitwhen i == User.AmountPlaying

set user = User.fromPlaying(i)
set PlayerCamera[user.id] = Camera.create()//Want to remove

// create hero - i would like to (set udg_P1RedHero = gg_unit_H000_0001) used instead
set equipment = equipment.create(CreateUnitAtLoc(user.handle, urace[GetHandleId(GetPlayerRace(user.handle))], GetStartLocationLoc(GetPlayerStartLocation(user.handle)), 180))

call UnitAddAbility(equipment.unit, 'A00O')
call UnitAddAbility(equipment.unit, 'A00P')

if (User.Local == user.handle) then
call SelectUnit(equipment.unit, true)
endif

set inv = Inventory.create(equipment.unit)

set PlayerHero[user.id] = equipment.unit

call SetPlayerAllianceStateBJ(Player(bj_PLAYER_NEUTRAL_EXTRA), user.handle, bj_ALLIANCE_ALLIED_VISION)
call SetPlayerAllianceStateBJ(user.handle, Player(bj_PLAYER_NEUTRAL_EXTRA), bj_ALLIANCE_ALLIED_VISION)

set i = i + 1
endloop
endfunction

private function Init takes nothing returns nothing
call StartGame()
endfunction

endscope

From what I can gather, you just need to remove the lines, right? (And replace them with what you want to do)

Based on that, I came up with this:
JASS:
scope StartGame initializer Init

globals
    Camera array PlayerCamera
    unit array PlayerHero
endglobals

private function StartGame takes nothing returns nothing
    local trigger trig
    local integer i = 0
    local User user
    local Equipment equipment
    local Inventory inv
    local integer array urace

    loop
        exitwhen i == User.AmountPlaying

        set user = User.fromPlaying(i)

        set udg_P1RedHero = gg_unit_H000_000

        call UnitAddAbility(equipment.unit, 'A00O')
        call UnitAddAbility(equipment.unit, 'A00P')

        if (User.Local == user.handle) then
            call SelectUnit(equipment.unit, true)
        endif

        set inv = Inventory.create(equipment.unit)

        set PlayerHero[user.id] = equipment.unit

        call SetPlayerAllianceStateBJ(Player(bj_PLAYER_NEUTRAL_EXTRA), user.handle, bj_ALLIANCE_ALLIED_VISION)
        call SetPlayerAllianceStateBJ(user.handle, Player(bj_PLAYER_NEUTRAL_EXTRA), bj_ALLIANCE_ALLIED_VISION)

        set i = i + 1
    endloop
endfunction

private function Init takes nothing returns nothing
    call StartGame()
endfunction

endscope
 
Last edited:
Status
Not open for further replies.
Top