HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

problems with a trigger

02-23-2006, 05:10 AM#1
Linera
I'm trying to make this invite trigger for my party system.
The invite trigger is suppose to invite the player and the person you typed invite. works like one from World of Warcraft or EQ.
It plainly doesn't seem to work right.
I really would like him making the system.
I've been working on it for months with no luck.

custom map script:
Collapse JASS:
function GetGroup takes integer i returns integer
local integer a
    set a = 1
    loop
        exitwhen a > 6
        if ( IsPlayerInForce(Player(i), udg_Party[a]) == true ) then
        return a
        endif
        set a = a + 1
    endloop
    set a = 1
    loop
        exitwhen a > 6
        if ( IsPlayerInForce(Player(i), udg_Raid[a]) == true ) then
        return a + 6
        endif
        set a = a + 1
    endloop
set a = 0
return a
endfunction

function GetEmptyParty takes nothing returns integer
local integer a
    set a = 1
    loop
        exitwhen a > 6
        if ( CountPlayersInForceBJ(udg_Party[a]) == 0 ) then
        return a
        endif
        set a = a + 1
    endloop
return 0
endfunction
Here is what I have:
Trigger:
invite
Collapse Events
Player - Player 1 (Red) types a chat message containing -invite as A substring
Player - Player 2 (Blue) types a chat message containing -invite as A substring
Player - Player 3 (Teal) types a chat message containing -invite as A substring
Player - Player 4 (Purple) types a chat message containing -invite as A substring
Player - Player 5 (Yellow) types a chat message containing -invite as A substring
Player - Player 6 (Orange) types a chat message containing -invite as A substring
Player - Player 7 (Green) types a chat message containing -invite as A substring
Player - Player 8 (Pink) types a chat message containing -invite as A substring
Player - Player 9 (Gray) types a chat message containing -invite as A substring
Player - Player 10 (Light Blue) types a chat message containing -invite as A substring
Player - Player 11 (Dark Green) types a chat message containing -invite as A substring
Collapse Conditions
(Substring((Entered chat string), 1, 8)) Equal to -invite
Collapse Actions
Set temp_string = (Substring((Entered chat string), 9, (Length of (Entered chat string))))
Set temp_player = (Random player from (All players matching (temp_string Equal to (Name of (Matching player)))))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
temp_string Not equal to <Empty String>
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
temp_string Not equal to (Name of (Triggering player))
Collapse Then - Actions
Set i = (Player number of temp_player)
Custom script: set udg_Invited = GetGroup(udg_i)
Set i = (Player number of (Triggering player))
Custom script: set udg_Triggerplayer = GetGroup(udg_i)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Invited Equal to 0
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Triggerplayer Equal to 0
Collapse Then - Actions
Custom script: set udg_EmptyParty = GetEmptyParty()
Player Group - Add temp_player to Party[EmptyParty]
Player Group - Add (Triggering player) to Party[EmptyParty]
Collapse Else - Actions
Game - Display to (Player group((Triggering player))) the text: error
Collapse Else - Actions
Game - Display to (Player group((Triggering player))) the text: ((Name of temp_player) + is in a party.)
Collapse Else - Actions
Game - Display to (All players) the text: you can't invite yo...
Collapse Else - Actions
Game - Display to (All players) the text: you must type in a ...
02-23-2006, 06:03 AM#2
Linera
the player would type

-invite Linera

for example

that would invite said player.
02-23-2006, 06:22 AM#3
PerfectlyInsane
Quote:
Originally Posted by Linera
the player would type

-invite Linera

for example

that would invite said player.

how many characters does "-invite" have?

