
No, I didn't set the player's tid in a map editor. Other scripts use PLAYER_TID and work just fine... But I'll try that just in case.FDARI wrote:Maybe you should print PLAYER_TID to verify it. You didn't try to set the player's tid in the map editor, did you? (The tid of the startspot doesn't affect the tid of the spawned player, you must set it in script)
CheckInventory would work okay with this? I didn't think it would, since its an enter-type script.Besides, in an enter-script you should be using tid 0 for efficiency and simplicity, as well as CheckInventory rather than CheckActorInventory. (Roughly same as CheckActorInventory with tid 0)
Yeah, I thought this had to be set up like how you would check for inventory in DECORATE; you check for the largest at-least value first.Another discovery: You'll never get anything but less than 40 the way your checks are organised. Whenever the value is less than 30, it will already have triggered and restarted at "less than 40". You'll need to reverse them if you want to use that approach.(Check for less than 10 first, then less than 20...)
Thanks a lot for this! I'll be sure to study it so I can correct these kind of things earlier in the futureI'm a big user of switches. Using a series of if-statements is perfectly fine as well.Spoiler: My own version


actor BaseNotifyPickup : Inventory // You may want to inherit from CustomInventory for greater flexibility
{
var int user_pnum;
states
{
spawn: // you should provide a different spawn state
tnt1 a 1
checkNextPlayer:
"####" "#" 0 A_RearrangePointers(AAPTR_PLAYER1<<user_pnum)
"####" "#" 0 A_SetUserVar("user_pnum", (user_pnum < 7) * (user_pnum + 1))
"####" "#" 0 A_JumpIfTargetInLOS("notify", 9, JLOSF_TARGETLOS|JLOSF_DEADNOJUMP) // deadnojump isn't required, max distance isn't specified, fov is 9 degrees
"####" "#" 0 A_JumpIf(true, "spawn")
notify:
"####" "#" 0 a_spawnitemex("defaultNotificationActorIfYouHaveOne_orMaybeYouWouldNotDefineThisStateInTheBaseActor")
"####" "#" 0 A_JumpIf(true, "spawn")
stop
}
}actor ExampleNotifyPickup : BaseNotifyPickup
{
states
{
notify:
"####" "#" 0 a_custommissile("notifyExample") // There are many ways to spawn an actor; this is just provided as an alternate suggestion
spawn:
ITEM A 1 A_JumpIf(user_pnum, "checkNextPlayer") // First spawn: No action. Later iterations: Check players 2-8 and then wait 1 tick
goto checkNextPlayer // check player 1, which will eventually return to the spawn state
}
}
actor LaxNotifyPickup : BaseNotifyPickup
{
states
{
notify:
"####" "#" 0 a_facetarget
"####" "#" 0 a_spawnitemex("laxNotifier") // this is the function I think you'll be using
spawn:
ITEM B 1
goto checkNextPlayer // check 1 player every tick
}
}
Users browsing this forum: Bing [Bot], massacrebosco and 2 guests