I counted 7 (unless you put a space there which I can't see)
02-23-2006, 06:58 AM#4
Linera
8 for the -invite_ _ is space then player's name.

please someone help. I'm sick of working on this system yet i need it.

So many headaches.
02-23-2006, 01:38 PM#5
PerfectlyInsane
lol I insist there is only 7.

I checked the blank space after your -invite. I can only highlight only 1 blank character. if your

string was "-invite "

then I should have highlighted two blank characters.

As any lines from the code you posted has 1 blank character at the end.


Here is an example

Code:
StackAmmo
    Events
        Player - Player 1 (Red) types a chat message containing -c as A substring
        Player - Player 2 (Blue) types a chat message containing -c as A substring
        Player - Player 3 (Teal) types a chat message containing -c as A substring
        Player - Player 4 (Purple) types a chat message containing -c as A substring
        Player - Player 5 (Yellow) types a chat message containing -c as A substring
        Player - Player 6 (Orange) types a chat message containing -c as A substring
        Player - Player 7 (Green) types a chat message containing -c as A substring
    Conditions
        (Substring((Entered chat string), 1, 2)) Equal to -c
    Actions
        Set SlotA[(Player number of (Triggering player))] = (Real((Substring((Entered chat string), 4, 4))))
        Set SlotB[(Player number of (Triggering player))] = (Real((Substring((Entered chat string), 6, 6))))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                SlotA[(Player number of (Triggering player))] Greater than or equal to 1.00
                SlotB[(Player number of (Triggering player))] Greater than or equal to 1.00
                SlotA[(Player number of (Triggering player))] Less than or equal to 6.00
                SlotB[(Player number of (Triggering player))] Less than or equal to 6.00
                SlotA[(Player number of (Triggering player))] Not equal to SlotB[(Player number of (Triggering player))]
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        AmmoStackingResearch[(Player number of (Triggering player))] Equal to True
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Item-type of (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotA[(Player number of (Triggering player))])))) Equal to MachineGun Bullets (30 Bullets)
                                (Item-type of (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotB[(Player number of (Triggering player))])))) Equal to MachineGun Bullets (30 Bullets)
                            Then - Actions
                                Item - Set charges remaining in (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotA[(Player number of (Triggering player))]))) to ((Charges remaining in (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotA[(Player number of (Triggering player))])))) + (Charges remaining in (Item carried by SurvUnitArray[(Player number of (Triggering player))] in 
                                Item - Remove (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotB[(Player number of (Triggering player))])))
                            Else - Actions
                                Do nothing
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Item-type of (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotA[(Player number of (Triggering player))])))) Equal to Pistol Bullets (7 bullets)
                                (Item-type of (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotB[(Player number of (Triggering player))])))) Equal to Pistol Bullets (7 bullets)
                            Then - Actions
                                Item - Set charges remaining in (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotA[(Player number of (Triggering player))]))) to ((Charges remaining in (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotA[(Player number of (Triggering player))])))) + (Charges remaining in (Item carried by SurvUnitArray[(Player number of (Triggering player))] in 
                                Item - Remove (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotB[(Player number of (Triggering player))])))
                            Else - Actions
                                Do nothing
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Item-type of (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotA[(Player number of (Triggering player))])))) Equal to Shotgun Shells
                                (Item-type of (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotB[(Player number of (Triggering player))])))) Equal to Shotgun Shells
                            Then - Actions
                                Item - Set charges remaining in (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotA[(Player number of (Triggering player))]))) to ((Charges remaining in (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotA[(Player number of (Triggering player))])))) + (Charges remaining in (Item carried by SurvUnitArray[(Player number of (Triggering player))] in 
                                Item - Remove (Item carried by SurvUnitArray[(Player number of (Triggering player))] in slot (Integer(SlotB[(Player number of (Triggering player))])))
                            Else - Actions
                                Do nothing
                        Set SlotA[(Player number of (Triggering player))] = 0.00
                        Set SlotB[(Player number of (Triggering player))] = 0.00
                    Else - Actions
                        Game - Display to (Player group((Triggering player))) the text: You will need to re...
                        Set SlotA[(Player number of (Triggering player))] = 0.00
                        Set SlotB[(Player number of (Triggering player))] = 0.00
            Else - Actions
                Set SlotA[(Player number of (Triggering player))] = 0.00
                Set SlotB[(Player number of (Triggering player))] = 0.00
02-23-2006, 07:14 PM#6
Linera
found the problem in this small trigger:
Trigger:
Then - Actions
Custom script: set udg_EmptyParty = GetEmptyParty()
Player Group - Add temp_player to Party[EmptyParty]
Player Group - Add (Triggering player) to Party[EmptyParty]
Game - Display to (All players) the text: temp_string
Game - Display to (All players) the text: (Name of temp_player)
it will only add triggering player to empty group
see first post for full trigger